Forums / Developer / Module parameters

Module parameters

Author Message

Julien Plesniak

Monday 30 July 2007 2:16:08 am

Hello, i try to build a new module but i have a problem. I write this code:

<form method="post" action={"content/action/"|ezurl}>
            <input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
	    <input type="hidden" name="test" value="42" />
	    <input type="submit" name="modulego" value="Test Julien" />   
        </form>

I have declared my parameters in module.php:

$ViewList["modulego"] = array(
    "functions" => array( 'use' ),
    "script" => "modulego.php",
    'ui_context' => 'administration',
    "default_navigation_part" => 'ezcontentnavigationpart',
    "params" => array( 'ContentNodeID', 'test'));

But when i do this:

$nodeID =& $Params['ContentNodeID'];
$test =& $Params['test'];


or $test =$Params['test'];

I get the nodeID but i didn't get the "test" parameter, it is empty.

Why i dont get the value of this parameter?

Thanks for help

Heath

Monday 30 July 2007 12:10:01 pm

Why not use the eZ http variable naming convention for your form variables?
<i>http://ez.no/ezpublish/documentation/development/standards/php#eztoc80797_13</i>

I think this is MixedCaseStyle convention. I would try to change 'test' to 'TestVariable' and try again.

Also if that does not meet your needs you may wish to change 'params' to 'unordered_params' and try again.

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Bruce Morrison

Monday 30 July 2007 4:34:13 pm

Hi Julien

The "params" in the module.php definition refers to parameters that are passed in the URL not via a form.

Your definition allows for URLs of the form /modulename/modulego/[ContentNodeID]/[test] This will set the $Params values you require but I'm not sure that this is the easiest way to achieve what you are trying to do.

You are probably better off retrieving the form variables using the eZHTTPTool. class e.g.

include_once( "lib/ezutils/classes/ezhttptool.php" );
$http =& eZHTTPTool::instance();
$test=false;
$ContentNodeID=false;
if ( $http->hasPostVariable( 'ContentNodeID' ) )
  $ContentNodeID=$http->postVariable( 'ContentNodeID' );
if ( $http->hasPostVariable( 'test' ) )
  $test=$http->postVariable( 'test' );

See http://pubsvn.ez.no/doxygen/trunk/html/classeZHTTPTool.html

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Julien Plesniak

Tuesday 31 July 2007 12:51:24 am

Thanks it work perfectly

eZ debug

Timing: Jan 31 2025 00:39:17
Script start
Timing: Jan 31 2025 00:39:17
Module start 'content'
Timing: Jan 31 2025 00:39:17
Module end 'content'
Timing: Jan 31 2025 00:39:17
Script end

Main resources:

Total runtime0.1692 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.8281370.3047
Module start 'content' 0.00780.0127 958.13281,005.6094
Module end 'content' 0.02050.1487 1,963.74223,894.8984
Script end 0.1692  5,858.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00412.4499200.0002
Check MTime0.00120.7295200.0001
Mysql Total
Database connection0.00100.585510.0010
Mysqli_queries0.085350.42601410.0006
Looping result0.00120.70611390.0000
Template Total0.148387.710.1483
Template load0.00080.454410.0008
Template processing0.147687.196810.1476
Override
Cache load0.00060.329810.0006
Sytem overhead
Fetch class attribute can translate value0.00181.054110.0018
XML
Image XML parsing0.00030.150810.0003
General
dbfile0.00432.5473200.0002
String conversion0.00000.004630.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs