sheraz.s
(Sheraz S)
October 8, 2013, 12:12pm
1
Hi, i am new to YII. I am using ROUTING. Now the problem is that controller is not rendering the view without View directory name.
Here is the code
$this->render('users/signup', array('model'=>$model));
If i don’t embed directory name then it gives me error
"exception ‘CException’ with message 'SiteController cannot find the
requested view “signin-popup”.’ in
D:\wamp\www\MyApp\yii\framework\web\CController.php:878"
please guide me what wrong with it.?
zaccaria
(Matteo Falsitta)
October 8, 2013, 12:21pm
2
The view for site controller should be placed in views/site.
Do you have a view named signin-popup in views/site?
sheraz.s
(Sheraz S)
October 8, 2013, 12:47pm
3
yes it is in the directory. The problem is , if i mention "directory/file" then it loads view. Whereas if i only user view name then it generates error which is a default behavior of YII.
zaccaria
(Matteo Falsitta)
October 8, 2013, 1:50pm
4
What do you mean for ROUTING?
outrage
(Site Sense Web)
October 8, 2013, 4:27pm
5
First make sure you have following structure:
[protected]
[controllers]
SiteController.php
AnotherController.php
[views]
[site]
someview.php
[another]
someview.php
If you have that kind of structure we need to see your url rules.
sheraz.s
(Sheraz S)
October 9, 2013, 5:41am
6
outrage:
First make sure you have following structure:
[protected]
[controllers]
SiteController.php
AnotherController.php
[views]
[site]
someview.php
[another]
someview.php
If you have that kind of structure we need to see your url rules.
I am following the same structure. But i have created a Theme instead of creating views in protected directory.
sheraz.s
(Sheraz S)
October 9, 2013, 5:52am
7
I think the issue is URL.
What i am trying to do is: When a user will complete membership form and login to site, then the url will be followed by his name.
www.MyApp.com/John
www.MyApp.com/sheraz
Now the content displaying on that URL will be related to this URL. When a user will visit www.myapp.com/john , he fill registeration form, visit or buy some products then the URL will be like this.
What i have done is that after user login, i have set the baseURL from
www.myapp.com
TO
www.myapp.com/john
I think that is the reason that yii can’t find views?
if you think there is any other way to do this, please guide me?
zaccaria
(Matteo Falsitta)
October 9, 2013, 6:16am
8
The two issues are unrelated, if you don’t find the views has no relations with routing.
The view will be searched under the controllerId folder regardless the url.