fuelphp - file extensions
I made a controller named sitemaps and have action_sitemap() , but how do I tell fuel to handle the following?:
http://site/sitemaps/sitemap.xml
and the following using the same actio开发者_开发技巧n_sitemap() ?:
http://site/sitemaps/id.xml
where id could be a passed variable.
Just use routing, setup a route for both that you point to a controller method of your choosing.
Routing is explained in the docs.
Put something like this in your routes.php app config file:
'sitemaps/sitemap\.xml' => 'sitemaps/sitemap',
'sitemaps/([0-9]+)\.xml' => 'sitemaps/sitemap/$1',
精彩评论