 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Robert Basic's Blog: A hack for Zend Framework's translated route segments
by Chris Cornutt April 15, 2011 @ 09: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.
voice your opinion now!
zendframework hack multilanguage route segment issue
Zend Developer Zone: Chaining language with default route
by Chris Cornutt August 12, 2010 @ 10:47:01
On the Zend Developer Zone there's a new post talking about including language information in your Zend Framework application's default route in a cleaner manner.
There are several ways how to include language id in default route of Zend Framework. However, generally you end up with the solution not quite elegant and likely not totally trouble-free. I have seen people overwriting the default route by new one which mimics module route with additional language id. There is no need to throw the default module route away to do this. To get it right chain the plain language route with default route.
He gives code examples of the routing code to put in your bootstrap that uses the Zend_Controller_Router_Route_Chain and a plugin to handle the language checking and routing handling.
voice your opinion now!
default route zendframework plugin
Robert Basic's Blog: Playing with Zend_Navigation and routes
by Chris Cornutt August 10, 2009 @ 08:13:12
In this new post to his blog Robert Basic looks at the Zend_Navigation component of the Zend Framework and how it can be used to more correctly handle bad requests.
I wanted to set up routes in such way that when a user requests a page, all requests for non-existing controllers/modules are directed to a specific controller (not the error controller). In other words, if we have controllers IndexController, FooController and PageController, anything but http://example.com/index and http://example.com/foo is directed to the PageController.
Using the Zend_Controller_Router_Route_Regex component he creates an expression that matches anything but the two allowed controllers and pushes them back over to the "page" controller. The new route is put in place via an addRoute call. He also shows how to use the Zend_Navigation component to manage the navigation structure for this application, defining a PHP array of the nested sitemap if the site.
voice your opinion now!
zendnavigation route regex tree
Jonathan Snook's Blog: Building a URL Shortener (with CakePHP)
by Chris Cornutt April 27, 2009 @ 12:06:23
With recent discussions about URL shortners, Jonathan Snook decided to work up his own quick version using some of the built-in routing of the CakePHP framework.
With all the talk of URL shortening services, I decided to add a quick service into Snook.ca, which is run on CakePHP, to redirect a short URL to a post. Because my static content already has short URLs and all I have are posts, creating a short URL handler for it was very easy.
His shortener is used on his posts for his blog to redirect the smaller URLs back to the post they reference. The result is a route that connects something like "/s/id_number" over to the correct post (as seen here). He also offers a suggestion for a "super-compressed" URL tat converts it down to a three-character shortened version that can then be easily converted back down to the decimal equivalent.
voice your opinion now!
cakephp framework url shortener short route custom
Jani Hartikainen's Blog: Improving Ajax performance in Zend Framework applications
by Chris Cornutt March 23, 2009 @ 08:45:03
New on his blog Jani Hartikainen has posted a simple idea that you can take to make sure you're getting the most out of your Ajax/Zend Framework connections.
A common reason to use Ajax in a website is to make it feel faster, so you usually want Ajax requests be processed as quickly as possible. While there are many ways to speed up Zend Framework based applications, there are still some things like routing and dispatching which still add up to the total. There is, however, another way to make Ajax work even faster
Since Ajax requests don't usually require all of the complex routing and dispatching that a normal Zend Framework request might, he recommends creating a separate Ajax handler. His includes an example of a simple searching endpoint with a class handling the backend logic. A simple handler script loads up the bootstrap and makes the request for the search, returning the search results in a JSON format.
voice your opinion now!
improve ajax performance zendframework endpoint route dispatch
Symfony Blog: Cross Application Links
by Chris Cornutt February 19, 2009 @ 12:56:08
Fabien Potencier has recently posted a tutorial over on the symfony blog about using cross-application links in your application:
A symfony project is made of one or more applications. Applications share nothing, but the model classes. But, even if the symfony documentation is crystal clear on the subject, many developers want to share more than just the model. The most requested feature being the ability to create links to a frontend application from a backend one.
This sort of linking is relatively simple in the 1.1 release of the framework - its instances of sfRoutingConfigHandler and sfPatternRouting that let you create the configuration classes (and code) to grab information and functionality from one application to another.
voice your opinion now!
symfony cross application link route configuration
Make Me Pulse: Using the Zend Framework URL rewriting
by Chris Cornutt January 15, 2009 @ 07:55:15
New from the Make Me Pulse blog is this quick tutorial about bending the URL rewriting that the Zend Framework does to match whatever your needs might be.
Today for a good website's referencement in Google, it's necessary to have an URL rewriting. [...] If your application is based on ZF, we have a htaccess base file which will redirect all php files to the boostrap (what is the bootstrap ?), and ZF classes will manage all redirection rules. How to implement the URL rewriting with ZF classes ?
He sets up a config file (an ini file) with the routing instructions the framework will need to adhere to and shows how to get the application to include it and match against it for routing rules. His example sets a default route and several regular expression-based routes to remap requests right where they need to go.
voice your opinion now!
zendframework config file ini routing regex default route tutorial
|
Community Events
Don't see your event here? Let us know!
|