Template modules

From PHPDevShell

Jump to: navigation, search

Template modules are small text snipets which are used when a portion of text or html is meant to be re-used often. For example, the "logo module" is:

   <a href="%1\$s" class="logo_link">
       <img src="%2\$s" class="logo" alt="%3\$s" title="%4\$s">
   </a>

They are all stored in a single array.

You can use a module this way:

   $html_for_logo = sprintf($this->module['logo'], 
       $this->configuration['absolute_url'], 
       $this->configuration['custom_logo'], 
       $this->configuration['scripts_name_version'], 
       $this->configuration['scripts_name_version']);

- when not using Smarty, just print the result:

   print $html_for_logo;

- when using Smarty, follow the Smarty syntax.