PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Tue Jul 22, 2008 1:21 pm
I am working with PHP nuke and I want to move the banner ads on a them up into a table, but I am a newb to PHP coding and could use a little help.
Code: Select all
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\">\n"
."<tr>\n<td background=\"themes/$thename/images/logobg.gif\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\"></td>\n</tr>\n"
."</table>\n";
}
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\" bgcolor=\"#fefefe\">\n"
."<tr>\n<td bgcolor=\"$textcolor1\" colspan=\"3\"><IMG src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" hspace=\"0\"></td>\n</tr>\n"
."<tr bgcolor=\"$bgcolor1\">\n<td align=\"left\" width=\"33%\"><font size=\"2\" color=\"#363636\">\n";
if ($username == $anonymous) {
echo " <a href=\"user.php?op=new_user\">"._NEWUSER."</a></b> / <b><a href=\"user.php\">"._USERLOGIN."</a>\n";
} else {
echo " "._TWELCOME." $username: <a href=\"user.php\">"._TACCOUNT."</a> | <a href=\"user.php?op=logout\">"._LOGOUT."</a>";
}
echo "</font></td>\n"
." <td align=\"center\" width=\"34%\"><font size=\"2\" color=\"#363636\">\n";
$result = sql_query("select type, var, count from $prefix"._counter." order by type desc", $dbi);
while(list($type, $var, $count) = sql_fetch_row($result, $dbi)) {
if(($type == "total") && ($var == "hits")) {
$total = $count;
echo ""._WERECEIVED." $total "._PAGESVIEWS." $startdate\n";
}
}
echo "</font></td>\n"
."<td align=\"right\" width=\"33%\"><font size=\"2\">\n";
$numrows = sql_num_rows(sql_query("select uid from $prefix"._users."", $dbi), $dbi);
echo " </font>\n</td>\n</tr>\n"
."<tr>\n<td bgcolor=\"$textcolor1\" colspan=\"3\"><IMG src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" hspace=\"0\"></td>\n"
."</tr>\n</table>\n"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr valign=\"top\">\n"
."<td><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"5\" border=\"0\" alt=\"\"></td></tr></table>\n"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr valign=\"top\">\n"
."<td width=\"160\" valign=\"top\">\n";
blocks(left);
echo "</td><td><img src=\"themes/$thename/images/pixel.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\"></td><td width=\"100%\" bgcolor=\"$bgcolor1\">\n";
if ($banners) {
OpenTable2();
echo "<center>";
echo ads(0);
echo "</center>";
CloseTable2();
echo "<br>";
}
}
I need to put the code:
up into the table containing the logo.
Code: Select all
else {
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\">\n"
."<tr>\n<td background=\"themes/$thename/images/logobg.gif\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\">[b][color=#BF0000]NEED BANNERS HERE[/color][/b]</td>\n</tr>\n"
."</table>\n";
Here is what I tried to do:
Code: Select all
else {
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\">\n"
."<tr>\n<td background=\"themes/$thename/images/logobg.gif\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\"><php? if (banners) {echo ads(0); } ?></td>\n</tr>\n"
."</table>\n";
Didn't work. Any help would be greatly appreciated.
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Tue Jul 22, 2008 3:47 pm
I know someone knows how to do this...
omniuni
Forum Regular
Posts: 738 Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA
Post
by omniuni » Tue Jul 22, 2008 4:12 pm
Code: Select all
else {
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\">\n"
."<tr>\n<td background=\"themes/$thename/images/logobg.gif\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\">";
if (banners) {echo ads(0); }
echo "</td>\n</tr>\n</table>\n";
You are already in PHP, you don't need the tags. Try the above.
Also, are you quite sure if(banners) is right? It's not something like if($banners) ?
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Tue Jul 22, 2008 6:24 pm
I tried the above, but when loading the page it was blank. I tried a few variations of that but still can't get it to work.
Edit: it was $banners I messed up when posting, but I fixed it in the code
omniuni
Forum Regular
Posts: 738 Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA
Post
by omniuni » Tue Jul 22, 2008 8:21 pm
I would carefully check the statement to make sure that everything is escaped correctly. If it's all semantically correct, I'm sorry, I'm out of suggestions at the moment.
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Tue Jul 22, 2008 9:23 pm
well I got it pretty close by changing some of the code. It seems the original coding was using \n" to escape??? I don't know, that must be some advanced style of coding that I don't understand.
I just went back and replaced the . " \n" with plain old echo " ";
I got it really close to where i want the ads, but the ads are below the logo.gif and I want it beside the logo.gif. The logo is only 350px wide and the ads are 468 so there should be plenty of space left for the ads to fit next to the logo on my monitor atleast, I might go back and resize the logo to make it fit into the 800px so it should work on nearly all screens.
Any suggestions?
here is the new code:
Code: Select all
else {
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\" border=\"0\" align=\"center\">";
echo "<tr>\n<td background=\"themes/$thename/images/logobg.gif\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\">";
if ($banners) {echo ads(0);}
echo "</td>\n</tr>";
echo "</table>";
}
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Wed Jul 23, 2008 11:22 am
Anyone have anymore on this???
I need to get this done tonight
mabwi
Forum Commoner
Posts: 27 Joined: Wed Aug 01, 2007 4:51 pm
Post
by mabwi » Wed Jul 23, 2008 11:49 am
What's the HTML output look like? It seems the problem is the positioning of the elements, but everything is appearing correctly?
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Wed Jul 23, 2008 1:49 pm
I figured by changing the table's align "center" to "left" would fix it but it didn't
Here is what the HTML output looks like:
Code: Select all
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td background="themes/theme2/images/logobg.gif"><img src="themes/theme2/images/logo.gif" alt="Welcome to Monticello Now" border="0" width="350" height="100">
<center><a href="index.php?op=ad_click&bid=1" target="_blank"><img src="/banners/hosting.gif" alt="Click Here" title="Click Here" border="0"></a></center></td></tr></tbody></table>
mabwi
Forum Commoner
Posts: 27 Joined: Wed Aug 01, 2007 4:51 pm
Post
by mabwi » Wed Jul 23, 2008 3:37 pm
Change your output to this:
Code: Select all
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td background="themes/theme2/images/logobg.gif"> <img src="themes/theme2/images/logo.gif" alt="Welcome to Monticello Now" border="0" width="350" height="100"> </td> <td> <center> <a href="index.php?op=ad_click&bid=1" target="_blank"> <img src="/banners/hosting.gif" alt="Click Here" title="Click Here" border="0"> </a> </center> </td> </tr> </tbody></table>
Note that the logo & banner are in separate td's.
strangenet
Forum Newbie
Posts: 7 Joined: Tue Jul 22, 2008 1:13 pm
Post
by strangenet » Wed Jul 23, 2008 4:48 pm
mabwi wrote: Change your output to this:
Code: Select all
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td background="themes/theme2/images/logobg.gif"> <img src="themes/theme2/images/logo.gif" alt="Welcome to Monticello Now" border="0" width="350" height="100"> </td> <td> <center> <a href="index.php?op=ad_click&bid=1" target="_blank"> <img src="/banners/hosting.gif" alt="Click Here" title="Click Here" border="0"> </a> </center> </td> </tr> </tbody></table>
Note that the logo & banner are in separate td's.
Thanks for the tip, I tried adding another TD before but I must have escaped it wrong or something. I just tried it again and it works fine now
Thanks for the help guys.
Here is the final code:
Code: Select all
else {
echo "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\">";
echo "<tr><td width=\"350\"><img src=\"themes/$thename/images/logo.gif\" alt=\""._WELCOMETO." $sitename\" border=\"0\" height=\"100\" width=\"350\"></td>";
echo "<td background=\"themes/$thename/images/logobg.gif\">";
if ($banners) {echo ads(0);}
echo "</td></tr></table>";
}