📚 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 / uri  

<< Object persistence   

URI management

To provide a unified access to the request URI the class eZURI can be used. It makes sure that single elements can be accessed and iterated over in an easy way. All work on elements is either relative (default) or absolute. Relative access allows one to see the URI as multiple operations, for instance the URI /print/object/1 sees that the print mode should be enabled, increases the index and passes the uri object to the underlying object system, no need for the object system to detect print mode by itself.

Accessing elements

The class allows us to concentrate on each element one at a time. We then increase the index to work on the next value. Base and tail elements are also available.

// Create the object
$uri =& eZURI::instance( "/test/of/uri" );

// Print the first element
print( $uri->element() ); // Prints "test"
// and the next
$uri->increase();
print( $uri->element() ); // Prints "of"

// Print base and elements
$uri->increase();
print( $uri->base() ); // Prints "/test/of"
print( $uri->elements() ); // Prints "uri"

The common way to use this class is to pass it the $REQUEST_URI.

// Remove uri parameters
ereg( "([^?]+)", $REQUEST_URI, $regs );
$REQUEST_URI = $regs[1];
// Create the object
$uri =& eZURI::instance( $REQUEST_URI );

Exponential Copyright © 1998 - 2026 7x