Closed alorence closed 10 years ago
This is the normal behavior. If you want to provide URLs ending with .html
, you'll need to edit your root .htaccess
file (Link to the file) :
RewriteRule ^(.*)$ index.php?action=$1 [L,QSA]
will become :
RewriteRule ^(.*)\.html$ index.php?action=$1 [L,QSA]
Then URLs like www.domain.tld/myaction.html
will call app/actions/myaction.php
.
Thank you for your answer. I understand your advice about modifying .htaccess. But if I do that, how can I achieve to render specific view context regarding to url suffix, like described here http://atomikframework.com/docs/urls.html#file-extensions
Do I need to add something like:
RewriteRule ^(.*)\.xml$ index.php?action=$1&format=xml [L,QSA]
If it is the right solution, why do not directly specify a generic .htaccess entry ?
RewriteRule ^(.*)\.(.*)$ index.php?action=$1&format=$2 [L,QSA]
Ok, I realize I gave a pretty brutal solution !
If we look in Atomik.php
(link), we can see $uriExtension
is extracted, but $request['action']
take the value of $uri
, which remains the same. I would basically have suggested to use something like :
// Atomik.php:574
if (!$found) {
if($uriExtension === false) {
$request = array(
'action' => $uri,
self::get('app.views.context_param', 'format') => self::get('app.views.default_context', 'html')
);
} else {
$request = array(
'action' => rtrim($uri, '.'.$uriExtension),
self::get('app.views.context_param', 'format') => $uriExtension
);
}
}
This allow us to use www.domain.tld/myaction.html
, avoiding to use .html
in folder/file names, but I'm not really aware of all consequences. I will wait for @maximebf review on this point.
There was indeed a bug and @zessx had the correct answer. fixed in master
I want to configure the framework to provide contents mainly with url like "www.domain.tld/myaction.html" As I understand here http://atomikframework.com/docs/urls.html#file-extensions Atomik should load view/[controller] myaction in that case, and dispatch 2 parameters: action=myaction and format=html
Instead in $_GET array, I see only action=myaction.html
Additionally, I must rename all my views to obtain the content of each page. They have to be in form myaction.html.phtml. Is this the desired behavior or did I miss something ?