Quantcast

Best practice with routes management using separate .ini

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

Best practice with routes management using separate .ini

Razorblade

Hi all,
in my ZF project I have lots of different routes that now are defined within the application.ini using the "resources.router", resources.router.routes.login.* for example .

Searching on the web I found that some people are using a separate ini file only for routes, called route.ini or routes.ini, omitting the "resources.router" part when adding a route.

So my questions are:

- is it a good practice to store route configuration in a separate file?
- is there a standard name for this file?
- how and where load it?
- I've already an idea about the above questions answers,  so I give it a try, and loading the routes with  "resources.router" throws a Zend_Controller_Router_Exception 'No route configuration in section 'routes'', why?

Thanks to everyone will help me to make it clear.

Regards

Sergio Rinaudo
     
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Best practice with routes management using separate .ini

Hector Virgen
I suggest creating a new bootstrap resource plugin by the same name
"router", extend the ZF one, and add your own logic to pull the config from
a separate file.

Something like this should do the trick:

http://pastie.org/2377345

Then update your application.ini with this line:

resources.router.configPath = APPLICATION_PATH "/configs/routes.ini"

The benefit is that you can still leverage the logic in the original ZF
router bootstrap resource plugin and pretty much copy/paste the routes from
application.ini to routes.ini. Just remove "resources." from the beginning
of each line.

I hope this helps!

--
*Hector Virgen*
http://www.virgentech.com
Follow me on Twitter: @djvirgen <http://twitter.com/djvirgen>



On Mon, Aug 15, 2011 at 1:47 PM, Sergio Rinaudo <[hidden email]>wrote:

>
> Hi all,
> in my ZF project I have lots of different routes that now are defined
> within the application.ini using the "resources.router",
> resources.router.routes.login.* for example .
>
> Searching on the web I found that some people are using a separate ini file
> only for routes, called route.ini or routes.ini, omitting the
> "resources.router" part when adding a route.
>
> So my questions are:
>
> - is it a good practice to store route configuration in a separate file?
> - is there a standard name for this file?
> - how and where load it?
> - I've already an idea about the above questions answers,  so I give it a
> try, and loading the routes with  "resources.router" throws a
> Zend_Controller_Router_Exception 'No route configuration in section
> 'routes'', why?
>
> Thanks to everyone will help me to make it clear.
>
> Regards
>
> Sergio Rinaudo
>
--
Hector Virgen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Best practice with routes management using separate .ini

Razorblade

Thank you Hector for your suggestion, it helped me.
I thought there was some sort of self-recognition in ZF by calling the file with that name.

And also I use bootstrap resource a lot and I like them so much.

Bye!

Sergio Rinaudo


> From: [hidden email]
> Date: Mon, 15 Aug 2011 14:57:44 -0700
> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [fw-general] Best practice with routes management using separate .ini
>
> I suggest creating a new bootstrap resource plugin by the same name
> "router", extend the ZF one, and add your own logic to pull the config from
> a separate file.
>
> Something like this should do the trick:
>
> http://pastie.org/2377345
>
> Then update your application.ini with this line:
>
> resources.router.configPath = APPLICATION_PATH "/configs/routes.ini"
>
> The benefit is that you can still leverage the logic in the original ZF
> router bootstrap resource plugin and pretty much copy/paste the routes from
> application.ini to routes.ini. Just remove "resources." from the beginning
> of each line.
>
> I hope this helps!
>
> --
> *Hector Virgen*
> http://www.virgentech.com
> Follow me on Twitter: @djvirgen <http://twitter.com/djvirgen>
>
>
>
> On Mon, Aug 15, 2011 at 1:47 PM, Sergio Rinaudo <[hidden email]>wrote:
>
> >
> > Hi all,
> > in my ZF project I have lots of different routes that now are defined
> > within the application.ini using the "resources.router",
> > resources.router.routes.login.* for example .
> >
> > Searching on the web I found that some people are using a separate ini file
> > only for routes, called route.ini or routes.ini, omitting the
> > "resources.router" part when adding a route.
> >
> > So my questions are:
> >
> > - is it a good practice to store route configuration in a separate file?
> > - is there a standard name for this file?
> > - how and where load it?
> > - I've already an idea about the above questions answers,  so I give it a
> > try, and loading the routes with  "resources.router" throws a
> > Zend_Controller_Router_Exception 'No route configuration in section
> > 'routes'', why?
> >
> > Thanks to everyone will help me to make it clear.
> >
> > Regards
> >
> > Sergio Rinaudo
> >
     
Loading...