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.

eZ debug

Timing: Jan 19 2025 07:21:26
Script start
Timing: Jan 19 2025 07:21:26
Module start 'layout'
Timing: Jan 19 2025 07:21:26
Module start 'content'
Timing: Jan 19 2025 07:21:27
Module end 'content'
Timing: Jan 19 2025 07:21:27
Script end

Main resources:

Total runtime0.9839 sec
Peak memory usage4,096.0000 KB
Database Queries77

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 596.0625152.6406
Module start 'layout' 0.00620.0043 748.703139.4766
Module start 'content' 0.01060.9719 788.1797679.5703
Module end 'content' 0.98240.0015 1,467.750024.1250
Script end 0.9839  1,491.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3327160.0002
Check MTime0.00140.1386160.0001
Mysql Total
Database connection0.00090.092410.0009
Mysqli_queries0.894590.9113770.0116
Looping result0.00080.0818750.0000
Template Total0.949396.520.4747
Template load0.00200.205520.0010
Template processing0.947396.276420.4737
Template load and register function0.00010.011410.0001
states
state_id_array0.00140.138210.0014
state_identifier_array0.00150.155220.0008
Override
Cache load0.00190.1898740.0000
Sytem overhead
Fetch class attribute can translate value0.00100.096630.0003
Fetch class attribute name0.00100.0995120.0001
XML
Image XML parsing0.00190.193530.0006
class_abstraction
Instantiating content class attribute0.00000.0046180.0000
General
dbfile0.00140.1440310.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
9content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 46
 Number of unique templates used: 7

Time used to render debug report: 0.0003 secs