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

SmartyValidate/SmartyPaginate and sessions

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
glum
Smarty n00b


Joined: 02 May 2011
Posts: 4

PostPosted: Mon May 02, 2011 8:43 pm    Post subject: SmartyValidate/SmartyPaginate and sessions Reply with quote

Hello,

I have multiple applications on the same server that uses smartyvalidate and smartypaginate. I think when someone uses two or more of these applications in the same browser session, some overwriting of the smartyvalidate and smartypaginate session variables may be occurring. Does anyone know of a way to fix this situation besides putting each app on its own server?

Regards.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon May 02, 2011 9:45 pm    Post subject: Reply with quote

With SmartyValidate you can use a unique form id for each form, and you can make that coincide with the application. With SmartyPaginate you can use a unique connection id, again use the application to coincide with the id. It's in the docs for both of them.
Back to top
View user's profile Send private message Visit poster's website
glum
Smarty n00b


Joined: 02 May 2011
Posts: 4

PostPosted: Tue May 03, 2011 12:43 am    Post subject: Reply with quote

Thanks Mohrt! I appreciate the help.

I'll give it a try.
Back to top
View user's profile Send private message
glum
Smarty n00b


Joined: 02 May 2011
Posts: 4

PostPosted: Wed May 04, 2011 3:56 am    Post subject: Reply with quote

I notice in 3.02, the docs say this:

"SmartyValidate::disconnect();
SmartyValidate::disconnect(true);

This clears the SmartyValidate session data for the current form. Call
this after you are completely finished with the SmartyValidate form.
(eg. do NOT call between posts to the same form.) A parameter of true
will force all forms to reset."

I am running 2.x, so I can't test the above right now. I apologize for this. Does this mean that 3.02's "SmartyValidate::disconnect() will not wipe out the variables for other registered forms in a session that have unique IDs (say the other forms are open in tabs) like it seems to do in 2.x? If yes, is the workaround in 2.x not to call SmartyValidate::disconnect() at all? Usually, I call disconnect after a successful submit/validation...maybe I shouldn't if the above case is possible? If yes, are there any problems I should be aware of if I don't call disconnect in 2.x at all?

Best Regards.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed May 04, 2011 3:59 am    Post subject: Reply with quote

disconnect() should remove the current form, not the entire session. It isn't necessary to disconnect for things to work, it is meant to clear data from the session you know you will not be using again.
Back to top
View user's profile Send private message Visit poster's website
glum
Smarty n00b


Joined: 02 May 2011
Posts: 4

PostPosted: Thu May 05, 2011 2:34 am    Post subject: Reply with quote

Thanks again, mohrt!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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