1. Home Page
  2. Documentation
  3. Templates

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

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:

Parameters with a value:

Note: It is important to call this function after each <?php if ($cache->process... function.

Share your ideas about this article.

Back to the top of the page