Setting the URL when returning from a content_actionhandler

Author Message

Stuart Fenton

Wednesday 19 October 2005 1:06:49 pm

I am completing an extension (which I will post to the contributions when I'm finished) that allows you to have bookmark functionality that holds the data in the session rather than the database.

It allows an anonymous user to add items to their bookmarks without having to login first. By keeping them in the session they get dropped when the session times out. It also transfers their bookmarks when they login to their account.

I'm basically finished apart from not being able to return out of the extension to the correct page.

The extension has a 'content_actionhandler' that runs the "add to bookmark" but I cannot seem to write the return correctly.

I have tried lots of method but the URL string always remains as content/action

How do I get the URL to update correctly.

Here is my test code:

    if ( $http->hasPostVariable( 'ViewMode' ) )
    {
        $viewMode = $http->postVariable( 'ViewMode' );
    }
    else
    {
        $viewMode = 'full';
    }
    $Module->redirectTo( $Module->functionURI( 'view' ) . '/' . $viewMode . '/' . $objectID . '/' );
	
   	// return module contents
#	$Result = array();
#	$Result['content'] =& $tpl->fetch( 'design:full/bookmark.tpl' );
#	$Result['path'] = array( array( 'text' => ezi18n( 'kernel/content', 'My bookmarks' ),
#                                'url' => false ) );
	$Result = array();
	$Result['content'] =& $tpl->fetch( 'design:full/container_artist.tpl' );
	$Result['path'] = array( array( 'url' => 'artists/male_voice_artists',
                                'text' => ezi18n( 'extension/bookmark', 'Artists' ) ),
                         array( 'url' => 'artists/male_voice_artists',
                                'text' => 'Male Voice Artists' ) );

	return $Result;

Any help would be greatfully appreciated.

Regards
Fats

-- Stuart

stuart@grandmore.com
http://www.grandmore.com

Stuart Fenton

Thursday 20 October 2005 6:43:58 am

I managed to track down the problem.

When creating the module I did not pass a handle to the $Module

So I had

function bookmark_ContentActionHandler( $Module, $http, $objectID )

When it should have been

function bookmark_ContentActionHandler(  &$Module, &$http, $objectID )

It took me a while to track down.

Regards
Fats

-- Stuart

stuart@grandmore.com
http://www.grandmore.com

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 20 2025 17:35:27
Script start
Timing: Jan 20 2025 17:35:27
Module start 'layout'
Timing: Jan 20 2025 17:35:27
Module start 'content'
Timing: Jan 20 2025 17:35:28
Module end 'content'
Timing: Jan 20 2025 17:35:28
Script end

Main resources:

Total runtime0.8426 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.1719151.2422
Module start 'layout' 0.00530.0020 739.414136.7109
Module start 'content' 0.00730.8343 776.1250519.2656
Module end 'content' 0.84160.0010 1,295.390611.7813
Script end 0.8426  1,307.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3680160.0002
Check MTime0.00130.1540160.0001
Mysql Total
Database connection0.00100.119610.0010
Mysqli_queries0.798594.7612520.0154
Looping result0.00040.0472500.0000
Template Total0.818997.220.4094
Template load0.00190.225120.0009
Template processing0.817096.957920.4085
Template load and register function0.00010.015510.0001
states
state_id_array0.00030.031810.0003
state_identifier_array0.00060.074420.0003
Override
Cache load0.00160.1853260.0001
Sytem overhead
Fetch class attribute can translate value0.00090.102210.0009
Fetch class attribute name0.00090.102130.0003
XML
Image XML parsing0.00190.228010.0019
class_abstraction
Instantiating content class attribute0.00000.001340.0000
General
dbfile0.00210.2525160.0001
String conversion0.00000.000740.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/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: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs