Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

smartyValidate and template caching (trouble making it work)

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
mjohnston
Smarty Rookie


Joined: 08 Jul 2004
Posts: 10
Location: Düsseldorf

PostPosted: Fri Jul 09, 2004 1:40 pm    Post subject: smartyValidate and template caching (trouble making it work) Reply with quote

We have tried to do this by using a different cacheid & compileid for the smarty->display when the form is empty and the smarty->display when the form is invalid, and also by turning caching off before displaying when the form is invalid.

It works first time through, but on subseqent loads of the empty form, when submitting is_valid always returns true.

Smarty 2.6 + has a way of declaring plugins non-cacheable when you register them, but how do you do this with an installed plugin, like validate?

Has anyone figured out how to cache as much of the form page as possible while using SmartyValidate?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Jul 09, 2004 1:56 pm    Post subject: Reply with quote

The validate tag must execute when the form first draws and when it gets redrawn. I've never tried registering it as a non-cacheble function. I don't even bother with caching forms since they are typically low-traffic and unique so benefits of caching are nill.
Back to top
View user's profile Send private message Visit poster's website
mjohnston
Smarty Rookie


Joined: 08 Jul 2004
Posts: 10
Location: Düsseldorf

PostPosted: Fri Jul 09, 2004 2:31 pm    Post subject: Reply with quote

we do a lot of contest sites where the form is the highest traffic part of the site. If it has pulldown menus, etc, that come from metadata or are calculated in some way it could get expensive.

But for now we will just go with marking the form as a non-cacheable block and figure it out when we need to.
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jul 09, 2004 2:43 pm    Post subject: Reply with quote

Maybe use two pages then. The initial page is cached is just the blank form. It submits to a second page that is essentially the same, but uncached to support validation.
Back to top
View user's profile Send private message
mjohnston
Smarty Rookie


Joined: 08 Jul 2004
Posts: 10
Location: Düsseldorf

PostPosted: Mon Jul 12, 2004 9:30 am    Post subject: Reply with quote

that's a pretty good idea. After playing around with SmartyValidate for a while, having three (or more) pages per form page is starting to look like a good idea anyway, as it makes it easier to manage the flow.

Now we are deciding whether to try to abstract the flow management or not, because there is a fair amount of copy-paste coding in the forking of different actions in a form. But this strikes me as the kind of abstraction that ends up being more annoying than useful in the long run, so probably we won't do it for now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP