It's simple enough: Put any static pages in app/views/pages. :) If you put about.ctp in there, you can visit your_site/about and *it just works* - no need to route anything. And, yes: you can have model-less controllers. It's easy, too: just be sure to use no model in the controller, like this: var $uses = array(); And that's it.
Just take it easy, after a while you'll grow to like CakePhp - any framework (of any significance) has a learning curve. Views are only optional if you don't intend to render anything.. On Oct 22, 10:26 pm, kamiseq <[email protected]> wrote: > can somebody clarify this things to me, cos I started to develop my > site and Im so confused now. > > 1)I copied pages_controller to my app/controllers/ and added index() > and about() method and added index.ctp layout to app/view/layouts (and > changed in app/config/routes.php - Router::connect('/', array > ('controller' => 'pages', 'action' => 'index', 'index')); ) > > so going to my root in www, everything is fine. layout is displayed. > but now when I go to host.com/about (host.com/about.html or whatever) > I see error page telling me that about_controller is not found. from > documentation Im getting that default > routeshttp://example.com/controller/action/param1/param2/param3to > controller:action(param1,..) so why now Im getting the error like > this, or should I add some routing to handle situation like above, > > so my question is should I every time route cake with every link I > create or can I stay with defaults but should start thinking in some > way. in another words how cake knows that url part refers to > controller or action. in genral what I need for now are links like > that > > page.com/ > page.com/about > page.com/products > page.com/products/product1 > > so I thought that ill create pages_controller:index()/about() and > products_controller:index()/product1 or again products1_controller if > needed. > > 2) If I create abouts_controller and put it into app/controllers/ I > will be notified that I dont have table in my db that maps to about. > but what if I dont want to get data from db? even though I created > empty model about.ctp the problem still persist. I tried to $this- > > >loadModel('); but no luck. > > second question is how to avoid models to be persisted from db or is > that only pages_controller for static (no db) pages. > > and third as I assume views are totally optional cos they always > render within used layout and this can be totally static and this > doesnt implies errors that Im getting?? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
