开发者

Can't see view in my CakePHP setup

开发者 https://www.devze.com 2023-04-05 23:53 出处:网络
I made a view under /app_root/cakephp/app/views/problems/index.ctp and I am trying to get to a url where I can render it.

I made a view under /app_root/cakephp/app/views/problems/index.ctp and I am trying to get to a url where I can render it.

I also have an index.php at my site's root directory, and for some reason when I try to go to a url like http://www.mysite.com/index.php/problems/index I actually get the co开发者_开发问答ntent from the index.php in the root, and not the view.

How should I set things up, or have the url path so that I can get to a url to see my view?

Here is my problems_controller.php

<?php

class ProblemsController extends AppController
{
    var $helpers = array ('Html','Form');
    var $name = 'Problems';

    function index()
    {
        $this->set('problems', $this->Problem->find('all'));
    }
}
?>


If you could see the www.mysite.com when you installed cake and gave you no warnings or just security warnings you are ok. But if you didn't see it you should start the process again following the steps.

also

http://www.mysite.com/index.php/problems/index

Is NOT a url for a cakephp page the normal way (it may work though)

you should have something like

http://www.mysite.com/problems/index

cakephp url are domain/controller/action

maybe you don't have cake exactly there and have to use something like this

http://www.mysite.com/app/problems/index

OR

http://www.mysite.com/cakephp/app/problems/index

This two are if you copy the folders as the zip you download from the page. the last one may vary the cakephp part to cakephp-version or something like that. if you rename the app folder to something change it accordly. you can simplify this last two urls by doing some configurations ;) remember where you did the test of the cakephp when you install it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号