-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocaleUrlManager print out 'controller''controller' before render html why? #6
Comments
What do you mean by "print out 'controller''controller"? Can you also show your configuration? |
My app print 'controller name''controller name' before any controller action. 'request'=>array(
'enableCsrfValidation'=>true,
'csrfTokenName'=>'z3us',
'enableCookieValidation'=>true,
'class'=>'ext.localeurls.LocaleHttpRequest',
'languages'=>array('en','hu','sk','ja'),
),
'urlManager'=>array(
'class'=>'ext.localeurls.LocaleUrlManager',
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<view:\w+>'=>'site/page',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
), |
I can not see how this could effectively be caused by the extension. I mean, you can go through the code: There's no |
yes, i'm sure. The part of init (parent::init) prints out this, before any "my" controller action. I'm not sure is this localeHttpRequest bug, maybe yii bug if menu or normalizeUrl not pretty configured. (ex. left action from link) |
Can you reproduce this with a clean install using a fresh copy of Yii and my extension? I don't have this problem. And i also don't think it's a Yii bug - it's too obvious and many people would already have complained. |
You can also try to hunt it down: Just follow the method calls that are involved and add some |
I believe I saw this (or similar) happen when creating URLs that reference paths under modules. For example, I'm using the Yii User Management module, so for creating a login link in a menu item, the $url is '/user/auth/login'. It seems that when using this extension (which is great btw), take an example we are at the url '/en/user/auth/login', where the 'user' controller is actually coming from 'modules.user.controllers.*' . On this page, a generated "switch language" link to "fr" language appears as '/fr/user/user/auth/login'. A kludge workaround I am using as a temporary workaround is to make sure the passed 'url' $params has a preceding '/': //code snippet used in layouts/main.php to generate a 'switch language' link which is then passed to the menu used across the top of the page: $route = $app->controller->route;
$languages = $app->request->languages;
$language = $app->language;
$params = $_GET;
array_unshift($params, $route);
$langLinks = array();
foreach ($languages as $lang) {
/* we don't want to display a language link
* for the currently specified language
*/
if ($lang === $language) {
continue;
}
/* if page is being loaded without a specified language
* then the app loads the default language: "en_us"
* and we don't want to display an "English" link
*/
if ($language == 'en_us' && $lang == 'en') {
continue;
}
$params['language'] = $lang;
if (isset($params[0]) && $params[0]{1} !== '/') {
//@todo determine why a preceding '/' is needed for urls that reference modules
//otherwise the controller part of the url path is repeated
$cParam = substr($params[0], 0, strpos($params[0], '/'));
if (isset(Yii::app()->modules) && isset(Yii::app()->modules[$cParam])) {
//comment the next line to view the "repeated module controller name in the url"
$params[0] = '/' . $params[0];
//create static urls to be at the root path
}
//$langLinks will be passed as one of an array of menuItems to a 'zii.widgets.CMenu'
array_push($langLinks, array('label' => $app->params['languageLabels'][$lang], 'url' => $params));
} |
Hy!
LocaleUrlManager print out 'controller''controller' before render html why?
If url is:
http://z3us.sytes.net/videos (error displayed)
If i use this url everything okay:
http://z3us.sytes.net/videos/index
The text was updated successfully, but these errors were encountered: