Skillnad mellan versioner av "Templating:Variables"
Från Vendre Help
(Skapade sidan med 'Category:Templating =Variables= Templates get ==Globals== Globals are accessible anywhere in the templates, including macros. {| class="wikitable" !Variable name!!Description...') |
|||
| Rad 1: | Rad 1: | ||
[[Category:Templating]] | [[Category:Templating]] | ||
=Variables= | =Variables= | ||
| − | Templates get | + | Templates get variables containing all necessary data passed from the back end. This is a complete reference of all available variables. |
==Globals== | ==Globals== | ||
Globals are accessible anywhere in the templates, including macros. | Globals are accessible anywhere in the templates, including macros. | ||
{| class="wikitable" | {| class="wikitable" | ||
| − | !Variable name | + | !Variable name |
| + | !Description | ||
|- | |- | ||
|current_page | |current_page | ||
| − | |Contains URL after domain name and before '''?''' | + | |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'' |
|- | |- | ||
|current_script | |current_script | ||
| Rad 14: | Rad 15: | ||
|- | |- | ||
|request | |request | ||
| − | |A dictionary of recieved get and post data. | + | |A dictionary of recieved get and post data. ''{ 'get' : get_data, 'post' : post_data}'' |
|- | |- | ||
|current_customer_id | |current_customer_id | ||
| Rad 23: | Rad 24: | ||
|} | |} | ||
==Boxes== | ==Boxes== | ||
| − | Boxes are variables used for the side boxes. They are all prefixed with | + | Boxes are variables used for the side boxes. They are all prefixed with ''boxes''. |
===Category box=== | ===Category box=== | ||
{| class="wikitable" | {| class="wikitable" | ||
| − | !Variable name | + | !Variable name |
| − | |-boxes.categories.tree|Contains a tree of displayed categories in menu. | + | !Description |
| + | |- | ||
| + | |boxes.categories.tree | ||
| + | |Contains a tree of displayed categories in menu. | ||
<pre> | <pre> | ||
[ | [ | ||
| Rad 36: | Rad 40: | ||
'children' : [ child, ... ], | 'children' : [ child, ... ], | ||
'selected' : is_current_category // Boolean | 'selected' : is_current_category // Boolean | ||
| + | }, | ||
| + | ... | ||
| + | ]</pre> | ||
| + | |} | ||
| + | ===Category box=== | ||
| + | {| class="wikitable" | ||
| + | !Variable name | ||
| + | !Description | ||
| + | |- | ||
| + | |boxes.manufacturers.list | ||
| + | |Lists all available manufacturers | ||
| + | <pre> | ||
| + | [ | ||
| + | { | ||
| + | 'name' : name_of_manufacturer, | ||
| + | 'href' : link_to_manufacturer, | ||
}, | }, | ||
... | ... | ||
| Rad 41: | Rad 61: | ||
|} | |} | ||
==Page specific== | ==Page specific== | ||
| − | ===Contact page (contact.html)=== | + | 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)=== | ||
| + | {| class="wikitable" | ||
| + | !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 [http://www.twig-project.org/doc/templates.html#raw raw] filter may be appropriate to use. | ||
| + | |} | ||
Versionen från 27 mars 2011 kl. 14.47
Innehåll
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 | Description |
|---|---|
| current_page | 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 |
| current_script | Contains filename of current page |
| request | A dictionary of recieved get and post data. { 'get' : get_data, 'post' : post_data} |
| current_customer_id | Returns customer ID if customer is logged in, else None |
| settings | A dictionary of some of the settings defined in the administration |
Boxes
Boxes are variables used for the side boxes. They are all prefixed with boxes.
Category box
| 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
},
...
]
|
Category box
| Variable name | Description |
|---|---|
| boxes.manufacturers.list | Lists all available manufacturers
[
{
'name' : name_of_manufacturer,
'href' : link_to_manufacturer,
},
...
]
|
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. |