Resolved. When I made changes I forgot that the route passes the
publish_date in the params array instead of setting the class var directly.
I decided to forget about using a class var since set() is only really meant
(I think) for passing vars to the view.

So, I restored the parameter to the view() method and used the setAction
method from index():

function index()
{
    $this->setAction('view', date('Y-M'));
}

function view($publish_date = null)
{
    $publish_date = !is_null($publish_date)
                    ? $publish_date : (isset($this->params['publish_date'])
                                    ? $this->params['publish_date'] :
date('Y-M'));

    $this->pageTitle = "The Archive: ${publish_date}-01";

    $this->set('newsletter',
$this->Newsletter->findByPublishDate("${publish_date}-01"));
}


As an aside, it took me a little while to figure this part out because I had
caching enabled. Though I'd figured out how to make this work when passing
the date from the route, it still wasn't working when using setAction() (ie.
not passing a date in the URL) I'd checked the cache dir and didn't see a
file "newsletter_2007-12.php" so I'd guessed that the caching mechanism had
refused to kick in because of the errors (and, so, nothing I tried appeared
to be working). However, it turned out that the cached file was, indeed,
right in front of me. Cache names it simply "newsletter.php" because the
date is not there. I removed that and found that setAction() was the answer,
after all. In the end, it makes sense that Cache would go ahead and do its
thing because there were no fatal errors, only notices.

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