Skillnad mellan versioner av "Templating:Variables"

Från Vendre Help
Hoppa till: navigering, sök
(Boxes)
(Globals)
Rad 6: Rad 6:
 
{| class="wikitable"
 
{| class="wikitable"
 
!Variable name
 
!Variable name
 +
!Type
 
!Description
 
!Description
 +
!Format
 
|-
 
|-
 
|current_page
 
|current_page
 +
|string
 
|Contains URL after domain name and before ''?'', for example ''storedomain.com/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html?vat_disp=0'' returns ''/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html''
 
|Contains URL after domain name and before ''?'', for example ''storedomain.com/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html?vat_disp=0'' returns ''/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html''
 +
|N/A
 
|-
 
|-
 
|current_script
 
|current_script
 +
|string
 
|Contains filename of current page
 
|Contains filename of current page
 +
|index.php
 
|-
 
|-
 
|request
 
|request
|A dictionary of recieved get and post data. ''{ 'get' : get_data, 'post' : post_data}''
+
|dictionary
 +
|A dictionary of recieved ''GET'' and ''POST'' data
 +
|
 +
{| class="wikitable"
 +
!Key
 +
!Description
 +
|-
 +
|get
 +
|Dictionary of data received from the ''GET'' query string
 +
|-
 +
|post
 +
|Dictionary of received ''POST'' data
 +
|}
 
|-
 
|-
 
|current_customer_id
 
|current_customer_id
 +
|integer
 
|Returns customer ID if customer is logged in, else None
 
|Returns customer ID if customer is logged in, else None
 +
|N/A
 
|-
 
|-
 
|settings
 
|settings
|A dictionary of some of the settings defined in the administration
+
|dictionary
 +
|Contains some of the settings defined in the administration
 +
|
 +
{| class="wikitable"
 +
!Key
 +
!Description
 +
|-
 +
|SMALL_IMAGE_WIDTH
 +
|Integer width of small thumbnails in pixels
 +
|-
 +
|SMALL_IMAGE_HEIGHT
 +
|Integer height of small thumbnails in pixels
 +
|-
 +
|STATISTICS_GOOGLE_ANALYTICS
 +
|Google analytics tracking code, if specified
 +
|-
 +
|PRODUCT_PAGE_DESIGN
 +
|''Internal''
 +
|}
 
|}
 
|}
 +
 
==Boxes==
 
==Boxes==
 
Boxes are variables used for the side boxes. They are all prefixed with ''boxes''.
 
Boxes are variables used for the side boxes. They are all prefixed with ''boxes''.

Versionen från 6 april 2011 kl. 15.51

Variables

Templates get variables containing all necessary data passed from the back end. This is a complete reference of all available variables.

Globals

Globals are accessible anywhere in the templates, including macros.

Variable name Type Description Format
current_page string Contains URL after domain name and before ?, for example storedomain.com/p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html?vat_disp=0 returns /p/digital-fotoram/nextbase-photomil-8wi-fi-fotoram.html N/A
current_script string Contains filename of current page index.php
request dictionary A dictionary of recieved GET and POST data
Key Description
get Dictionary of data received from the GET query string
post Dictionary of received POST data
current_customer_id integer Returns customer ID if customer is logged in, else None N/A
settings dictionary Contains some of the settings defined in the administration
Key Description
SMALL_IMAGE_WIDTH Integer width of small thumbnails in pixels
SMALL_IMAGE_HEIGHT Integer height of small thumbnails in pixels
STATISTICS_GOOGLE_ANALYTICS Google analytics tracking code, if specified
PRODUCT_PAGE_DESIGN Internal

Boxes

Boxes are variables used for the side boxes. They are all prefixed with boxes.

Category menu

Variable name Description
boxes.categories.tree Contains a tree of displayed categories in menu.
[
	{
		'name'        : name_of_category,
		'href'        : link_to_category,
		'child_count' : number_of_direct_children,
		'children'    : [ child, ... ],
		'selected'    : is_current_category // Boolean
	},
	...
]

Manufacturer select

Variable name Description
boxes.manufacturers.list Lists all available manufacturers
[
	{
		'name' : name_of_manufacturer,
		'href' : link_to_manufacturer,
	},
	...
]

Search box

Variable name Description
boxes.search.advanced_href URL to advanced search page
boxes.search.advanced_result_href Action URL for search form

Information page list

Variable name Description
boxes.information_pages.list Lists all active information pages
[
	{
		'name'   : name_of_page,
		'href'   : url_to_page,
		'active' : true_if_on_this_page,
		'target' : true_if_expecting_target_blank
	},
	...
]

VAT select box

Variable name Description
boxes.vat_select.display_with_vat True if prices are displayed including VAT, else false.
boxes.vat_select.with_href URL to page where VAT display is set to true.
boxes.vat_select.without_href URL to page where VAT display is set to false.

Page specific

Most variables are not available on a global scale. They are page specific variables. They are always prefixed with the same name as the included template. So contact.html variables are prefixed with contact.

Contact us page (contact.html)

Variable name Description
contact.form_href URL with target of form for handling user input data
contact.captcha Boolean value, whether Captcha should be used or not
contact.name Contains customer name if customer is logged in or validation if validation of a field failed
contact.email Contains customer e-mail if customer is logged in or validation if validation of a field failed
contact.heading Contains heading text
contact.text Contains a descriptive text of what the contact us page is. It most certainly contains HTML so the raw filter may be appropriate to use.