Add Adsense Ad Codes In .tpl Files Of PHP Link Directory

It is a bit tricky to add ad codes in PHP Link Directory (PHPld), phpbb, pligg or any other CMS which is using smarty templates. Smarty is actually a template engine which is used along with PHP. Smarty is used for keeping the functionality of the website separate from the design of the template. If you directly add the add codes in .tpl files (supported by smarty templates) you will get an error. It is because smarty templates won’t be able to translate the Javascript ad codes.

To add Adsense, Infolinks, Chitika, Bidvertiser, Media.net or any other affiliate marketing Javascript ad codes you have to put the codes inside a literal tag in your .tpl files:

{literal}
Your ad code goes here
{/literal}

For Example, if you wish to add ad codes in the header of your PHP link directory site, open file header.tpl (this would probably be located in directory/templates) by using notepad and add the ad codes in the format as given above (replace “Your ad code goes here” with your ad code) in the desired location. Now, import the file again to your site. Similarly, you can add the ad codes in any .tpl file like footer.tpl, sidebar.tpl etc.

Download thousands of Themes, Plugins & Graphics to create your Website. Use promo code ThatsJournal and get an additional 10% off for All MonsterONE Plans.
Disclosure: Thats Journal is supported by our readers. This page may contain affiliate links. That means, if you click on these links to make a purchase, we may earn a small commission (at no extra cost to you). These funds help us to keep this blog up and running.