CakePHP 1.2.x, PHP 5.1.4, Postgres8.1
I've a controller for an archive for which i need to make the default
view display the data for the present month. The "view" action
displays certain data given a date (for clarity's sake, i'll call my
"view" action "foo" here):
Everything aside from the displayed data is the same whether
requesting a particular month or the default. The archive navigation
is provided by an element included into the view. Consequently, I
thought that I should simply call foo() from the index action in the
controller:
function foo($publish_date = null)
{
$publish_date = !is_null($publish_date)
? $publish_date :
(isset($this->params['publish_date'])
? $this->params['publish_date'] : date('Y-M'));
}
function index()
{
$this->foo(date('Y-M'));
}
Unfortunately, it seems that the view is chosen immediately upon
making the controller request. Because there is no index.ctp I'm
getting the "Missing View" error.
I found some advice online to add the following to my index action:
$this->view = 'foo';
But this just results in an error because cake cannot find the fooView
class, so I think this not what I'm searching for.
Is there any way I can do this without copying foo.ctp to index.ctp?
This isn't a question of making this an element, nor a layout (neither
of those options seems at all correct). If I have to make a copy then
so be it but it seems a poor solution. Is there another way to deal
with this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---