Difference between revisions of "Template Syntax"

From WHMCS Documentation

(New page: The basic template syntax can be seen by looking at the templates. Template files simply use regular HTML along with tags for where the WHMCS data is inserted into them. All pages have sp...)
 
(Replaced content with "<div class="docs-alert-info"> <span class="title">Note</span><br /> This page has moved to [https://developers.whmcs.com/themes/variables/ https://developers.whmcs.com/the...")
 
(24 intermediate revisions by 11 users not shown)
Line 1: Line 1:
The basic template syntax can be seen by looking at the templates. Template files simply use regular HTML along with tags for where the WHMCS data is inserted into them.  All pages have specific variables which you can use.  To view a complete list of variables available on a given page, enter the following tag into the template file:
+
<div class="docs-alert-info">
 
+
<span class="title">Note</span><br />
{debug}
+
This page has moved to [https://developers.whmcs.com/themes/variables/ https://developers.whmcs.com/themes/variables/]
 
+
</div>
When you next access that template file after adding this code, a popup window will appear showing you all the different variables which you can use on the page.  Variables can be accessed using the {$variable} syntax.
 
 
 
==Common Template Variables Available on All Pages==
 
 
 
The following is a list of template variables available for use in all the template files of WHMCS
 
 
 
*{$companyname} - Company Name
 
*{$pagetitle} - Current Pages Title
 
*{$template} - Template Name
 
*{$charset} - Current Charset Setting
 
*{$todaysdate} - Formatted Date
 
*{$systemurl} - URL to WHMCS System
 
*{$loggedin} - True if logged in
 
 
 
*{$clientsdetails.id} - Currently Logged in Users Details
 
*{$clientsdetails.firstname}
 
*{$clientsdetails.lastname}
 
 
 
==Displaying Text to Logged In Users Only==
 
 
 
To display something on the page only if a user is logged in, use the following syntax:
 
 
 
{if $loggedin}
 
 
 
User is logged in so display client only information
 
 
 
{else}
 
 
 
User is not logged in so display this
 
 
 
{/if}
 
 
 
==More Information==
 
 
 
For furthur documentation on template customisations, see the official Smarty documentation @ http://smarty.php.net/docs.php
 

Latest revision as of 11:02, 4 January 2017