Re: [SMARTY] Using $HTTP_POST_VARS for $smarty.post...
| From: | messju mohr | Date: | Tue, 11 Mar 2003 17:16:07 +0000 |
| Subject: | Re: [SMARTY] Using $HTTP_POST_VARS for $smarty.post... | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8562@lists.php.net to get a copy of this message | ||
On Tue, Mar 11, 2003 at 06:04:17PM +0100, Ronny 'Ronino' Multrus wrote:
> Hello,
>
> I needed to manipulate the data in $_POST (e.g. $_POST['var'] .= ".ext")
> and
> wondered why $smarty.post didn't recognize the changes still printing the old
> value. A short look at Smarty's code revealed that the $HTTP_*_VARS-arrays
> are used for Smarty's request variables. But these $HTTP_*_VARS are
> deprecated according to the php doc and shouldn't be used any longer.
>
> Simply changing them to $_*'s in Smarty.class.php didn't work,
> $GLOBALS['HTTP_POST_VARS'] is still used in the compiled template. Now I got
> a problem because I use $_POST etc. everywhere in my scripts.
>
> What do you guys think about that?
smarty uses HTTP_POST_VARS instead of _POST to be backwards compatible to
older php-versions. not all people upgrade early, upgrade often.
as a work-around until the rest of the world abandondend
HTTP_POST_VARS, you can try to make HTTP_POST_VARS a reference to
_POST:
$HTTP_POST_VARS =& $_POST;
after this, changes to $_POST will also be done in $HTTP_POST_VARS.
i don't know an elegant solution for _REQUEST, though.
have fun
messju
> Ronino