|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
smarty_user Smarty n00b
Joined: 11 Sep 2003 Posts: 4
|
Posted: Thu Sep 11, 2003 7:25 pm Post subject: {dynamic} block function |
|
|
I used the sample code which describes how to create a block function to delimit parts of a page that change dynamically. After setting caching to true, the:
return $content;
is not honored, but rather a cached version of the page is rendered. To better envision this, imagine a list of members of an organization, sorted alphabetically and yanked out of a database. The header and footer material stays the same, but the {section}{/section} will always be dynamic (side question: why is this tag cacheable?}.
Any thoughts as to why the page is always rendered from cache even though it's enclosed in the {dynamic}{/dynamic} block?
Thanks |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Sep 12, 2003 7:35 am Post subject: Re: {dynamic} block function |
|
|
you use Smarty cvs (recommended) or Smarty 2.6.0-RC1? (this feature is not available in Smarty-2.5.0)
you registered the {dynamic}-function explicicitely with $cacheable=false?
smarty_user wrote: | (side question: why is this tag cacheable?}. |
that's controlled by the third parameter of register_block().
greetings
messju |
|
Back to top |
|
smarty_user Smarty n00b
Joined: 11 Sep 2003 Posts: 4
|
Posted: Sun Sep 14, 2003 9:43 pm Post subject: Re: {dynamic} block function |
|
|
messju wrote: | you use Smarty cvs (recommended) or Smarty 2.6.0-RC1? (this feature is not available in Smarty-2.5.0)
you registered the {dynamic}-function explicicitely with $cacheable=false?
|
Seems to work with 2.6.0 RC1
smarty_user wrote: | (side question: why is this tag cacheable?}. |
messju wrote: | that's controlled by the third parameter of register_block(). |
Wouldn't the expected behavior of a repeating section be to generate different information on different pages? That begs the question, why make {section} cacheable by default? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sun Sep 14, 2003 10:26 pm Post subject: Re: {dynamic} block function |
|
|
smarty_user wrote: | Wouldn't the expected behavior of a repeating section be to generate different information on different pages? That begs the question, why make {section} cacheable by default? |
Smarty caches based on parameters you decide in your application--whether or not something displayed on two different pages comes from the same cache or from different caches is under your control, not Smarty's. So while you may indeed want different information on different pages, it is up to you to tell Smarty to treat different template calls as "different" pages, and you do this by using multiple cache id's.
You have a use pattern that suggests a dynamic section, but I don't see that as implying {section} itself--or any other tag--should be non-caching by default. The current behaviour is the expected behaviour.
I have to admit, though, keeping clear the differences between compilations, caches, templates and pages is not always easy .
Cheers. |
|
Back to top |
|
|
|
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 vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|