Articles in this section

Template Global Variables & Components

Instantcart uses a series of variables that call data into your template files. The following tables contain variables Instantcart supports for each template. Some variables are global and can be used accross your site in any template file, and some are private and can only be used for a specific template.

setting (array)

The setting array contains references to data set in the Intstantcart control panel. This can be anything from color settings to the logo used on your website. Each reference can be accessed as listed from the table below.

Term

Data Type

Typical Output

Description

setting.color_tab

varchar

The title of your site

Outputs the title for your site

setting.color_h1

varchar

The title of your site

Outputs the title for your site

setting.color_p

varchar

The title of your site

Outputs the title for your site

setting.color_bg

varchar

The title of your site

Outputs the title for your site

setting.image_bg

varchar

The title of your site

Outputs the title for your site

setting.color_tab_on

varchar

The title of your site

Outputs the title for your site

setting.color_tab_off

varchar

The title of your site

Outputs the title for your site

setting.color_tab_title

varchar

The title of your site

Outputs the title for your site

setting.color_tab_title_off

varchar

The title of your site

Outputs the title for your site

setting.height_header

varchar

The title of your site

Outputs the title for your site

setting.color_button_buy

varchar

The title of your site

Outputs the title for your site

setting.color_button_more

varchar

The title of your site

Outputs the title for your site

setting.id_google_site

varchar

The title of your site

Outputs the title for your site

setting.image_logo

varchar

The title of your site

Outputs the title for your site

As an example, you would use the following syntax to display your store logo.

page_tabs (array)

Page tabs allow you to use the functionality of the page tabs section (under the control panel) within your website. The page_tabs reference is a recursive array containing the following references within each sub array of page_tabs.

Term

Data Type

Typical Output

Description

tabs_new_window

boolean

1/0

If true, can be used to launch link into a new window

tabs_name

varchar

My Page

Outputs the title for your site

tabs_url

varchar

/mypage.html

The link to the new page for the page tab, can be local or external

To access these varables using Twig, you would use the following syntax

banners (array)

Banners allows you to access banners added via the control panel. You can access left, top, and right banners using the same format as below. When using this array on a category page, banners will only show if a user has chosen to associate the banner with a particular category:-

Term

Data Type

Typical Output

Description

link

varchar

/mypage.html

The link to the new page for the banner can be local or external

title

varchar

My Advert

The Title for the banner (Can be used as overlay text)

alt

varchar

My Advert Alt

The alt tag for the banner

home

int

1

Denotes if this is set to show on the homepage

file

varchar

banner.jpg

The filename of the banner

To access these varables using Twig, you would use the following syntax

The recent_products, special_offers, recent_products & best_sellers references allow you to display products that have recently been viewed by a user. These references are recursive arrays containing the following references within each sub array contained within.

To display these products, we use a snippet that we have named latestProducts.snippet.html, however this snippet can be used to display any product reference, such as recent_products, special_offers & best_sellers or any reference that uses the supported terms listed in the above table.

To access these varables using Twig, you would use the following syntax. Please note, this example is based on an additional reference used in productdetail.template.html which is a local reference to this file.

messages (array)

Messages accesses the error message system, so you can print any pending messages to your template. The messages reference is a recursive array containing the following references within each sub array of messages.

To access these varables using Twig, you would use the following syntax.