Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Master Zend Framework:
HowTo Use Child and Segment Routes to Build Simple Routing Tables
Apr 03, 2014 @ 16:15:05

Matthew Setter has a new post to his Master Zend Framework site today showing you how to use child and segment routes to create a routing table in your Zend Framework v2 application. These routes are "sub-routes" underneath a main route defined in the main router configuration.

Routing is one of the key requirements in modern applications, especially in Zend Framework 2; but they shouldn’t be overly-complicated. Today, we’re going to look at how to build a routing table, simply and easily using child and segment routes. [...] But how would we do that? Gladly, it’s quite simply, using a combination of [the] two route types: Segment and Child Routes. I’ve made a complete example, which’s available in this Gist. Feel free to skip straight to that. But otherwise, let’s step through the annotated version together.

He sets the stage with an example in a "writing pipeline" application that helps him predict his income from his freelance writing. He describes the main controllers and the routing configurations they might share. In his example code, he shows how to define the routes and modify them to use segments and child routes to handle constraints. There's also a section about extracting out the segments from the route.

tagged: child segment routes tutorial routing zendframework2

Link: http://www.masterzendframework.com/tutorial/child-and-segment-routes

Robert Basic's Blog:
A hack for Zend Framework’s translated route segments
Apr 15, 2011 @ 14:17:40

Robert Basic has put together a new post to his blog about a hack he's found for the Zend Framework translated route segments when a "gotcha" popped up when he was trying to use them in a multi-language website.

The web site’s default locale, language, is English. If the user has no locale in the session/cookie, she, or he, will get the English version of the web site. [...] But! If the user’s first visit is on the http://example.com/vesti URL ("vesti" is "news" in Serbian), the router can’t route that because it depends on the locale and the default locale is English and not Serbian, thus directing the user to the 404 page.

To get around this issue he created a front controller plugin that fires in the postDispatch hook to change the locale manually if the current request's isn't found to be English. It then redirects the user to the correct location for the new language and things proceed normally.

tagged: zendframework hack multilanguage route segment issue

Link:

Chris Shiflett's Blog:
Ask Chris Is Back
Feb 27, 2006 @ 14:20:25

As noted in his latest blog entry, Chris Shiflett and the Pro::PHP podcast are again collaborating to bring the listening community more "Ask Chris" shows.

It's been a few months since Episode One, but thanks to Marcus, Ask Chris is back on the air. The format is a bit different - instead of doing separate shows, we'll be doing a short segment at the end of each interview.

This interview is with David Sklar of Ning. He and Marcus discuss Ning, of course, but David also provides some good perspective on the state of technology and how the definition of a programmer is becoming more and more inclusive.

This episode of Ask Chris is about email injection, a topic of growing concern for PHP developers.

You can find out more about this addition to the Pro::PHP lineup and how to subscribe to the podcast over on their site.

tagged: ask chris podcast short segment end recording ask chris podcast short segment end recording

Link:

Chris Shiflett's Blog:
Ask Chris Is Back
Feb 27, 2006 @ 14:20:25

As noted in his latest blog entry, Chris Shiflett and the Pro::PHP podcast are again collaborating to bring the listening community more "Ask Chris" shows.

It's been a few months since Episode One, but thanks to Marcus, Ask Chris is back on the air. The format is a bit different - instead of doing separate shows, we'll be doing a short segment at the end of each interview.

This interview is with David Sklar of Ning. He and Marcus discuss Ning, of course, but David also provides some good perspective on the state of technology and how the definition of a programmer is becoming more and more inclusive.

This episode of Ask Chris is about email injection, a topic of growing concern for PHP developers.

You can find out more about this addition to the Pro::PHP lineup and how to subscribe to the podcast over on their site.

tagged: ask chris podcast short segment end recording ask chris podcast short segment end recording

Link:


Trending Topics: