[pLog-svn] Roadmap/performance

Mark Wu markplace at gmail.com
Tue Jan 17 20:39:21 GMT 2006


Forgot {dynamic} tag, I will remove it from 1.1 I think..

I don't think we can solve {dynamic} problem easily, it is smarty's
limitation.

For example , you have two template file, a.template and b.template

a.template
=======
{assign var=xxx value=yyy}

b.template
=======
{include file="a.template"}
{dynamic}{$xxx}{/dynamic}

You know, what's the problem?

In the fisrt time you run this template, there will no error message, and
the template will show yyy ...

But, in second time you run this template, it will shows you the $xxx is
undefined, because a.template is cached ... 

The situation will happened in everywhere... :(

How to solve this?

According to smarty's forum (I discuss with them for 2 months ago, I think)
, there is no way to solve this, unless you make  make a  "smarty plugin"
and set the $xxx = yyy in this plugin  ...

It is too complicated for every situation.

That's' why I propose using "another way"

Maybe
1. Disable your cache (the easiest way)
2. PHP Cookie(then we use javascript to read cookie and add the content to
html page)
3. Ajax (through xmlhttprequest)
4. Ajax without xmlhttprequest
(http://www.phpit.net/article/ajax-php-without-xmlhttprequest/)

And, AJAX is not MAGIC, it is an old technology but with new application.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Christoph Feddersen
> Sent: Wednesday, January 18, 2006 4:23 AM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] Roadmap/performance
> 
> 
> 
> Jon Daley wrote:
> >     The problem with both number 1 and 2 is the html is cached (and 
> > you really want it to be - pages are much faster if caching is on).
> >     So, if the first person to view your page is an admin, the 
> > administrative link will be cached for the second person.
> >     I think the key is to either use an ajax method, (Mark has been 
> > looking into that some) or to get the {dynamic} tag to work with 
> > plugins, but I spent a couple hours a couple weeks ago, and 
> could not 
> > trick smarty into letting me have a plugin object within a 
> {dynamic} 
> > block.  It works fine if you allow {php} blocks in your templates, 
> > that isn't cached, or at least, you have have the {php} blocks 
> > enclosed in a {dynamic} block.
> 
> I don't think that it's a good idea to rely on ajax magic for 
> this. If you can provide me a short example of the what you 
> tried to do with {dynamic} in the plugins, I'll have a look at it.
> It should be possible to load non cacheable data into smarty 
> templates. 
> Maybe a custom plugin for smarty can do this.
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list