• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Cache a Smarty block function
PostPosted: Tue Jun 05, 2012 7:43 am 
Offline
New Member

Joined: Thu Feb 16, 2012 2:15 pm
Posts: 6
I use GeSHi as syntax highlighter. But GeSHi is very slow, so I want to cache my Smarty block function and not to call this function for every page visitor. How can I make Smarty to cache the result of my block function?

Code:
<?php
  require_once(dirname(__FILE__) .'/geshi/geshi.php');

  function smarty_block_code($params, $content, &$smarty)
  {
    if (isset($content) && isset($params['lang'])) {
      $geshi = new GeSHi($content, $params['lang']);
      $geshi->enable_classes(true);
      $geshi->enable_keyword_links(false);
      $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
      return $geshi->parse_code();
    }
  }
  ?>


Top
 Profile  
 
 Post subject: Re: Cache a Smarty block function
PostPosted: Sat Aug 11, 2012 2:22 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 6586
Location: Fernie British Columbia, Canada
In CMSMS 1.11, plugins named smarty_xxxx are cachable by default. However the site developer must enable smarty caching for the site, and enable caching on the appropriate page(s).

functions named smarty_cms_xxxx will not be cachable.

_________________
Follow me on twitter
--
if you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
----------------
Don't make me angry..... you won't like me when I'm angry....


Top
 Profile  
 
 Post subject: Re: Cache a Smarty block function
PostPosted: Sat Feb 02, 2013 7:06 pm 
Offline
New Member

Joined: Thu Feb 16, 2012 2:15 pm
Posts: 6
I tried to upgrade to CMSMS 1.11.4, but the caching doesn't work. I have enabled "Enable Smarty Caching" and have cleared the template cache. But CMSMS still doesn't cache my block function :(

The name of my function is "smarty_block_code". So it should be cached by default.


Top
 Profile  
 
 Post subject: Re: Cache a Smarty block function
PostPosted: Fri Feb 08, 2013 10:48 am 
Offline
New Member

Joined: Thu Feb 16, 2012 2:15 pm
Posts: 6
I have submitted the problem as bug: http://dev.cmsmadesimple.org/bug/view/8918


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting