Template tags and variables
If you take a peek into the header.tpl template file that came with your vldPersonals, you will notice that where it says “dating site” in your title (or whatever title you have set in the control panel), it doesn't actually contain “dating site” words in the template file. In fact, it has a bunch of strange arrows and parentheses and words that don't make much sense. These are examples of a “template tags”.
Variables
Some of the predefined templates have built in variables that you can use to display certain information such as users screen names, emails, profile field, etc. To display a screen name, you would be using something like this:
{screenname}
There are two types of variables: global and local. Global variables can be access in any template file, local variables can be accessed only in certain templates that were assigned to them. Learn more about specific variables and where you can access them.
Conditional tags
The conditional tags can be used in your template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to display a login form only to the users who are not logged in. To do that you would be using something like this:
<!-- IF loggedin != "1" --> display login form here <!-- ENDIF -->
The IF, ELSE structure would look like this:
<!-- IF loggedin != "1" -->
display login form here
<!-- ELSE -->
Welcome {loggedin_screenname}!
<!-- ENDIF -->
And the IF, ELSEIF, ELSE would look like this:
<!-- IF loggedin != "1" -->
display login form here
<!-- ELSEIF loggedin_newmessages > "1" -->
Welcome {loggedin_screenname}!
You have {loggedin_newmessages} new messages.
<!-- ELSE -->
Welcome {loggedin_screenname}!
You have no new messages.
<!-- ENDIF -->
Block tags
The block tags can be used in your template files to display information that is stored in an array. In other works to go through every single piece of an array and display it. The snipper below would display screen name, age and country of members stored in “profiles” array.
<!-- BEGIN profiles -->
{screenname} {age}
{country}
<!-- END profiles -->
If you were to write a plugin that was getting profiles from the database, you would put them into an array in the order as displayed below.
$profiles = array( array( 'screenname' => 'John Smith', 'age' => '20', 'country' => 'Canada' ), array( 'screenname' => 'John Doe', 'age' => '31', 'country' => 'USA' ), array( 'screenname' => 'Bill Globe', 'age' => '26', 'country' => 'China' ) );
Nested block tags
By default if you are accessing the variable within a block, it has to be assigned in the block arrray. Thus if it was not, you would encounter an error. For instance if you need to display a few members and access a global variable inside a block, you would use a “parent.” prefix to go up a level.
<!-- BEGIN profiles -->
{parent.loggedin}
<!-- END profiles -->
If you are inside a nested block, using “parent.” prefix would mean that you are trying to access the first block, thus you need to use a “top.” prefix to go straight to the top level.
<!-- BEGIN profiles -->
<!-- BEGIN items -->
{top.loggedin}
<!-- END items -->
<!-- END profiles -->
Template include tags
To include a template use this code.
<!-- INCLUDE header.tpl -->
Obviously instead of a header.tpl you can include any other template and thus create a layout that is only limited by your imagination.