Forums / Developer / HTTP-Request to call on a module and pass a parameter

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

eZ debug

Timing: Jan 18 2025 11:17:14
Script start
Timing: Jan 18 2025 11:17:14
Module start 'content'
Timing: Jan 18 2025 11:17:16
Module end 'content'
Timing: Jan 18 2025 11:17:16
Script end

Main resources:

Total runtime1.9920 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0102 588.9766180.8125
Module start 'content' 0.01021.7875 769.7891542.9219
Module end 'content' 1.79770.1942 1,312.7109338.0938
Script end 1.9919  1,650.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00640.3226210.0003
Check MTime0.00160.0783210.0001
Mysql Total
Database connection0.00110.056910.0011
Mysqli_queries1.888994.82272020.0094
Looping result0.00220.11162000.0000
Template Total1.942497.520.9712
Template load0.00380.191820.0019
Template processing1.938597.316020.9693
Template load and register function0.00050.023410.0005
states
state_id_array0.00330.163610.0033
state_identifier_array0.00270.134120.0013
Override
Cache load0.00340.1711500.0001
Sytem overhead
Fetch class attribute can translate value0.00200.098840.0005
Fetch class attribute name0.00170.083550.0003
XML
Image XML parsing0.00070.036840.0002
class_abstraction
Instantiating content class attribute0.00010.005550.0000
General
dbfile0.00310.1536210.0001
String conversion0.00000.000330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 6

Time used to render debug report: 0.0004 secs