Documentation / Documentation for PHP developers / Methods 

Configure

In RainTPL is possible to configure few settings as

  • tpl_dir, is the template directory
  • cache_dir, where it save compiled templates and cache
  • base_url, the absolute base url of your application (eg. http://www.raintpl.com)
  • tpl_ext, the extension of your templates
  • path_replace, enable/disable the path replace
  • path_replace_list, configure what to replace
  • black_list, configure what command are not allowed
  • check_template_update, enable/disable the control if template was modified by the last compiling
  • php_enabled, enable/disable the use of php tags in your template




tpl_dir
Is the directory where all templates are stored

//configure
raintpl::configure( 'tpl_dir', 'templates/' );




cache_dir
Is the directory where RainTPL compile the templates

//configure
raintpl::configure( 'cache_dir', 'cache/' );




base_url
Is the base url of your application. If you configure it the parser will add this url to the path of the elements configured in path_replace_list

//configure
raintpl::configure( 'base_url', 'http://www.raintpl.com/' );




tpl_ext
Is the templates extension, by default html.

//configure
raintpl::configure( 'tpl_ext', 'html' );




path_replace
RainTPL when compile a template, replaces all relative paths with the correct server path. By default the path replace is enabled.

//disable the path replace is not advised
raintpl::configure( 'path_replace', false );

 


path_replace_list
Is possible to configure what elements to parse. You can set only the following elements, <a>, <img>, <link> and <script>. By default they are all enabled.

//configure to replace all elements but not the <a> element
raintpl::configure( 'path_replace_list', array( 'img', 'link', 'script' ) );

 


black_list
It define what functions and variables cannot be used into the template.

//configure
raintpl::configure( 'black_list', array('_SESSION') );

 


check_template_update
Set it false only if your cache directory has not write permission, else is strongly advised to re-compile the template for each change.

//configure
raintpl::configure( 'check_template_update', false );

 


php_enabled
Set true if you want to enable the use of PHP codes in your templates. We strongly recommend to keep this configuration disabled.

//configure
raintpl::configure( 'php_enabled', true );

 

« Cache ^ Methods ^

Documentation for web designers




Documentation for PHP developers