Solution: Patch: Adding view parameter support into custom user extention module view

Table of contents:

This is compatible with eZ Publish 3.

Compatibility

This article was written for eZ Publish 3. Prolly before eZ Publish 3.9. To our knowledge this feature has been added within (at least) eZ Publish 4.1

About

From: Jamie

Date: Tuesday March 22nd 2005, 5:23 pm

Filed under: General

Jamie: If for some odd reason you’d like to be able to use view parameters (userParameters) in user module’s register.php provided by eZ publish, here’s the 5 lines of code you need to add.

After the line:

$Params['TemplateObject'] =& $tpl;

add:

include_once( "lib/ezutils/classes/ezuri.php" );
 
$uri =& eZURI::instance( eZSys::requestURI() );
$GLOBALS['eZRequestedURI'] =& $uri;
 
$viewParameters = $uri->UserParameters();
 
$tpl->setVariable( 'view_parameters', $viewParameters );

Then, in your overridden register.tpl, you can access the userParameter like this:

$view_parameters.type

If your URL looks something like:

http://www.example.com/user/register/(type)/something

That is to say, the register.tpl should then work as described here.

The above may not be the most correct/elegant/efficient way to do it, but it works for me, and that’s all I need right now.

And thanks go to Katana on the #ezpublish IRC channel for prodding me in the right direction with the above.

Check out Katana’s formsess project for some clever Smarty-powered forms processing magic type stuff.