Hi Pierre,
The call to pr($data) is in your controller, which doesn't have access
the the variable $data which was defined inside the component call. To
check from the controller you would need to do
pr ($this->_viewVars["NameOfVariable"]);
However: Is the code you pasted for $recentpapers in a view, or in an
element? the error message originally posted is from an element
(elements\papers\recent_papers.thtml)?
If it's in an element, it's necessary to pass variables to it such as
this:
<?php echo $this->renderElement('papers\recent_papers',$params); ?>
If the variable is set in the component (which is should be looking at
the code) and the element is called correctly (or the code is in the
view) all should be working..
Cheers,
AD7six
PS. If you write your component like this, you don't need any code in
your controller:
function startup (&$controller) {
$this->controller = &$controller;
$Paper= new Paper;
$data = $Paper->findAll(
null,
null,
'Paper.modified DESC',
5
);
$this->controller->set('recentpapers',$data);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---