< back to Template Programming

Global Variables and Global Fields

Reference for global variables and global fields

Last updated on 9/6/2013

Global variables and global fields are template codes that can be used inside any template component.

Field Name (Template)TypeCommentsOptions
edit-this text hyperlink shortcut to the admin page where the component data can be edited. Example: Article, Event, Product, etc.   
plugin text Contains the name of the current component module. Example: Article, Product, Event, Directory, etc.  
plugin-type text Contains the name of the current component type. Example: Viewer, CategoryPostBrowser, et.  
is-admin int 0/1 indicates whether the admin is logged in to the CMS.  
browser-type text Interpreted browser type. Example: android,opera,seamonkey, netscape,firefox,chrome,safari,khtml,msie,unknown  
browser-version float Interpreted browser version. Example: 4.0   

Global variables are surroundded by two @@ signs.

Example Uses

The following section shows common sample code.

edit-this within an ArticleViewer component

 <h1>@title@</h1>
 @body@
 @@edit-this@@

plugin and plugin-type within a SideBar component

 <if>
   <test>@@plugin@@==Article</test>
   <test>@@plugin-type@@==CategoryPostBrowser</test>
     <h2>@title@</h2>
	 <p>@excerpt@</p>
	 <a href="@post-link@">Read more</a>
   </test>
 </if>

  <if>
   <test>@@plugin@@==Script</test>
   <test>@@plugin-type@@==Viewer</test>
     @code@
   </test>
 </if>

 <if>
   <test>@@plugin@@==Advertising</test>
   <test>@@plugin-type@@==Viewer</test>
     @code@
   </test>
 </if>

 

is-admin within an ArticleViewer component

 <if>
   <test>@@is-admin@@==1</test>
	 <p>ADMIN IS LOGGED IN TO CMS. <a href="help.lvsys.com" target="_blank">Access Online Help</a></p>
   <else></else>
	 <p>NORMAL WEBSITE VISITOR</p>
 </if>
 <h1>@title@</h1>
 @body@

 

browser-type and browser-version within an ArticleViewer component

 <if>
   <test>@@browser-type@@==msie</test>
   <test>@@browser-version@@<8</test>
   <p>This website is best viewed in Internet Explorer 8 or above.</p>
 </if>
 <h1>@title@</h1>
 @body@