On 9/13/07, DanielSun <[EMAIL PROTECTED]> wrote:
>
> Meaning I cannot at all make my own view class and I should instead
> use the allready instantiated view object __viewClass? Or should I
> make a new instance of view just for the purpose of rendering layout.

You can create your own view class if required.  Nate is talking about
how to use your custom class.  Here's a code snippet that might help:

* in the controller*

function foo() {
     $this->view = 'bar';
     $this->set('baz', $this->Baz->findAll());
}

This will tell Cake that for this action in the controller, you want
to use your 'bar' class for the view, which you should put in a file
named 'bar.php' that you place in your views directory.  Then you can
pass stuff to it just like it was any other view and Cake will then
execute your custom view for you.  We have used custom views to spit
out images for an internal project at CDC so that you can do things
like <img src=/controller/view/imageId> and have it display the image
you want.

> And therefore I cannot bypass hacking of the core?

Hacking the core is *always* a last resort because 99% of the time it
is done by people who do not understand how CakePHP works internally,
and 1% of the time it's to handle a legitmate problem with the code.
Spend some time learning how to create a custom view (I'm not aware of
any links off the top of my head) and I'm pretty sure that will handle
everything you need.

Hope that helps.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
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