Template RedirectURI after Collected Information?

Author Message

Paul Wilson

Sunday 28 October 2007 8:02:35 pm

I'm trying to set a redirect for an information collection form.

Collect.ini defines ways to do this in a static manner (ie to the node, a static URL redirect, or result), but I need to set the Redirect target in the template ... in effect, an equivalent for this:

	<input type="hidden" name="RedirectURIAfterPublish" value={ezhttp('LastAccessesURI','session')} />

... except I need a "RedirectURIAfterCollectedInformation"

Anyone got any ideas on this?

Thanks

Łukasz Serwatka

Monday 29 October 2007 1:27:20 am

Hi,

In templates in content/collectedinfomail/*.tpl you can use:

{* redirect to another node *}
{set-block scope=root variable=redirect_to_node_id}2{/set-block}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Heath

Monday 29 October 2007 1:39:35 am

Neat tip, Thank you Łukasz!

It is interesting this topic as there seems to be great features provided by the information collection module / class not so well known. Take a look at the other forms of redirection features provided in the related kernel module code.

From file:<i>kernel/content/collectinformation.php (line, 335)</i>

        if ( is_numeric( $redirectToNodeID ) )
        {
            $Module->redirectToView( 'view', array( 'full', $redirectToNodeID ) );
        }
        else
        {
            $display = eZInformationCollection::displayHandling( $object );
            if ( $display == 'node' )
            {
                $Module->redirectToView( 'view', array( $ViewMode, $NodeID ) );
            }
            else if ( $display == 'redirect' )
            {
                $redirectURL = eZInformationCollection::redirectURL( $object );
                $Module->redirectTo( $redirectURL );
            }
            else
            {
                $Module->redirectToView( 'collectedinfo', array( $NodeID ) );
            }
        }

There are more details in code explaining the use of the ini settings within the methods displayHandling and redirectURL within the class file, kernel/classes/ezinformationcollection.php.

Making use of these features might be useful to document in greater detail.

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Paul Wilson

Monday 29 October 2007 2:25:43 am

Thanks Łukasz,

I'll just document this for anyone else who might need it... [EZ 3.10.0]

A custom (or existing) class that acts as an information collector has several redirect possibilities:

<b>1.</b> Displaying a "result" template (eg poll result), typically located in <i>[Design-Extension]/templates/content/collectedinfo/</i>

<b>2.</b> "Redirect" to a specific URL (for all objects of that class)

<b>3.</b> Redirect back to the content node ("Node") method.

Setting up information collection for a custom class involves creating settings for it in (eg) <i>settings/override/collect.ini.append.php</i>. Information about settings can be seen in <i>settings/collect.ini</i>

My question was about getting something like option 2 (above) to go to a dynamic URL, as I set in a template file. Lucasz's suggestion is to use option 1 and then create a redirect in the template loaded by that option.

So, collect.ini.append.php (eg, other options left out)

[InfoSettings]
TypeList[my_infocollector_class]=my_infocollector_class
[DisplaySettings]
DisplayList[my_infocollector_class]=result

And, in <i>[Design-Extension]/templates/content/collectedinfo/my_infocollector_class.tpl</i>

{* redirect to another node *}
{set-block scope=root variable=redirect_to_node_id}2{/set-block}

This then opens up opportunities for setting a variable redirect, perhaps using
- relative location (eg parent)
- last visited node
- value from template
- Get/Post value

@Heath .. yes, there seem to be some similar features to login redirection - ie RedirectURLAttribute, though I haven't experimented with this and there seems to be no documentation yet.

Thanks to you both. Hope this helps others.

Heath

Monday 29 October 2007 2:36:46 am

Thank you Paul for your detailed feedback. This might make a good node on eZpedia to document these details more permanently in greater detail.

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Paul Wilson

Monday 29 October 2007 4:26:09 am

Hi Heath,

I'm writing some documentation for EZ to publish for the EZ community at the moment, I'll aim to get some more material on to Ezpedia over coming months ... just getting out a little bit on-the-fly here. Just wanting to tackle a disadvantage of EZ forums ... it's often possible to find forum entries that are relevant but the why and what happened information is often missing. I suspect it would be useful for forum topics to be closed/resolved in the same way that issues are on issues.ez.no. (In effect "issues" are problems with EZ publish; "forum topics" are usually problems people are experiencing using EZ publish to achieve the results they want).

Anyway, I've been doing a lot of work in the areas of complex systems + information / knowledge architectures ... I'm interested in designing an overall architecture for the EZ ecosystem at some stage. I'll have a look at ways to better incorporate my existing and new documentation into EZ/EZpedia as part of this work soon.

Regards from Tasmania, Australia.

- Paul

Heath

Monday 29 October 2007 5:43:07 am

I noticed this ini file is documented only by name in ez.no/doc,
http://ez.no/doc/ez_publish/technical_manual/3_10/reference/configuration_files/collect_ini

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Łukasz Serwatka

Monday 29 October 2007 6:08:48 am

Hi Paul,

Have you considered warp this information in to one document and publish as article on ez.no about information collection (e.g useful tips)?

http://ez.no/developer/articles/writing_articles_for_ez_no

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Paul Wilson

Tuesday 30 October 2007 7:08:50 pm

Hi Lukasz,

I'll follow that up, thanks.

- Paul

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.