View Full Version : Different Ads on different forums + showing recent threads on main page of website
Hi, I'm looking for a couple of hacks - I have tried searching these forums but couldn't find them.
1. I wish my forums to display different ads for different forums - like what is done at sitepoint. I don't know if this is done with a hack or just playing with different templates.
2. I also wish to display a dynamic box on the main page of my website (not the main page of the forums) with the 5 most recent threads in the forums. The main page is a PHP page.
Any help would be appreciated!!
Gary King
08-04-2003, 05:30 PM
1. Modify the forumhome_forumbit_level1_nopost, and add a <td style="text-align: right;">$advertisement</td>and add some code to your index.php, like if ($forum['forumid']==1)
{
$advertisement="<img src=\"images/advertisement01.jpg\" />";
}right before eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
2. Have you tried searching? I've found https://vborg.vbsupport.ru/showthread.php?s=&threadid=35513&highlight=%2Arecen%2A, and although it scrolls the threads, you could just remove the <marquee> tags.
Thank you so much! I will try out both and let you know how it worked. Much appreciated!
Well I'm having some problems implementing the marquee hack - posted about it in the thread. Looks like it's an old thread - I hope someone will be around to help. I guess I'm going to try the advertisements now :D
Gary - question about the PHP code for the different ads.
I need the images to be linked to the advertisers's website.
I'm not sure how to change the PHP code - would that be the right syntax -
if ($forum['forumid']==1)
{
$advertisement="<a href="http://adsite.com" target="_blank'><img src=\"images/advertisement01.jpg\" /></a>";
}
Not sure where I put the </a> at the end....
Gary King
08-05-2003, 01:11 PM
Today at 06:06 AM Anat said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=423363#post423363)
Gary - question about the PHP code for the different ads.
I need the images to be linked to the advertisers's website.
I'm not sure how to change the PHP code - would that be the right syntax -
if ($forum['forumid']==1)
{
$advertisement="<a href="http://adsite.com" target="_blank'><img src=\"images/advertisement01.jpg\" /></a>";
}
Not sure where I put the </a> at the end....
This is what you should have:
if ($forum['forumid']==1)
{
$advertisement="<a href=\"http://adsite.com\" target=\"_blank\"><img src=\"images/advertisement01.jpg\" /></a>";
}
Phew - glad I asked. No way would I have guessed that!
Thanks again Gary!!!
Gary King
08-05-2003, 02:46 PM
Glad I could help!
Hmmmm.... Gary for some reason this isn't working for me. I did everything you said - and no ad show up...
This is what the code at index.php looks like -
if ($forum['forumid']==1)
{
$advertisement="<img src=\"/forums/images_new/ad01.gif\" />";
}
if ($forum['forumid']==2)
{
$advertisement="<img src=\"/forums/images_new/ad01.gif\" />";
}
if ($forum['forumid']==3)
{
$advertisement="<img src=\"/forums/images_new/ad11.gif\" />";
}
if ($forum['forumid']==4)
{
$advertisement="<img src=\"/forums/images_new/ad11.gif\" />";
}
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
---------------------------------------------------------------
I also changed the forumhome_forumbit_level1_nopost template exactly like you told me.
Nothing shows up - not even a red X (of course I have the images uploaded at that URL).
------------------------------------------------------------
In case you wish to see this for yourself you need to login as -
username - addelle password - review
As all of the above is only in my new design (I have changed the template in the new design only) and that user is set to see the new design (no posting or any other privelages ;))
BTW - not sure how this fits in but I would really like the ads to show right beneath the header of my site (i.e. right before the forums display). I tried putting the $advertisement as part of the header but it doesn't work...
Gary King
08-06-2003, 09:47 PM
My best bet is that you didn't modify the forumhome_forumbit_level1_nopost template properly.
If you have the default template, you should have the following after adding the advertisement part:
<tr id="cat">
<td bgcolor="{ categorybackcolor }" colspan="6"><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]"><normalfont color="{ categoryfontcolor }"><b>$forum[title]</b></normalfont></a>
<br><smallfont color="#000000">$forum[description]</smallfont></td>
<td bgcolor="{ categorybackcolor }" style="text-align: right;">$advertisement</td>
</tr>
That should work.
Don't forget to remove the spaces for { categorybackcolor } and { categoryfontcolor }
And oh, next time you post code, please use the tags :)
Let me try the quoting system - I'm never sure how to go about it in programming forums....
This is what the forumdisplay_forumbit_level1_nopost looks for me now -
<td style="text-align: right;">$advertisement</td>
<tr id="cat">
<td bgcolor="{categorybackcolor}" colspan="6"><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]"><normalfont color="{categoryfontcolor}"><b>$forum[title]</b></normalfont></a>
<br><smallfont color="{categoryfontcolor}">$forum[description]</smallfont></td>
</tr>
Obviously I didn't remove the spaces so it shows the VBorg preferences. I see now that I put the advertisement part before the rest of it - maybe that's the problem? will try your version now.
Nope - still not working. The template now looks like this -
<tr id="cat">
<td bgcolor="{categorybackcolor}" colspan="6"><a href="forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]"><normalfont color="{categoryfontcolor}"><b>$forum[title]</b></normalfont></a>
<br><smallfont color="{categoryfontcolor}">$forum[description]</smallfont></td>
<td style="text-align: right;">$advertisement</td>
</tr>
Gary - where is the ad supposed to show on the page? Looking at the code it says forum description. I only have forum descriptions on the main page. I'd like the ad to show up at the top of the page on every forum page. Just where the ad shows up on my current version of the forums (ad for royal canine) - just to have it display different ads at different forums.
Gary King
08-07-2003, 03:06 PM
Today at 03:04 AM Anat said this in Post #15 (https://vborg.vbsupport.ru/showthread.php?postid=424023#post424023)
Gary - where is the ad supposed to show on the page? Looking at the code it says forum description. I only have forum descriptions on the main page. I'd like the ad to show up at the top of the page on every forum page. Just where the ad shows up on my current version of the forums (ad for royal canine) - just to have it display different ads at different forums.
OK, now you've got me confused :speechless:
What I was trying to do was to help you have an advertisement for each category in the forumhome, to the right, like as you said, at the SitePoint forums.
You should specify WHICH ads you want to have at your forum.
You can see what I was trying to help you with in the attached screenshot.
oops - I see what you mean. I forgot that sitepoint also have the sponsorship on their forums main page. I was thinking about the way it looks on any of the forums pages themselves.
Like here -
http://www.sitepointforums.com/forumdisplay.php?forumid=16
And in the same forum here-
http://www.sitepointforums.com/showthread.php?threadid=121963
Sorry about the confusion maybe I should have been clearer about that.
Maybe I should just work with custom styles for each forum? I thought there might be some other solution. Some hack that would define $advertisement and allow me to put different ones for each one. I'm really not familiar with how VB works - if it were Links SQL the solution would be to define a new global. I don't know how this is done in VB (ok, ok, I don't know how it's done in LSQL either - just that is can be done :p )
Gary, I wish to pay whoever can get this script working for me. I posted about it in the paid jobs forum. If you're still working on this - please read my post there first.
Thanks again!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.