|
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 |
mjohnston Smarty Rookie
Joined: 08 Jul 2004 Posts: 10 Location: Düsseldorf
|
Posted: Fri Jul 09, 2004 1:40 pm Post subject: smartyValidate and template caching (trouble making it work) |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jul 09, 2004 1:56 pm Post subject: |
|
|
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 |
|
mjohnston Smarty Rookie
Joined: 08 Jul 2004 Posts: 10 Location: Düsseldorf
|
Posted: Fri Jul 09, 2004 2:31 pm Post subject: |
|
|
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 |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jul 09, 2004 2:43 pm Post subject: |
|
|
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 |
|
mjohnston Smarty Rookie
Joined: 08 Jul 2004 Posts: 10 Location: Düsseldorf
|
Posted: Mon Jul 12, 2004 9:30 am Post subject: |
|
|
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 |
|
|
|
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
|