Your Author model needs to be related to Post model - Author hasMany Post
and then
$this->set('author', $this->Author->read(null, $id));
Do a debug on your author array in your view and figure out what is
happening :-)
Cheers
Tarique
On Tue, Feb 1, 2011 at 3:49 AM, Hill180 <[email protected]> wrote:
> I am sorry for the basic question.. but here goes.
>
> I will use Blog Posts as an Example
>
> I have the following models:
>
> Author
> Post
> Tags
>
> All the associations are fine as the scaffold pages are working
> without a problem.
>
> I have a page under the Author Controller the standard view:
>
> function view($id = null) {
> if (!$id) {
> $this->Session->setFlash(__('Invalid Author',
> true));
> $this->redirect(array('action' => 'index'));
> }
> $this->set('author', $this->Post->read(null, $id))
> }
>
> In my view.ctp
>
> I want to show the author, all his/her posts and individual tags.
>
> I can easily show all the posts, but how do I get the individual tags?
>
> IE:
>
> echo $author->['Author']['name']; //good
>
> foreach ($author['Post'] as $post):
> print_r(post); //good
>
> How would I get all the tags for that specific post?
>
>
> Goal:
> Open http://localhost/authors/view/3
>
> AUTHOR: DUDE #3
> Post 5 - Tags (OPEN, IT)
> Post 10 - Tags (IT)
> Post 11 - Tags (Open)
>
> Thanks!
>
> --
> 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]<cake-php%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/cake-php
>
--
=============================================================
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=============================================================
--
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