Reputation: 797
This is getting me confused.
How do I customize /state/state_name
to be replaced by /state/state_name.php
?
Initially state_name
is a variable and I don't want each of the state to be an action in my StateController
. Instead, I would like to take that variable and process it in a specific action loadAction()
to deal with the contents.
This is because the url /state/state_name.php
is already SEO optimized and I want it to stay in that form using Zend Framework.
Thanks for any help. Any suggestions would be gladly welcomed!
Upvotes: 2
Views: 169
Reputation: 14184
Maybe something like:
$route = new Zend_Controller_Router_Route_Regex(
'state/([^/]+)\.php',
array(
'controller' => 'state',
'action' => 'load',
),
array(
'state_name' => 1,
),
'state/%s.php'
);
But why is is so important to keep the .php
suffix? If anything, it unnecessarily exposes the underlying server-side technology employed to construct the page. What if you later change the entire site to Ruby On Rails or to Django? Why tie yourself to PHP?
If you are really sweet for a suffix, then I'd imagine that .htm
or .html
is better. But even that leads you down a path with a potentially bad smell. What if you want to use this same controller to be the endpoint of an AJAX request that returns JSON or XML data?
Personally, I'd bail on the suffix.
Upvotes: 2