Re: [SMARTY] caching problem with multiple fetch
| From: | Abdul-Wahid Paterson | Date: | Mon, 28 Feb 2005 10:32:32 +0000 |
| Subject: | Re: [SMARTY] caching problem with multiple fetch | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12274@lists.php.net to get a copy of this message | ||
Messju,
That doesn't work. I now get this...
Call to undefined function: _get_plugin_filepath() in
/usr/lib/php/Smarty/internals/core.load_plugins.php on line 57
on all uncached pages.
Regards,
Abdul-Wahid
On Sun, 27 Feb 2005 02:21:39 +0300, messju mohr
<messju@lammfellpuschen.de> wrote:
> On Fri, Feb 25, 2005 at 03:12:30PM +0000, Abdul-Wahid Paterson wrote:
> > Hi,
> >
> > I have something in my code like this...
> >
> >
> > $smarty->caching = true;
> > if(! $smarty->is_cached('some.tpl') ) {
> > // Do some database things
> >
> > ......
> >
> > }
> >
> > $text1 = $smarty->fetch('some.tpl');
> >
> > // assign some different vars
> >
> > $text2 = $smarty->fetch('some.tpl');
> >
> >
> > Now, the variables i assign between the firsrt fetch and the second
> > are all dynamic content within the some.tpl that are put in side a
> > {dynamic}{/dynamic} block
> >
> > What happens....if at the top the page is cached...then both fetches work
> > where as.....if at the top the page is not cached...the first fetch
> > works but the second fails.
> >
> > I get an error something like,,,,
> >
> > Fatal error: Call to undefined function:
> > _smarty_tplfunc_4c569462d19b164ea6639c6f4437b1aa_0() in
> > /usr/lib/php/Smarty/Smarty.class.php on line 1821
> >
> > I presume this is something to do with the way pages are actually
> > cached. Can someone who knows more about the inner workings of smarty
> > shed any light on this?
> >
> > Does the fetch() itself write the cached page?
>
> yes it does.
>
> my proposed fix:
> Index: internals/core.write_compiled_include.php
> ===================================================================
> RCS file: /repository/smarty/libs/internals/core.write_compiled_include.php,v
> retrieving revision 1.4
> diff -u -r1.4 core.write_compiled_include.php
> --- internals/core.write_compiled_include.php 27 Jan 2005 08:51:21 -0000 1.4
> +++ internals/core.write_compiled_include.php 26 Feb 2005 21:21:36 -0000
> @@ -84,6 +84,7 @@
>
> require_once(SMARTY_CORE_DIR . 'core.write_file.php');
> smarty_core_write_file($_params, $smarty);
> + include($_compile_path);
> return true;
> }
>
> unfortunately i don't have an exhaustive testbed for complex caching
> right now, to see if this may have any negative side-effects. i cannot
> think of any, but my imagination may be a little limited here. :)
>
> maybe you can give the above a try?
>
> greetings
> messju
>
> > Thanks,
> >
> > Abdul-Wahid
>