Forums / Developer / Setting the URL when returning from a content_actionhandler

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