📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  ezutils / http_variables  

<< Module handling  Fetching files >> 

Fetching variables

Fetching post, get and session variables are normally done by accessing the global HTTP_POST_VARS, _GET and HTTP_SESSION_VARS variables.

Fetching get/post variables

The first thing you do when you want to fetch variables is fetch a unique instance. Then we check if the variable exists and fetch it.

$http =& eZHTTPTool::instance();
// Fetching a post variable
if ( $http->hasPostVariable( "variableA" ) )
    $variableA =& $http->postVariable( "variableA" );
// Fetching a get or post variable
if ( $http->hasVariable( "variableB" ) )
    $variableB =& $http->variable( "variableB" );

Fetching session variables

Session variables can be both fetched and set and uses a syntax similar to post/get variables.

// Is the variable set?
if ( $http->hasSessionVariable( "variableC" ) )
    $variableC =& $http->sessionVariable( "variableC" );
else // If not we set it
    $http->setSessionVariable( "variableC", "data" );

Exponential Copyright © 1998 - 2026 7x