Forums / Developer / Module parameters

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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/Exponential/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

7x | https://se7enx.com/
Brookins Consulting | https://brookinsconsulting.com/
Certified | http://web.archive.org/web/201012...th.ez.no/certification/verify/380350
Solutions | https://projects.exponential.earth/users/community/brookins-consulting
eZpedia community documentation project | http://ezpedia.se7enx.com

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