Share » Forums » Developer » Removing custom module index page ?

Removing custom module index page ?

Removing custom module index page ?

Wednesday 15 July 2009 1:33:08 am - 4 replies

Author Message

André R.

Wednesday 15 July 2009 2:33:35 am

I'm amazed that $ViewList[''] is valid php, but anyway, doesn't seemd to work. If the module only have one view, then you should look into using the singel function support.

HowTo: Avoid defining $ViewList, and just define the singel function in $Module['function'] like:

$Module = array( 'name' => 'Custom',
                 'variable_params' => true,
                 'function' => array( 'script' => 'index.php',
                                             'params' => array( 'contentNodeID' ) )
);

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

H-Works Agency

Wednesday 15 July 2009 2:50:34 am

This technique allow to make compact module adresses by removing the second element in module's view uri.

But my exemple is not only for a "one view module" but to define a module "index" page...after $ViewList[''] you can add $ViewList['myview'].

The second benefit of defining this "empty" view is that people playing with their browser address won't arrive on a "undefined view" error when removing module's view name from the address.

I wasn't aware of your technique, i am gonna try it right away.

Thanx

EZP is Great

Bartek Modzelewski

Wednesday 15 July 2009 3:08:03 am

Hi Martin,

have you tried to use URL Translator in admin interface, and setup the following rule:

New URL alias: custom
Destination: custom/index
and remeber to uncheck "Alias should redirect to its destination".

I use it in my custom module, in fact without any params, but i think it should work also with params. Maybe just you will have to use different alias name than your module... (not sure about it)

Baobaz
http://www.baobaz.com

H-Works Agency

Wednesday 15 July 2009 3:21:20 am

I tried andre's way and its perfect for what i need...the only problem is that you can't add new module views to the module after that.

I thought about using url_translation module, i am gonna test it to see if it works with wildcards.

Thanx

EZP is Great

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

36 542 Users on board!

Forums menu