See if any of these don't print at all of if they print something you
are not expecting.
debug(App::Import('Model', 'Category'));
debug($category = new Category());
debug($categories = $category->findAll());
they should print something like:
1
Category Object
{
...
array(... lots of data here..,
Come to think of it... you don't have debug set to 0, right? Just
checking.
To save yourself the trouble of instantiating the Model, why don't you
have it defined in $uses?
The loss in performance will be so small you wont need to worry about
it... ever, probably.
/Martin
On Oct 21, 8:59 am, BillBris <[EMAIL PROTECTED]> wrote:
> I've found the below to be true in both version 1.2 RC2 and RC3.
>
> I have a simple controller Home that has $uses = null, as it does not
> have any data associated with the page (It's a home page and very
> boring right now).
>
> In order to get some data into the view from another model (Category),
> I am using the following (and dull) code in the file /controllers/
> home_controller:
>
> function index()
> {
> App::Import('Model', 'Category');
> $category = new Category();
> $categories = $category->findAll();
>
> }
>
> I have a simple ctp file: home/index.ctp that has static text within
> it.
>
> When the index function is empty (no code between the braces), the
> static page appears correctly.
> When the code is in place, nothing appears in the browser.
>
> I have commented out everything except the first line (App::Import),
> and everything is fine.
> When the first two lines are uncommented, I get the blank page again,
> so it seems as if there is something going on in the object
> instantiation.
>
> Based on what I read, I can't figure out what I've done wrong. I'm
> simply attempting to get data from the table 'categories' into the
> controller so I can pass them on to the home/index page.
>
> Any and all help will be appreciated.
>
> Thanks in advance,
> B.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---