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

Author Message

Daniel Scheiner

Friday 06 October 2006 7:40:25 am

Hi!

I need to dynamicly create a URL that is structured like so:

www.testing.com/mymodule/parameter
or www.testing.com/mymodule?=parameter (or some variation of that)
(eventually more than one parameter)

I need a HTTP-Request made to that URL to call up a module and give it said parameter.
Later i will have to use the parameter.

How can I do that?
THANKS!!!

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

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 18 2025 16:10:08
Script start
Timing: Jan 18 2025 16:10:08
Module start 'layout'
Timing: Jan 18 2025 16:10:08
Module start 'content'
Timing: Jan 18 2025 16:10:09
Module end 'content'
Timing: Jan 18 2025 16:10:09
Script end

Main resources:

Total runtime0.5773 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.5703152.6406
Module start 'layout' 0.00540.0033 742.210939.4766
Module start 'content' 0.00870.5671 781.6875537.8281
Module end 'content' 0.57580.0015 1,319.515612.1250
Script end 0.5772  1,331.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.5481160.0002
Check MTime0.00130.2195160.0001
Mysql Total
Database connection0.00080.143310.0008
Mysqli_queries0.524190.7868650.0081
Looping result0.00060.1007630.0000
Template Total0.549695.220.2748
Template load0.00190.331820.0010
Template processing0.547694.868520.2738
Template load and register function0.00010.021110.0001
states
state_id_array0.00090.160610.0009
state_identifier_array0.00070.124720.0004
Override
Cache load0.00170.2871500.0000
Sytem overhead
Fetch class attribute can translate value0.00070.121130.0002
Fetch class attribute name0.00090.154750.0002
XML
Image XML parsing0.00030.055930.0001
class_abstraction
Instantiating content class attribute0.00000.001950.0000
General
dbfile0.00070.1197100.0001
String conversion0.00000.001940.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs