Developer Documentation
Getting started
Overview
Semantic elements
Deployment
Caching
Rendering a page is an intensive process that involves fetching data from the database, and rendering every element recursively through its template.
Thankfully, alahup! fully supports .
This is how caching is implemented by default. It takes place in alahup/_main.php:
make sure to leave it off if the session is passed in the url (probably
because the visitor doesn't accept cookies) : otherwise the cache would be saved
with links containing "sid=..." */
if ( AH_STATUS == 'published' && !array_key_exists('sid', $_GET) )
{
$alahup->smarty->caching = true; // activates the cache
$alahup->smarty->cache_lifetime = -1; // -1 means the cache never expires
}
/* AH_HREF is a constant which contains the href of the page
("en/products/alahup" for example). Smarty will thus cache a special version
of the template 'main.tpl' for each rendered page.
The 'alahup|' prefix makes the cache part of the 'alahup' group, which is
automatically cleared when a new version is published */
$alahup->smarty->display('main.tpl', 'alahup|'.AH_HREF);
What about dynamic content ?
Of course, if some of your templates embed dynamic content such as a date and time display, you don't want to cache them.
-
In your templates, surround the parts that you don't want to be static with {dynamic} ... {/dynamic} and the generated cache will "know" that this portion of the template is dynamic and should be executed!
example :Page cached : {"0"|date_format:"%D %H:%M:%S"}.
Now is : {dynamic}{"0"|date_format:"%D %H:%M:%S"}{/dynamic} -
If you developed your own Smarty plug-in, keep in mind that you can .
-
As for modules developed with alahup! API, they are not cached, so you don't have to worry about them!