Forums / Developer / default view for module
Claudia Kosny
Friday 08 December 2006 6:23:32 am
Hi there
is there a way to specify a default view for a module?Example: I have a module 'test' with the following module.php
$Module = array("name" => "Test"); $ViewList = array(); $ViewList['foo'] = array('script' => 'foo.php'); $ViewList['bar'] = array('script' => 'bar.php');
This gives me the urls .../index.php/test/foo and .../index.php/test/bar.But when I go to the url index.php/test I get a kernel 21 error (view not found) which is certainly correct but would rather have the option to display the view 'foo' instead.
Is that possible to do from within the extension/module (without needing to add a url translation)?
Thanks
Claudia
Kristof Coomans
Friday 08 December 2006 6:40:55 am
Hi Claudia
This worked in eZ 3.4, don't know if it still works but I guess it does:
$ViewList['']=...
If you want to have only one view in your module, then define it with the value for the "function" key in the $Module array:
$Module = array("name" => "Test", "function" => array('script' => 'foo.php') );
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
Friday 08 December 2006 6:48:44 am
Hi Kristof
Thanks for the answer, it worked. Don't know why I haven't tried this before - it was to obvious I think...
Have a nice weekend