Change your last line to:
$this->set(compact('allposts', 'someposts'));
The variables inside the single quotes are available as like named variables in
the view ($allposts and $someposts);
Jeremy Burns
Class Outfit
http://www.classoutfit.com
On 25 Apr 2012, at 11:38:18, Ivo Wolgensinger wrote:
> Hi
>
> I have in my Model something like this:
> ---------------------
> public function getAllPosts()
> {
> return $this->find('all', array('contain' => FALSE, 'fields'
> => array('id','title','created',),));
> }
>
> public function getSomePosts()
> {
> return $this->find('all', array('contain' =>
> FALSE,'conditions' => array('Post.user_id' => $authorId), 'fields' =>
> array('id','title','created',),));
> }
> ---------------------
> My Controller shows something like this:
> ---------------------
> public function index()
> {
> $authorId = $this->Auth->user('id');
> $allposts = $this->Post->getAuthorPosts($authorId);
> $someposts = $this->Post->getAllPosts();
> $this->set(compact('allposts'));
> $this->set(compact('someposts'));
> }
> ---------------------
>
> How do I access the two different arrays in the view?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php