List of general functions
Cache system
You can put all the page or part of the page in the cache. In the templates provided by default, all the pages are cached completely.
All the page in cache
Start the template with:
<?php if ($cache->processCache()): ?>
And end it with:
<?php $cache->endCache(); endif; ?>
Part of the page in cache
Start the section of page to be cached with:
<?php
if ($cache->processSegment('section1', 3600)):
?>
End the section of the page to be cached with:
<?php $cache->endCache(); endif; ?>
If you have multiple sections with different times, you must change section1 for each section and 3600 with the length in seconds of the cache.
Initialization of the templates
The initialization of a template is done by calling a special function.
pxTemplateInit
pxTemplateInit( $params )
Parameters
- $params - Parameters ('')
By default no parameter is given. The parameters are constructed as a long string. For example if you want to set the parameters param1 and param2 then you will call the function:
pxTemplateInit('param1|param2')
The order as no importance.
Some of the parameters can have a value. For example to set the number of resources to show per page, you will pass the parameter res_per_page:10
Simple parameters:
- order_res_manual : To order manually the resources by their title in the category pages.
- order_cat_manual : To order manually the categories by their name in the list of categories.
- remove_numbers : To remove the numbers at the start of the title of the resources and the categories. If you put for example 01., 10. or 17. at the start of the name of a category or a resource, this number will be used to order manually the resources/categories but will not be displayed.
Parameters with a value:
- res_per_page:XX : Number of resources per page. Change XX with the number of resources you want.
- set_lang:XX: Set the locale of the current template. Change XX with the two letter ISO code of the language you want. If a part of your website is in French and the rest in English, you can create templates for the categories, articles and news in French and pass the set_lang:fr argument. This usefull to have the the name of the days/months in the right language. See the PHP function setlocale. The LC_ALL argument is given to the setlocale function.
Note: It is important to call this function after each <?php if ($cache->process... function.
Share your ideas about this article.


