Web Text Magic Words
Web Text Magic Words are special "words" that can be used in NeuCart's Web Text configuration. When these words are inserted into any of the configurable fields, NeuCart will replace the characters with other characters.
|
Contents
Categories
There are two ways to display all the categories via Web Text. The examples below are based on an example category configuration like this:
- Category One - Subcategory 1 of One - Subcategory 2 of One - Category Two - Category Three
Flat categories
When the text ~neucart_categories_flat~ appears in a Web Text field, it will be replaced with an unordered list (HTML UL) of all the categories and subcategories. The categories are listed in the order in which they appear in the category selection box; each category is listed as a list item (HTML LI) with a link to the category page.
HTML Output | Displays As |
---|---|
<ul> <li>Category One</li> <li>Subcategory 1 of One</li> <li>Subcategory 2 of One</li> <li>Category Two</li> <li>Category Three</li> </ul> |
|
Hierarchical categories
When the text ~neucart_categories_hierarchy~ appears in a Web Text field, it will be replaced with an unordered list (HTML UL) of all the categories and subcategories. The categories are listed in the order in which they appear in the category selection box; each top-level category is listed as a list item (HTML LI) with a link to the category page. Subcategories of the top-level categories are displayed in another UL list under the top-level category, with a link to the subcategory page.
HTML Output | Displays As |
---|---|
<ul> <li>Category One</li> <ul> <li>Subcategory 1 of One</li> <li>Subcategory 2 of One</li> </ul> <li>Category Two</li> <li>Category Three</li> </ul> |
|
Current year
When the text ~neucart_year~ appears in a Web Text field, it will be replaced with the current year.
Custom code
When the text ~neucart_include:XXX~ appears, it will be replaced with the result of a function "get_result()" from the XXX class. With this syntax, stores can include any server-sie code into the Web Text fields. The text XXX represents a filename and a class name. For example, if the text is ~neucart_include:my_custom_class.php~, then the text that will display is the result of a "get_result()" function in the "my_custom_class" class that is defined in that file. Here's an example of that class:
<?php class my_custom_class { function get_result() { return '12345'; } } ?>
Note that the "XXX" value can include a path (custom/my_custom_class.php, for example). The class name must be the text between the last slash and the first dot in the file name. The class must contain a get_result() function that returns a string.