Quantcast

Organising Routes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Organising Routes

Mary Nicole Hicks
I currently have a few routes configured and these work well.
I also use the URL View Helper to create urls.
The problem with the URL View Helper is that I always need to specify the correct route to use. This means specifying it as a string.

Does anyone have a method of organising all these route names using something like const(s) so that you only specify the string route name in one place?
How would you do this, get still maintain modularity and loose coupling between modules?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Organising Routes

Martel
Mary Nicole Hicks wrote:

> Does anyone have a method of organising all these route names using
> something like const(s) so that you only specify the string route name in
> one place?

I don't get it. Where's the benefit in using CONST vs string? Maybe you could explain
what you would like it to be by presenting a use case.

--
Michał Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Organising Routes

jkushN1
I don't really understand the question either. The issue of const's is neglegient though. I always prefer to use const's. What are you trying to do though? Why do you have so many routes? Why not use an xml storage for these routes, and load everything in one function? For instance, here's a function I have for loading plugins:

        public function setPlugins()
        {
                $plugins = array();
                foreach(Hornet::getConfig('global/controller/front/plugins')->children() as $module=>$pluginInfo)
                {
                        $plugins[$module] = array();
                        foreach($pluginInfo->children() as $pluginName=>$plugin)
                        {
                                $pluginClassName = uc_words($module);
                                if($plugin->is('active')){
                                        $pluginClassName .= '_Controller_Plugin_' . $pluginName;
                                        $this->registerPlugin(new $pluginClassName,$plugin->get('stackIndex',null));
                                }
                        }
                }
                return $this;
        }

And Here's the XML Source:

            <controller>
                        <front>
                                <plugins>
                                        <Core>
                                                <ViewSetup>
                                                        <active>1</active>
                                                        <stackIndex>98</stackIndex>
                                                </ViewSetup>
                                                <ActionSetup>
                                                        <active>1</active>                                                       
                                                </ActionSetup>
                                        </Core>
                                </plugins>
                        </front>
                </controller>               

Michał Minicki wrote
Mary Nicole Hicks wrote:

> Does anyone have a method of organising all these route names using
> something like const(s) so that you only specify the string route name in
> one place?

I don't get it. Where's the benefit in using CONST vs string? Maybe you could explain
what you would like it to be by presenting a use case.

--
Michał Minicki aka Martel Valgoerad | martel@aie.pl | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell
Loading...