in this tutorial we will look at using conditionals in plugins to show/hide content on certain pages using simple PHP.
in each of the above examples we used $TMPL['something'] for the tag, when used in a template that would look like {$something}
PHP:
//Show on Custom Pages Only
if(isset($FORM['page'])) {
$TMPL['something'] = 'This is visible only on custom pages';
}
//Show on a specific custom page that has ID of advertise
if($FORM['page'] == 'advertise') {
$TMPL['something'] = 'This is visible only on the advertise custom page';
}
//Show on search results page
if($FORM['a'] == 'search') {
$TMPL['something'] = 'This is visible only on the search results page';
}
//Show on stats pages
if($FORM['a'] == 'stats') {
$TMPL['something'] = 'This is visible only on the users stats page';
}
//Show on user control panel
if($FORM['a'] == 'user_cpl') {
$TMPL['something'] = 'This is visible only on the users control panel ';
}
//Show on home page and all ranking pages, hide on search, stats, user control panel etc
if(!isset($FORM['a'])) {
$TMPL['something'] = 'This is visible only on home page and all ranking pages ';
}
in each of the above examples we used $TMPL['something'] for the tag, when used in a template that would look like {$something}