HTTP-Request to call on a module and pass a parameter

HTTP-Request to call on a module and pass a parameter

Friday 06 October 2006 7:40:25 am - 4 replies

Modified on Friday 06 October 2006 7:42:19 am by Daniel Scheiner

Author Message

Sascha Frinken

Friday 06 October 2006 7:53:37 am

Hope I didn't get You wrong...

I would (as always) write a template operator for it.

Within the template operator you could use wget, curl or fsockopen.

HTH

Sascha

Claudia Kosny

Friday 06 October 2006 8:14:24 am

Hi Daniel

Have a look at the way EZ manages system urls
http://ez.no/doc/ez_publish/technical_manual/3_8/concepts_and_basics/url_translation

and custom view parameters
http://ez.no/doc/ez_publish/technical_manual/3_8/concepts_and_basics/modules_and_views

Greetings fromLuxembourg

Claudia

Daniel Scheiner

Friday 06 October 2006 10:03:48 am

hmmm... maybe i should explain a little better:

the url that i need will differ every time.

www.test.com/whatever/parameter1

this "parameter1" that is in the url must be passed on to the module (!!!) and will be used there.
and in addition to that i need the module to accept http-post-request variables.

is that possible and if so, i really would love to know how... like in a example (sorry.... i'm not yet as adapt in ezp)

thanks!!!

Claudia Kosny

Friday 06 October 2006 10:46:30 am

Hi Daniel

Unless I understand you totally wrong this is exactly what view parameters are doing.
The only problem might be that you would have a view in your url, something like this:
www.testing.com/mymodule/myview/parameter

Your view (which the module.php maps to an script) has access to $Params which contains the parameters.
To have ordered parameters you need to specify their name(s) in the module.php in your extension.
Example:
$ViewList["main"] = array('script' => 'main.php', 'params' => array('rootNodeID'));

So I could call up the view main of my extension myextension like this:
www.example.com/index.php/myextension/main/42

Here the view main calls up a script main.php which can access the passed value 42 by using $Params['rootNodeID']. The script main is a normal php file which is then responsible for calling a template or forwarding to another view.

To access post variables you could use plain $_POST or, using the EZ tools:

include_once( "lib/ezutils/classes/ezhttptool.php" );
$http =& eZHTTPTool::instance();
else if ( $http->hasPostVariable( "foo" ) )
{
    $foo= $http->postVariable( "foo);
}

Greetings from Luxembourg

Claudia

You must be logged in to post messages in this topic!

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