when fetch articles and comments i use this function

 function view($id=null) {


    $article = $this->Article->findById($id);
       $comment = $this->Article->Comment->find('all',
        array('conditions' =>
array('Comment.article_id' => $id, 'Comment.status' => 1)));



          $this->set(compact('article','comment'));
}

and it is work good ,,but when try to change article find statment to
  $article = $this->Article->find('all',
        array('conditions' =>
array('Article.id' => $id, 'Article.status' => 1)));

i see this error

Notice (8): Undefined index: Article [APP\views\articles\view.ctp,
line 7]

Content:

    Notice (8): Undefined index: Article [APP\views\articles\view.ctp,
line 12]

Created

    Notice (8): Undefined index: Article [APP\views\articles\view.ctp,
line 16]

Notice (8): Undefined index: Article [APP\views\articles\view.ctp,
line 57]

the view file like this

<div class="formats view">



<h2>Title: <?php echo $article['Article']['title']; ?></h2>



                <dt>Content:</dt>
        <dd><?php echo strip_tags($article['Article']['content']) ; ?
></dd>


        <dt>Created</dt>
        <dd><?php echo substr($article['Article']['created'], 0, 15); ?
></dd>

-- 
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

Reply via email to