user975582
user975582

Reputation: 205

adding a view just with static data

I have a cake php application and 4 or 5 pages contain static pages in .php, I have also built some controllers/models and views for those pages that need to be dynamic. My question is.. Can I have a view just with static code there and call it something like

http://myweb.com/app/someemptycontroller/staticview/

Can this be done and if so how do i need to set it up in terms of model and controller..(maybe empty) i am not sure as I am a newbie in this cake php world.

Thank you

Upvotes: 0

Views: 171

Answers (1)

SomeGuy
SomeGuy

Reputation: 124

CakePHP comes with a working pages controller, which can be used to serve up static pages.

Any view you place in /app/views/pages can be accessed like (say your view is hello.ctp):

http://myweb.com/pages/hello

If you don't like the pages controller showing in the URL, add a line like this to your app/config/routes.php file:

Router::connect('/hello', array('controller' => 'pages', 'action' => 'display','hello'));

Now your page can be accessed by:

http://myweb.com/hello

Upvotes: 1

Related Questions