How To Display Sponsor Links For Categories

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    How To Display Sponsor Links For Categories

    See attached image for what the end result looks like.

    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates -> forumhome_forumbit_level1_nopost

    Add the red code:

    Code:
    	<tr>
    		<td class="tcat" [color=red]colspan="2"[/color]>
    			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
    			<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
    			<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    			<if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    		</td>
    		[color=red]<td class="tcat" align="right" colspan="<if condition="$vboptions[showmoderatorcolumn]">4<else />3</if>">
    			SPONSOR CODE HERE
    		</td>[/color]
    	</tr>
    This will create the basic separation so there is room for an sponsor link. There are many ways to add a sponsor link to each category. One way is to define the links in your phpinclude_start template.

    The $forum[forumid] variable in the forumhome_forumbit_level1_nopost template parses into the forumid of the category, so it can be used in the templates as an index into an array that contains your sponsor links.

    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start

    Add this code to that template:

    Code:
    $sponsor[[color=red]1[/color]] = 'Sponsored by <a href="[color=red]LINK[/color]" target="_blank"><img src="[color=red]sponsor1.gif[/color]" alt="" border="0" /></a>';
    Change the red code appropriately, where the number inside brackets is the forumid of the category to which this sponsor link belongs. If you have more categories with sponsors, simply add more instances of the above code.

    Then go back to your forumhome_forumbit_level1_nopost template. Add the blue code in the sponsor link space:

    Code:
    	<tr>
    		<td class="tcat" [color=red]colspan="2"[/color]>
    			<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
    			<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
    			<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    			<if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    		</td>
    		[color=red]<td class="tcat" align="right" colspan="<if condition="$vboptions[showmoderatorcolumn]">4<else />3</if>">
    			[color=blue]{$GLOBALS[sponsor][$forum[forumid]]}[/color]
    		</td>[/color]
    	</tr>
    Now the categories for which sponsor links are defined in the phpinclude_start template will display their respective links.

    edit: changed phpinclude_start code to use single quotes to enclose the string, so you don't have to escape the double quotes.
    Attached Files
    Last edited by Jake Bunce; Sun 13 Feb '05, 11:55pm.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...