If you're customising your website templates you'll encounter Capitan PHP snippets in the HTML code. In this article we'll list all of the available snippets and explain what they do... Note that these PHP snippets can only be used in your root templates, they won't work within page content.
A PHP snippet must start with an opening tag:
And end with a closing tag:
The PHP instruction (known as a function) is written between these tags. In Capitan we've restricted the use of some functions, the only one youneed to know about is 'echo' which basically translates to 'insert something into the page right here':
<?php echo 'hello'; ?>
This prints the word 'hello' wherever you put the PHP snippet on the page.
The Capitan framework prepares a number of snippets of dynamic content whenever a page is loaded - some of these contain data specific to the page, others contain data which is specific to your installation profile. They're all saved as variables with relevant names which you can easily insert into your HTML template or content as required:
<?php echo $CAP_COMPANY_NAME; ?>
The variable name is $CAP_COMPANY_NAME
The Company Profile owning this installation has the 'Company Name' Capitan
Therefore this example would print 'Capitan' in the page.
Page Specific PHP Variables
Containing dynamic data specific to Standard Pages, Module categories and Module Items.
The title of the page coming from the page's 'SEO Title'
The description of the page coming from the page's 'SEO Description'
The keywords for the page coming from the page's 'SEO Phrases & Keywords'
Data for Meta Tag "robots", ie: 'index, follow'. Based on the page's 'Included in Sitemap' setting and public availability.
Additional Open Graph Meta Tags for the page. Automatically adjusted for certian types of Module Item.
The canonical URL for the item. Automatically generated based on the page's 'URL' and it's location in the website hierarchy.
The path to the CSS resource. Defaults to /css/template.css but can be overriden by the page's 'Custom CSS Template' setting in the 'Design' Tab.
The content from 'Required Files' in the 'Advanced' Tab on the page.
The fully rendered content of the 'Masthead' configured in the 'Design' Tab on the page.
- $CAP_ITEM_WZ1, $CAP_ITEM_WZ2, $CAP_ITEM_WZ3, $CAP_ITEM_WZ4
The fully rendered content of Widget Zone 1-4 as configured in the 'Design' Tab on the page.
The fully rendered content of Main Content as configured in the main 'Content Editor' on the page.
Owner Specific PHP Variables
Containing dynamic data specific to the Website Owner Company Profile.
The Company Name defined in the 'Website Owner' Company Profile
- $CAP_COMPANY_ADDRESS1, $CAP_COMPANY_ADDRESS2, $CAP_COMPANY_CITY, $CAP_COMPANY_REGION, $CAP_COMPANY_COUNTRY, $CAP_COMPANY_POSTCODE
Elements of the Primary Address defined in the 'Website Owner' Company Profile
The Website Address defined in the 'Website Owner' Company Profile
The Telephone defined in the 'Website Owner' Company Profile
The Tax Number defined in the 'Website Owner' Company Profile
The Company Number defined in the 'Website Owner' Company Profile
- $CAP_COMPANY_META / $CAP_COMPANY_FACEBOOK, $CAP_COMPANY_X / $CAP_COMPANY_TWITTER, $CAP_COMPANY_INSTAGRAM, $CAP_COMPANY_LINKEDIN
The Profile ID for the relevant Social Media channel defined in the 'Extended Profile' Tab of the 'Website Owner' Company Profile
General Utility PHP Variables
The CSS Smart Wrapper for the rendered page. Do not remove.
Containing some modal blocks and pre-loaders which are required for the correct running of your web pages. Do not remove.
Outputs a breadcrumb trail explaining the location of the rendered page in the navigation hierarchy - each crumb acts as a link.
Outputs a hidden list of your Access Key content (if you've used this accessibility feature) and enabling the functioning of these access keys.
Outputs a hidden SEO summary of the rendered content.
Outputs the status of the visitors consent to cookies, the value is either 'granted' or 'denied'.
Dynamic Navigation PHP Function
Outputs a dynamically generated navigation menu including the relevant styling of the currently active page or section:
The function name is $FE_CORE->navTree()
The function requires four variables to be defined, in the specified order:
<?php echo $FE_CORE->navtree(PARENT, SUBNAV LEVELS, EXTRA DATA, EFFECTS); ?>
Used to define the absolute top level to be output in the navigation. Valid values are:
String 'nav' - the top level main pages
String 'float' - the top level floating pages
Integer 'Capitan CID' - the CID of the Capitan page to be used as the top level
- SUBNAV LEVELS
Used to define how many sub-levels of navigation should be output, if any of the items have 'children'. Valiud value is an Integer.
- EXTRA DATA
Used to define additional data being rendered in the navigation. It's possible to include an image, preview text and a button for every item in the menu. Valid value is a String of 3 Booleans which are separated by pipe bars, ie: 'true|false|false'. The first boolean is for ICON which allows you to include the item's 'Cover Image' in the output. The second boolean is for PREVIEW which allows you to include the item's 'SEO Description' in the output. The final boolean is BUTTON which allows you to include a styled button as the navigation link in the output. Using this setting along with some custom CSS definitions can help you build a mega-menus.
Used to define some visual and behavioural effects in the rendered navigation. control some built in effectspopup link and sub-nav transition options. Valid value is a String of 2 settings which are separated by pipe bars, ie: 'setting1|setting2'. The first setting is POPUP and expects a boolean for pop-up link activation. The second is CLASSES and expects a string of CSS class names which will be added to the rendered navigation, commonly used to activate navigation transition effects.
A full example would be:
<?php echo $FE_CORE->navTree('nav',2,'','false|animated fadeIn'); ?>
The rendered navigation parent is 'nav' which is your top page navigation level, it permits 2 levels of sub navigation if any of the pages have children, it has no extra data so only the page titles will be output, and is defines effects false|animated fadeIn which means pop-up links are disabled and 'animated fadeIn' classes are added to the rendered navigation