Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Smarty {IF} Statement - Variables List

darbeeydarbeey New
edited March 2013 in Vanilla 2.0 - 2.8

This is a list of available {if} statement variables that may be used on the default-master.tpl file in Vanilla 2.1, please add any that you know of or correct me if i am wrong :)

{if  $Variable}
Display This Text
{else}
Nothing
{/if}

Add the following in place of the word $Variable above:

$Discussion - This targets the discussion and comments page as well as the the edit discussion page 

$Discussions - This targets the recent discussions page

$Category - Targets the category pages.

$Categories -  Targets the main category page list and the category pages.

$Comments - Targets discussions that have comments only.

$Profile - Targets the Profile page.

BodyID can be used to show things only on specific pages:

{if $BodyID =='variable'}
Display This Text
{else}
Nothing
{/if}

Add the following in place of the word variable above:

vanilla_categories_index
vanilla_discussions_index
vanilla_discussion_index
vanilla_discussions_mine
vanilla_drafts_index
vanilla_post_edit discussion
vanilla_post_discussion

conversations_messages_all
conversations_messages_index

dashboard_activity_index
dashboard_profile_notifications
dashboard_profile_discussions
dashboard_profile_comments
dashboard_profile_edit
dashboard_search_index
dashboard_entry_register
dashboard_entry_signin

Other variables can be found by temporarily adding {debug} to the top of your default-master.tpl template. This will show you a pop up with all the variables on the current page, Just scroll down until you find BodyID:

image

An example of how to target multiple pages using smarty.

{if $Comments}
Display A
{elseif $Profile}
Display B
{elseif  $BodyID =='dashboard_entry_signin'}
Display C
{else}
Display D
{/if}

Comments

Sign In or Register to comment.