I want to put a specific sponsor banner in each forum. On vb2 I ended up creating a new template set for each banner I wanted displayed and then assigning that style to the particular forum. Is there another way I can do this that would force the banner regardless of what style is being used?
Specific Banner Per Forum
Collapse
X
-
Tags: None
-
Two options come to mind:
1) Do the same thing you did with vB2, except create the extra styles as children of your main style. Then all you would have to do is add your banners to the header templates of the child styles. All other templates and style settings would be inherited from the parent style making for easy style management (unlike vB2).
2) (without creating multiple styles) The $forumid variable parses on all forumdisplay, showthread, newreply, and newthread pages within a forum, so it can be used in the templates as an index into an array that contains your banners.
In your phpinclude_start template, use this code:
Code:$banner[[color=red]1[/color]] = "<a href=\"[color=red]LINK[/color]\" target=\"_blank\"><img src=\"[color=red]sponsor1.gif[/color]\" alt=\"\" border=\"0\" /></a>";
Then insert this code into your header template:
Code:$banner[$forumid]
-
Is there a way to do this tho so that the banners are viewed regardless of what style is selected?
Right now I have 3 user selectable styles and I would want the banner(s) to show up regardless of which of those styles is selected.
With the above (as with the way I had it set up with vb2) if a user selected a different style than the one I had included the banner in then they didn't see the banners.JulieComment
-
Using method 2 you could have a style tree like this:
Parent - contains the phpinclude_start code
--Style 1 - contains $banner[$forumid] in header
--Style 2 - contains $banner[$forumid] in header
--Style 3 - contains $banner[$forumid] in header
The child styles in the above example should not have customized phpinclude_start templates. They should inherit the phpinclude_start template from the Parent so they all have access to the banner code.Comment
-
-
Jake, I'm struggling with the same thing and would like to implement solution #2 you've suggested, but phpadnew's javascript invocation script includes more than just the image link you've used as an illustration.
E.g. for one of my banners phpadnew's invocation is:Code:<script language='JavaScript' type='text/javascript'> <!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"); document.write ("http://mysite/~totalli/ads/adjs.php?n=" + phpAds_random); document.write ("&what=zone:3"); document.write ("&exclude=" + document.phpAds_used); if (document.referer) document.write ("&referer=" + escape(document.referer)); document.write ("'><" + "/script>"); //--> </script><noscript><a href='http://mysite/~totalli/ads/adclick.php?n=a9b483f1' target='_blank'> <img src='http://mysite/~totalli/ads/adview.php?what=zone:3&n=a9b483f1' border='0' alt=''></a></noscript>
Code:$banner[1] = "<script language='JavaScript' type='text/javascript'> <!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\"); document.write (\"http://mysite/~totalli/ads/adjs.php?n=\" + phpAds_random); document.write (\"&what=zone:3\"); document.write (\"&exclude=\" + document.phpAds_used); if (document.referer) document.write (\"&referer=\" + escape(document.referer)); document.write (\"'><\" + \"/script>\"); //--> </script><noscript><a href='http://mysite/~totalli/ads/adclick.php?n=a9b483f1' target='_blank'> <img src='http://mysite/~totalli/ads/adview.php?what=zone:3&n=a9b483f1' border='0' alt=\''></a></noscript>";
Last edited by mfarmerhi; Wed 25 Aug '04, 10:37pm.Comment
-
Originally posted by mfarmerhiSo... should ALL of that be included between the quotes you've used in your illustration above...
You can avoid the trouble of assigning that code to a variable by using a template conditional in the header instead. For example:
Code:[color=red]<if condition="$forumid == X">[/color] <script language='JavaScript' type='text/javascript'> <!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"); document.write ("http://mysite/~totalli/ads/adjs.php?n=" + phpAds_random); document.write ("&what=zone:3"); document.write ("&exclude=" + document.phpAds_used); if (document.referer) document.write ("&referer=" + escape(document.referer)); document.write ("'><" + "/script>"); //--> </script><noscript><a href='http://mysite/~totalli/ads/adclick.php?n=a9b483f1' target='_blank'> <img src='http://mysite/~totalli/ads/adview.php?what=zone:3&n=a9b483f1' border='0' alt=''></a></noscript> [color=red]</if>[/color]
Comment
-
$forumid should work in the header template for all pages within a forum, including SHOWTHREAD pages.
If you are using this variable in a template other than the header template then you might have scope problems. Try using $GLOBALS[forumid] instead, or possibly $foruminfo[forumid].Comment
-
I'm using the first method discussed, that is, defining the banners (e.g. $banner[18] = ""; ) in the phpinclude, then calling them in the forum display: $banner[$forumid]
In editing the displaythread template (that template and not the header include for that template), I attempted adding the same: $banner[$forumid]
No errors, but no banner displays either.
Sorry, php newb here, but I tried your suggestions. BothCode:$banner[$GLOBALS[forumid]]
Code:$banner[$foruminfo[forumid]]
Comment
-
oh, put curlies around those:
Code:{$banner[$GLOBALS[forumid]]}
Comment
-
Yea... it's just not working. I'll PM you tomorrow, but it appears that it's just not accessing the variable $forumid from the showthread template (BTW, I'm still using Vb2.3)
No matter how I called itCode:{$banner[$GLOBALS[forumid]]} {$banner[$foruminfo[forumid]]} or $banner[$forumid]
Last edited by mfarmerhi; Tue 7 Sep '04, 12:56am.Comment
-
Originally posted by mfarmerhi(BTW, I'm still using Vb2.3)
I will look at making this work for vB2 when I get home this evening.Comment
-
This works in the showthread template in vB2:
Code:{$banner[$forum[forumid]]}
Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment