[CakePHP] Alias in the url. Take 2

Some days ago, I posted about having dynamic URL aliases with cake-php 1.1.18. In that post I used the AppError object trapping the missingAction error.

When I was ready for production environment, during tests I wondered that the AppError is ignored when core debug level is set to 0. While I’m asking about the utility of this behavior, I asked in the list and searched for a solution.

One solution could be to take the __construct method from the ErrorHandler, removing the Configure::read() test and paste it into the AppError::__construct() without calling the parent::__construct(). But in this way if some new feature, fixes, etc. is distributed within that method you’ll probably miss it until you monitor each release.

Finally I opted for useing the routes.php file mapping each action and then mapping the “missing action” to the controller::view() action and the manage the code inside it. Here is a PDF with an extract of the code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s