ez.no / ezpublish / documentation / customization / tips & tricks / redirecting after content publishing
These documentation pages are no longer maintained. Please visit the new documentation site.
Note: This only works for eZ publish 3.2 or revision 2865.
By default the content edit page will redirect to the main placement after the object has been publish, however in many cases this is not the optimal place to go.
To change this behaviour you must edit the content/edit.tpl template file for your design and add a new hidden HTML input type with the name RedirectURI. The value must be the full path or url were you want the redirect to go, usually it's a good idea to use the ezurl operator for this.
For instance to always redirect to the content root you can do.
<input type="hidden" name="RedirectURI" value={"content/view/full/2"|ezurl} />
Comments
Example with ezurl doesn't work in EZP 3.3-4
Joel Hardi
Friday 07 May 2004 9:31:51 pm
<input type="hidden" name="RedirectURI" value={"/members"|ezurl} />
It shows up in the HTML source of the form as:
<input type="hidden" name="RedirectURI" value="/sitename/index.php/sitename/members" />
And then actually redirects to:
/sitename/index.php/sitename/sitename/index.php/sitename/members
Which is an invalid URI (one too many "/sitename/index.php/sitename") and produces the error:
Module not found
The requested module sitename could not be found.
Of course if I just do value="/members" then it works fine.
Cancel
Vincent Saulnier
Friday 29 August 2003 8:38:11 pm
If you want this functionality in earlier builds
Esben Maaløe
Tuesday 12 August 2003 12:49:09 am
Line 264
replace:
if ( !$hasRedirected )
{
if ( $node !== null )
{
$parentNode = $node->attribute( 'parent_node_id' );
if ( $parentNode == 1 )
$parentNode = 2;
$module->redirectToView( 'view', array( 'full', $parentNode ) );
}
else
{
$module->redirectToView( 'view', array( 'full', $version->attribute( 'main_parent_node_id' ) ) );
}
}
with
if ( !$hasRedirected )
{
if ( $http->hasPostVariable( 'RedirectURI' ) )
{
$http->redirect( $http->postVariable( 'RedirectURI' ) );
}
else if ( $node !== null )
{
$parentNode = $node->attribute( 'parent_node_id' );
if ( $parentNode == 1 )
$parentNode = 2;
$module->redirectToView( 'view', array( 'full', $parentNode ) );
}
else
{
$module->redirectToView( 'view', array( 'full', $version->attribute( 'main_parent_node_id' ) ) );
}
}