Thanks, that changed my view on things.

/packages works fine.
I now set cake to use admin routing.
/admin/packages works too, but not the scaffold and layout

My PackagesController looks like this

<?php
class PackagesController extends AppController {
        var $name = 'Packages';

   function admin_index() {
        $this->scaffold= true;
                $this->layout= 'scaffolding';
                $this->checkSession();
                $this->set('packages',$this->Package->findAll());

   }

   function index() {
        $this->set('packages',$this->Package->findAll());
   }
}
?>

How do I set scaffold and a specific layout for controller actions
individually?

On 15 jan, 23:42, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
On Jan 15, 2007, at 3:16 PM, sentel wrote:





> Hi All,

> first, I'm a bit of a newby to cakephp, but already loving it.

> I made some models, associations, controllers etc and I'm still using
> scaffolding (suites for now) to manage the contents of the database.
> Then I made some pages wich soon became something like a website.

> I came across a problem: How to pass data from the database (using the
> models) to the pagescontroller.

> I'm almost sure that there has to be a simple way to do that.
> At the moment I used the following as a solution:

> I created a basic page model and copied the pages controller from the
> lib/controllers directory to my own controllers directory. In the
> pages
> controller I made var $uses = array('Package') ... (the model I
> want to
> use) and then $this->set('packages',$this->Package->findAll());

> Now I can use the data from the Package model.

> Is this the way or is there a standard way to do this?Usually the 
PagesController is used only for static content delivery.

That said, you've just created a controller with models tied to a
view... something that everyone should do all the time.

> Another way could be to extend the PagesController, but what name
> should I give it and in what file does that go. That way I can avoid
> copying the pages_controller file.Just create your own PackagesController, 
that already has access to
the Package model.

-- John


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to