Base display function to use Joomla! cache


/ Published in: PHP
Save to your folder(s)

This is a base function to use with Joomla! to display the view using the Joomla cache system.


Copy this code and paste it in your HTML
  1. /**
  2.  * Method to display a view.
  3.  *
  4.  * @param boolean If true, the view output will be cached
  5.  * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  6.  *
  7.  * @return JController This object to support chaining.
  8.  * @since 1.5
  9.  */
  10. public function display($cachable = false, $urlparams = false)
  11. {
  12. $cachable = true;
  13.  
  14. // Get the document object.
  15. $document = JFactory::getDocument();
  16.  
  17. $safeurlparams = array('catid'=>'INT', 'id'=>'INT', 'cid'=>'ARRAY', 'year'=>'INT', 'month'=>'INT', 'limit'=>'INT', 'limitstart'=>'INT', 'showall'=>'INT', 'return'=>'BASE64', 'filter'=>'STRING', 'filter_order'=>'CMD', 'filter_order_Dir'=>'CMD', 'filter-search'=>'STRING', 'print'=>'BOOLEAN', 'lang'=>'CMD');
  18.  
  19. parent::display($cachable, $safeurlparams);
  20.  
  21. return $this;
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.