Latest Register Log In

+ Advanced Search

Showing wrapper content for one area only

Showing wrapper content for one area only
By
07/02/05 (Edited 03/10/14)

Suppose you have some google adsense code which you want to have display in categories, but not on other pages. Yet you want to have this code in your wrapper template, not in the 'show articles in category' template. To do this, you can use a template conditional (see the "Conditionals Syntax" knowledge base entry if you don't understand what a conditional is), like this:

<IF {TID} contains displaylinks.tpl>
stuff that should show up when we're looking at a page that uses displaylinks.tpl (the 'show articles in category' template)
</IF>

Or for another example, to have something show in the wrapper only on the registration page:

<IF {TID} contains register.tpl>
stuff that should show up when we're looking at a page that uses register.tpl (the 'registration' template)
</IF>

Sometimes you may want to display a welcome message or some sort of custom wrapper content on the entry page only. This is easy to accomplish by using the following in your wrapper:

<IF {TID} contains main.tpl>
Whatever you want to say here. Maybe a banner image too.
</IF>

This will show in your wrapper only when the main.tpl (main index) template is being used for the page body.

{TID}, as you can guess from the examples, contains the name of the body template the page is using.

An alternative method would be to rest for the page URL, with <IF {CURRENTURLCONTAINS[index.php?action=displaycat]} and {CURRENTURLCONTAINS[page=2]}> limiting to just the second page of categories.




Description How to use a conditional to display certain text in your wrapper only when a particular template (for example, main.tpl) is being shown in the body of the page.
Rating
Views 1787 views. Averaging 0 views per day.
Similar Articles