Author |
Message |
dark-dude
Worker


Joined: Jun 29, 2003
Posts: 146
Location: Oklahoma
|
Posted:
Thu Jan 04, 2007 9:38 pm |
|
I am trying to add a banner and it is set to position 0 and all that but for some reason, it never shows up on top right like it should. I am using the subBlack theme also.....if that makes a difference. How can I make the banner show? It says something about Code:To use the position you must include the code: ads(position); in your theme file, where "position" is the number of the position you want to use in that ad space.
You can have a look at the file /blocks/block-Advertising.php and file /header.php to have a clear example on how to implement this in your site.
| and i don't have a clue what its asking for. I looked in those files but didn't see what I needed I guess. |
_________________ DaRk-DuDe |
|
 |
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Fri Jan 05, 2007 6:32 am |
|
Here are a few lines from DeepBlue theme that might help you get this in the right place (look for this code in themes/DeepBlue/theme.php):
Code:
function themeheader() {
global $banners, $sitename;
echo '<body bgcolor="#0E3259" text="#000000" link="#0000ff"><br />';
if ($banners) {
echo ads(0);
echo '<br />';
}
|
See if you can model after that. Notice the "echo ads(0);" statement. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
dark-dude

|
Posted:
Fri Jan 05, 2007 2:37 pm |
|
OK I got a banner to work...but it puts in in the center at the very top above the actual place....whereas i always thought it would be to the right side of the logo. This one drops the page down and puts the logo there |
|
|
|
 |
montego

|
Posted:
Fri Jan 05, 2007 2:49 pm |
|
Well, you have to change your themeheader function to write the HTML code to position that properly. Since every theme can be different, you will have to trace within that function where to place the proper HTML. |
|
|
|
 |
dark-dude

|
Posted:
Fri Jan 05, 2007 4:53 pm |
|
Ok well here is what I have now Code:function themeheader() {
global $admin, $user, $banners, $sitename, $slogan, $cookie, $prefix, $db, $nukeurl, $anonymous;
if ($banners == 1) {
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE type='0' AND active='1'"));
echo ads(0);
echo '<br />';
/* Get a random banner if exist any. */
/* More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar */
if ($numrows>1) {
$numrows = $numrows-1;
mt_srand((double)microtime()*1000000);
$bannum = mt_rand(0, $numrows);
} else {
$bannum = 0;
}
$sql = "SELECT bid, imageurl, clickurl, alttext FROM ".$prefix."_banner WHERE type='0' AND active='1' LIMIT $bannum,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$bid = $row[bid];
$imageurl = $row[imageurl];
$clickurl = $row[clickurl];
$alttext = $row[alttext];
if (!is_admin($admin)) {
$db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'");
}
if($numrows>0) {
$sql2 = "SELECT cid, imptotal, impmade, clicks, date FROM ".$prefix."_banner WHERE bid='$bid'";
$result2 = $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result2);
$cid = $row2[cid];
$imptotal = $row2[imptotal];
$impmade = $row2[impmade];
$clicks = $row2[clicks];
$date = $row2[date];
|
And it puts it dead center above the actual theme. I have tried several differnet situations and I get a blank white page LOL so I am not sure here
Any help here would be GREATLY APPRECIATED |
|
|
|
 |
montego

|
Posted:
Fri Jan 05, 2007 5:23 pm |
|
Well, the blank white page means you introduced a PHP syntax error. Since I cannot see all your theme files, and I am not really a theme expert per se, this is going to be a little difficult. However, let us try something.
If you have a header.html file in the same directory, look to see if there is some variable in it with 'banners' in its name such as $banner, or $showbanners. Whatever that variable name is, instead of doing the echo as I showed it, do this instead (in the same place) - lets assume its $showbanners:
$showbanners = ads(0); |
|
|
|
 |
dark-dude

|
Posted:
Fri Jan 05, 2007 5:31 pm |
|
OK Here is the full code from theme.php
Code:function themeheader() {
global $admin, $user, $banners, $sitename, $slogan, $cookie, $prefix, $db, $nukeurl, $anonymous;
if ($banners == 1) {
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_banner WHERE type='0' AND active='1'"));
echo ads(0);
echo '<br />';
/* Get a random banner if exist any. */
/* More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar */
if ($numrows>1) {
$numrows = $numrows-1;
mt_srand((double)microtime()*1000000);
$bannum = mt_rand(0, $numrows);
} else {
$bannum = 0;
}
$sql = "SELECT bid, imageurl, clickurl, alttext FROM ".$prefix."_banner WHERE type='0' AND active='1' LIMIT $bannum,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$bid = $row[bid];
$imageurl = $row[imageurl];
$clickurl = $row[clickurl];
$alttext = $row[alttext];
if (!is_admin($admin)) {
$db->sql_query("UPDATE ".$prefix."_banner SET impmade=impmade+1 WHERE bid='$bid'");
}
if($numrows>0) {
$sql2 = "SELECT cid, imptotal, impmade, clicks, date FROM ".$prefix."_banner WHERE bid='$bid'";
$result2 = $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result2);
$cid = $row2[cid];
$imptotal = $row2[imptotal];
$impmade = $row2[impmade];
$clicks = $row2[clicks];
$date = $row2[date];
/* Check if this impression is the last one and print the banner */
if (($imptotal <= $impmade) AND ($imptotal != 0)) {
$db->sql_query("UPDATE ".$prefix."_banner SET active='0' WHERE bid='$bid'");
$sql3 = "SELECT name, contact, email FROM ".$prefix."_bannerclient WHERE cid='$cid'";
$result3 = $db->sql_query($sql3);
$row3 = $db->sql_fetchrow($result3);
$c_name = $row3[name];
$c_contact = $row3[contact];
$c_email = $row3[email];
if ($c_email != "") {
$from = "$sitename <$adminmail>";
$to = "$c_contact <$c_email>";
$message = ""._HELLO." $c_contact:\n\n";
$message .= ""._THISISAUTOMATED."\n\n";
$message .= ""._THERESULTS."\n\n";
$message .= ""._TOTALIMPRESSIONS." $imptotal\n";
$message .= ""._CLICKSRECEIVED." $clicks\n";
$message .= ""._IMAGEURL." $imageurl\n";
$message .= ""._CLICKURL." $clickurl\n";
$message .= ""._ALTERNATETEXT." $alttext\n\n";
$message .= ""._HOPEYOULIKED."\n\n";
$message .= ""._THANKSUPPORT."\n\n";
$message .= "- $sitename "._TEAM."\n";
$message .= "$nukeurl";
$subject = "$sitename: "._BANNERSFINNISHED."";
mail($to, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
}
}
$showbanners = "<a href=\"banners.php?op=click&bid=$bid\" target=\"_blank\"><img src=\"$imageurl\" border=\"0\" alt='$alttext' title='$alttext'></a> ";
}
}
|
$showbanners is there close to the bottom, then in the header.html file at the top it has this
Code:<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td bgcolor="#000000"><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#212121"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60%" height="85"><a href="index.php"><img src="themes/subBlack/images/logo.gif" border="0" alt="$sitename"></a></td>
<td width="40%" height="85" align="right">$showbanners </td>
</tr>
</table></td>
</tr>
|
So what part do I need to change? |
|
|
|
 |
montego

|
Posted:
Fri Jan 05, 2007 5:38 pm |
|
in theme.php, remove the line you added for this:
echo ads(0);
Then, modify the $showbanners = line towards the bottom to look like this:
$showbanners = ads(0);
make sure you BACKUP your files so that you can get back to where you started very quickly!  |
|
|
|
 |
dark-dude

|
Posted:
Fri Jan 05, 2007 5:41 pm |
|
well no errors but no banner either....just a home page...the normal one |
|
|
|
 |
montego

|
Posted:
Fri Jan 05, 2007 6:00 pm |
|
Ok, try this. Replace the entire function with just this:
Code:
function themeheader() {
global $admin, $user, $banners, $sitename, $slogan, $cookie, $prefix, $db, $nukeurl, $anonymous;
if ($banners) {
echo '<div align="right">'.ads(0).'</div>';
echo '<br />';
}
}
|
|
|
|
|
 |
montego

|
Posted:
Fri Jan 05, 2007 6:01 pm |
|
BTW, your theme is an older one and is not compatible with 8.0's new banner system (actually, it might have even been an earlier 7.8 or 7.9 version where it changed, but I cannot recall since I refuse to use anything above 7.6 for security reasons), so this is like doing open heart surgery with a blind surgeon. |
|
|
|
 |
dark-dude

|
Posted:
Sun Jan 07, 2007 5:52 pm |
|
nothing but a blank white page LOL |
|
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Sun Jan 07, 2007 10:46 pm |
|
I assume you've already enabled error reporting and checked your error logs? |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
 |
montego

|
Posted:
Sun Jan 07, 2007 11:09 pm |
|
dark-dude, you might try getting with the author of that theme and see if they would be willing to give you one that will work with the 8.0 banners system. Unfortunately, I just would not have the time to try and fix this for you. |
|
|
|
 |
Roy_Shiker
Hangin' Around

Joined: Dec 27, 2003
Posts: 45
|
Posted:
Mon Apr 16, 2007 4:22 pm |
|
Hey guys,
i got the same problem, but i got Elektro theme.
and i want to put the banner for the banners system in the header.html
how do i make it to show up ?
t
to show up banners, i use $showbanners function.
BUT it showing up only img banners and not flash.
any idea? |
|
|
|
 |
|