Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty validate without assign($_POST)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
eadz
Smarty Regular


Joined: 30 Apr 2003
Posts: 61
Location: Auckland, New Zealand

PostPosted: Fri Mar 04, 2005 4:42 am    Post subject: Smarty validate without assign($_POST) Reply with quote

Hi,
SmartyValidate rocks!

One thing, is that you do $smarty->assign($_POST), which is kind of like global varibles... assigning all post varibles to a template.

This USUALLY won't cause a problem, but I can see an issue ( for example ) if you check for {if $submitted_ok} and then provide a download link, but if someone posts 'submitted_ok' in a post, then the form will go through.

I like to have controll of the varibles assigned to the template.

When you use smarty validate, you give it the names of the form fields, so is there a way for Smarty validate to use this infomation and only assign fields that need validating? E.g. SmartyValidate->assign() will assign only fields that are to be validated?
_________________
bBlog - Smarty based blogging software
I work for Webforce web site design ( Auckland, NZ )
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Fri Mar 04, 2005 5:05 am    Post subject: Reply with quote

encapsulate your post vars:

[php:1:972dcc3326]$smarty->assign('post',$_POST);[/php:1:972dcc3326]

Code:
{$post.foo}
Back to top
View user's profile Send private message Visit poster's website
eadz
Smarty Regular


Joined: 30 Apr 2003
Posts: 61
Location: Auckland, New Zealand

PostPosted: Fri Mar 04, 2005 5:06 am    Post subject: Reply with quote

mohrt wrote:
encapsulate your post vars:

[php:1:51b9f9820b]$smarty->assign('post',$_POST);[/php:1:51b9f9820b]

Code:
{$post.foo}


Will smarty validate still work if I do that?
_________________
bBlog - Smarty based blogging software
I work for Webforce web site design ( Auckland, NZ )
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Fri Mar 04, 2005 5:14 am    Post subject: Reply with quote

sure it will, just use $post.var instead of $var in the templates.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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