ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

ezhttp

Summary

Returns GET, POST and session variables.

Usage

ezhttp( name [, type ] )

Parameters

NameTypeDescriptionRequired
name string The HTTP variable that should be fetched. Yes.
type string Source of variable. Default is is HTTP POST. No.

Returns

Variable value

Description

This operator makes it possible to inspect the contents of HTTP variables (POST, GET or session 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)

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.

Balazs Halasy (05/02/2004 10:33 am)

Balazs Halasy (04/05/2005 1:44 pm)


Comments

  • Warnings

    It's a little too bad there's no way to avoid a warning when the variable we're fetching is not set ...
    • Re: Warnings

      You only recieve a warning? I get see an error. Most annoying!
      • Re: Re: Warnings

        using 3.7.4 and getting an error as well. even testing for the existence fo a get/post var throws an error:
        {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: Re: Re: Warnings

          Has someone filled a bug report ? could you report the #id ?
  • Why not ?

    It would be nice if the ezhttp operator could return all vars in the array specified. ezhttp(GET) would return all $_GET vars for example.
  • Existence of a http variable

    Your variable will be set to null if the requested http variable doesn't exist. If you take this into account in your template code, then you can just ignore the errors thrown.
    • Re: Existence of a http variable

      Solve the problem by a user defined template operator like (extension...autoloads)

      function getGETp()
      {
      if(isset($_GET["p"]))
      {
      return $_GET["p"];
      }

      return 0;
      }