On Dec 27, 2007 2:06 PM, Pablo Viojo <[EMAIL PROTECTED]> wrote:
> Try:
>
> $this->autoRender=false;
> $this->render('foo');
>
> in your controller action
>
> Also, see the render definition[1]
>
>
>
Ah, autoRender--forgot about that. But I want to pass a parameter to the
view action from the index action (I'm using a route to do this when calling
the view action directly). So I thought I could do away with passing a param
and instead set a var within the controller class. Unfortunately, this is
causing much breakage:
My routes:
Router::connect('/newsletter/', array('controller' => 'newsletters',
'action' => 'index'));
Router::connect('/newsletter/:publish_date',
array('controller' => 'newsletters', 'action' => 'view'),
array('publish_date' => '[0-9]{4}-[0-9]{2}')
);
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.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---