This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Module with dynamic ViewList

Module with dynamic ViewList

Module with dynamic ViewList

Wednesday 19 February 2014 1:46:39 pm - 2 replies

Is this possible?


foreach {

// check what you get as a $_GET parameter is in the $list if yes save the value in $value


$ViewList[$value] = array( etc....

And I want to achieve something like this view)

Wednesday 19 February 2014 4:42:52 pm

You can define module with one view:

// extension/mymodule/module.php:
$Module = array(
     "name" => "MyModule",
     "function" => array(
         "script" => "test.php"

Then in the test.php script you can do something like this:

$viewParameters = $Params['Parameters'];
$list = array('view1','view2','view3','view4');
// if view not defined in list array redirect to kernel not found
if ( !in_array($viewParameters[0], $list) )
    return $Module->handleError( eZError::KERNEL_NOT_FOUND, 'kernel' );
// here goes your code

Now you are able to access your views like this: 

please note that this will work too

So if you want to disable this you'll need to replace if condition with this one:

 if ( count($viewParameters) > 1 || !in_array($viewParameters[0], $list) )

Modified on Wednesday 19 February 2014 4:59:30 pm by Mario Ivancic

Thursday 20 February 2014 9:10:53 am

Thank you, exactly what I wanted happy.gif Emoticon

And as you suggested I can still use the ordered parameters for the /view1/param2/param3 etc?


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

36 542 Users on board!

Forums menu

Proudly Developed with from