ezhttp
Summary
Returns GET, POST, session and cookie variables.Usage
ezhttp( name [, type [, check_existence ] ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
name | string | The HTTP variable that should be fetched. | Yes. |
type | string | Source of variable. Default is is HTTP POST. | No. |
check_existence | mixed | If the specified directive should be checked for existence. | No. |
Returns
Variable valueDescription
This operator makes it possible to inspect the contents of HTTP variables (POST, GET, session and cookie variables). The "type" parameter can be used to specify which type of variable that should be extracted. The following options are available:
- post (POST variable)
- get (GET variable)
- session (session variable)
- cookie (cookie variable)
The "check_existence" parameter can be set to TRUE or the string "hasVariable" in order to check if a directive is actually set. In this case, the operator will return either TRUE or FALSE. Note that using the "ezhttp_hasvariable" operator is a better option.
Examples
Example 1
{ezhttp( 'search' )}
Returns the "search" POST variable.
Example 2
{ezhttp( 'image', 'get' )}
Returns the "image" GET variable.
Example 3
{ezhttp( 'user_id', 'session' )}
Returns the "user_id" session variable.
Example 4
ezhttp( 'is_logged_in', 'cookie' )
Returns the 'is_logged_in' cookie variable.
Balazs Halasy (05/02/2004 10:33 am)
Geir Arne Waaler (26/08/2010 1:41 pm)
Comments
Warnings
Monday 14 November 2005 10:26:13 am
Bertrand Dunogier
Re: Warnings
Tuesday 28 March 2006 11:27:01 pm
James Robertson
Re: Re: Warnings
Friday 07 April 2006 5:33:09 pm
Patrick Kaiser
{if ezhttp( 'myvar', 'get' ) } => returns false, but throws error
the same with {if is_set( ezhttp( 'myvar', 'get' ) )}
its a bug in my opinion..
Re: Warnings
Thursday 27 July 2006 9:02:59 am
VaL
ezhttp_hasvariable( 'getVar','get' )
or
ezhttp( 'getVar','get','hasVariable' )
Re: Re: Warnings
Tuesday 29 December 2009 7:52:00 am
Vids
Thanks
Re: Re: Warnings
Wednesday 25 August 2010 1:08:50 am
muro
I'm troubling use ezhttp_hasvariable( 'getVar','get' )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{set $search_text = ezhttp( 'searchtext' ,'get' ,'hasVariable')}
<form>
<input id="searchtext" name="searchtext" type="text" value="{$search_text|wash}" size="35" />
</form>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set 'input tag value' as '1'
I hope , set 'input tag value' as '$searchtext'
if i use ezhttp( 'getVar','get' )
set 'input tag value' as '$searchtext'
Why not ?
Tuesday 13 December 2005 6:04:31 pm
Alimi Nabil
ezhttp is not working if caching is turned on.
Friday 14 July 2006 12:44:53 pm
vytis
{set-block scope=root variable=cache_ttl}0{/set-block}
to all templates, because in other way ezhttp will return the same value...
Re: ezhttp is not working if caching is turned on.
Thursday 18 October 2007 10:34:25 am
André R.
If you use view parameters ('my.domain.com/my/url/(parameter)/value') instead of GET parameters, then the cache system will store different cached pages depending on the parameters. So that would be:
* Better performance (cache is still on)
* Nicer looking URL
* Better indexable URL
Re: Re: ezhttp is not working if caching is turned on.
Friday 02 November 2007 9:36:19 am
Tobias V.
or null
Friday 18 August 2006 6:20:26 pm
Pike
Variable value or null
test for non-existence using
{if not(ezhttp('test'))}
or
{if ezhttp('test')|null()}