On Dec 27, 2007 4:07 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:

>
> On Dec 27, 2007 3:07 PM, subtropolis zijn <[EMAIL PROTECTED]>
> wrote:
> >
> > My controller:
> >
> >  function index()
> > {
> >     $this->autoRender=false;
> >     $this->set('publish_date', date('Y-M'));
> >     $this->render('view');
> > }
> >
> > function view()
> > {
> >     $this->pageTitle = 'The Archive: ' . $this->publish_date;
> >     $this->set('newsletter',
> > $this->Newsletter->findByPublishDate("{$this->publish_date}-01"));
> > }
> >
> > This is failing miserably because, no matter how I approach it, the
> > $publish_date var is not set. So it seems that I have a fundamental
> > misunderstanding about setting class vars in Cake.
> >
>
> Given that there are lots examples of how to pass data from controller
> to views, it leads me to wonder if you have actually read the manual
> for CakePHP or followed along with some examples because if you saw
> those examples you would immediately understand why what you are
> trying to do will not work.


The Cake documentation is rather limited, IMHO. In any case, if you'd paid
more attention to what I was asking you'd immediately understand why these
replies of yours are off-base.


> If you have read them, my apologies
> because we must've read two totally different sets of documentation.
> Also feel free to check out http://tempdocs.cakephp.org for some Cake
> 1.2 documentation.
>
> As nice as it would be, telling the index() action to use a view
> called 'view' does not mean that the action called 'view' is magically
> run as well.


I'm guessing you haven't read my posts here very carefully at all. To
review: I was calling the view() method from index(). (Yeah, that's pretty
magical, I know, but these are crazy times we live in.) My question was how
to get the controller to use the view for the action I was telling it to use
instead. Perhaps you've been too busy thinking up these zingers to actually
pay attention to what it was I was asking.


> If you want $publish_date to show up in a view (wherever
> that view might be) you need to make sure you do a
> $this->set('publish_date', date('Y-m-d')) in the same action where you
> are doing $this->view('view');


No, that's not at all what I was trying to do. I was, however, trying to use
set() for something it wasn't meant for.

Why?  Because that's the way CakePHP needs you to do it.  To do
> anything else is banging your head against the framework in a most
> uncomfortable way.


Again, please pay more attention to the questions being asked before going
off half-cocked. It makes you look like a dick, you know.

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