PDA

View Full Version : Caching template and template coding!


yabsoft
08-02-2006, 04:38 PM
Template cache:
Template cache can improve the speed of page loading.All cached files are stored in the directory "skin/skin_name/cache"if "skin/skin_name" is your template directory.

Template cache can be turned on/off at "Site>Configuration".

Issue on Template cache:
If you enabled the template cache option at "Site>Configuration" and when you make any changes via "Template>Template manager" or upload your modified template files by ftp,the changes may not reflect on the front end.Because the front end may still use the cached template files!

The solution is to delete all cached files in "skin/skin_name/cache"!
This can be done through the function "Clean the cache for template" of "Template>Template manager"
or deleting all cached files in "skin/skin_name/cache" by FTP!

Allow PHP code in template:
<!-- INCLUDEPHP phpscripts.php --> This will include phpscripts.php when compling the template.
For example:
<!-- INCLUDEPHP helloworld.html --> This will simply include helloworld.html in the template, At fact,in this example,it is same to
<!-- INCLUDE helloworld.html --> Because helloworld.html doesn't have any php code.

<!-- PHP --> This will allow include and execute a piece of php code to the template when compling the template.

Note:These syntax is valid only you enable Allow PHP in template option at "Site>Configuration"

Disable Template files view:
There is a file .htaccess in skin/skin_name
<FilesMatch "\.(html|php|ini)$">
order deny,allow
deny from all
</FilesMatch>
This will disable your template files viewable by others via URL http://yourdomain.com/skin/skin_name/ (http://yourdomain.com/skin/skin_name/)
If you want to view your template files via URL when making design,
you can simply remove the .htaccess or rename to another name.

Template Var:
{PAGETILE}
Page title,on index page,it is same to {SITENAME}, on other page,it is defined in lang_name/lang.php

{SITENAME}
Site name defined in Site>Configuration

{SKIN_DIR}
Skin directory for current template,for example, the skin directory fordefault is skin/default

{baseWeb}
Site Url,defined in "config.php"

{L_XXX}
the var which begins with "L_" means it is a language text defined in lang_name/lang.php,if it is not defined in lang_name/lang.php,it will show as { L_XXX } on html page.


<!-- IF show_sponser_ads -->
content here
<!-- ENDIF -->
show_sponser_ads is defined in host package at admin panel


<!-- IF show_site_ads -->
content here
<!-- ENDIF -->
show_site_ads is defined in host package at admin panel

<!-- IF not_logined -->
content here
<!-- ENDIF --> If user is logined,not_logined will be false,the "content here" will not show!


<!-- IF logined -->
content here
<!-- ENDIF --> If user is logined,logined will be true,the "content here" will show!