php - Yii1 web application change the language by itself
Get the solution ↓↓↓I'm working on yii1 web application, i will mention my problem in simple way: i have home view page, i have created url as the following :
<a href="<?php echo yii::app()->createUrl('home/Test') ; ?>">link</a>
in my Home controller i have this simple code :
public function actionTest(){
var_dump(Yii::app()->language) ;
exit() ;
}
my project supports two languages Arabic and English, when user change language between Arabic and English , every thing is working fine, layout , language and every thing except the previous code. after user change the language if he click on previous link the result will be EN whatever the language of app, if Arabic or English, after var dumping the language. and please note that every link in the app was created in the same way and it's working fine except this link . why ?
any one can advise me please ?
Answer
Solution:
For problem described above, the problem was in routing. Application in some links doesn't route to the correct controller action. The reason for that was in my project itself . because I have received the project after handing over of another developer so I wasn't know all functions and rules that he used. So the problem was all actions that were not have spcifce role to render on home page,that was making the application routed to default action so it was returned to the default status of course as .httaccess said and give 302 status code as a response . Thank you stack overflow
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: zsh: command not found: php
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.