Path

ez.no / ezpublish / documentation / customization / tips & tricks / redirecting after content publishing


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

There seems to be a bug where "ezurl" gets run twice, corrupting the URI. For instance, if I do this:

<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

Don't you think that this functionality should work with the cancel button to?

If you want this functionality in earlier builds

In file kernel/content/edit.php

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' ) ) );
}
}

Contents

Customization

Access control
eZ publish API Documentation
Content structure
Custom design
Components
Tips & Tricks
    Debugging templates
    Javascript in templates
    Fetching current user
    Showing related objects
    Show which templates are used
    Fetching the ID of the parent
    One Article Folder
    Creating tree menus
    How can I use my own php script insid...
    Hiding attribute content
    Splitting an article over several pages
    Accessing section id in pagelayout
    List articles in folder
    Creating nice URLs
    Alt tag on images
    Improve the pagelayout.tpl
    Clean HTML tags
    Insert javascript call inside ezpub d...
    3rd party applications
    Fetch Function examples
    Display more than 15 items on your co...
    Including PHP files in templates
    Redirecting after content publishing
    HowTo see if article has an image
    Date and Time Formats
    Forms processing example: store user...
    Adjust Timezone
    Adding a Remove Button/Image
    Find the age in years for an object
    Editing, creating and removing conten...
    Indexing binary files with IFilters o...
Troubleshooting


Created

17/07/2003
10:31:10 am
by Jan Borsodi

Last updated

09/08/2003
11:55:14 am
by Björn Dieding@xrow.de

Authors

Jan Borsodi
Björn Dieding@xrow.de



This page is part of the eZ Publish documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.