Log in

View Full Version : Call one template from another..


GrBear
11-27-2005, 08:08 PM
I'm probably going to get laughed at for this one, I have a really dumb question that I tried to research already (for the past hour), but the answers were confusing to say the least. :nervous:

I'm trying to put Google AdSense on my forums, and instead of inserting the code into each template I want the AdSense code in, I created a template called 'GoogleAdsenseCode' in my primary parent style.

I tried adding the line $GoogleAdsenseCode in the template FORUMHOME where I wanted the code, and of course nothing happened.

I vaugly recall a couple years ago when I tried to make my own custom hack for vB3.0, I had to edit a php file. In vB3.5, apparently they made it somewhat less messy, but I for the life of me can't find a relevant 'tutorial' on how to do it .

Any help would be GREATLY appreciated! :bunny:

merk
11-27-2005, 08:53 PM
You have to process the template.

Add a hook to cache_templates

$globaltemplates[] = 'GoogleAdsenseCode';


Add a hook to parse_templates

eval('$adsense = "' . fetch_template('GoogleAdsenseCode') . '";');


Then use $adsense in your templates. It will work in most locations.

GrBear
11-27-2005, 09:08 PM
You have to process the template.

Add a hook to cache_templates

Thank you for your help merk, it's really appreciated. Can you point me to something that details how to 'add a hook'? :)

I found it.. AdminCP -> Plugin System -> Add New Plugin :) Thanks again merk!

merk
11-28-2005, 12:24 AM
FYI - http://www.vbulletin.com/docs/html/plugin_system