Wiki

Solution: Adding userParameters to the user module in ezPublish

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 userParameters in user module’s register.php provided by ezPublish, 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:

https:///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.