While it may seem that the caching features outlined so far are very useful (and they are!), they will quickly fall short for a semi-complex website. Take for example, a portal-like website with sections like news, weblogs, and photos. You may want to cache the output of all specific news items, and re-generate them in 5 days. On this specific case, the existing caching functionality will not be enough, as the cache is associated with a template file, but this template file is re-used for all news items.
The feature that is available and overcomes this apparent lack of functionality is the ability to create multiple caches per template file. You do that by passing a second parameter to the display
method, which Smarty will use that to create a sub-directory under the cache directory to hold the cache files. Take the following PHP script as an example:
<?php
include_once(‘libs/smarty.class.php’);
$smarty = new Smarty;
$smarty->caching = 1;
// $_GET[‘id’] holds...