Ok dans ma vue je récupère les comment
Ok ça me sort un tableau très propre, ce qui me gène est comment je réupère les donners dans ma vue?
'Comment' => array(
'id' => '1',
'username' => 'MusicalityMaker',
'mail' => 'marc@mail.com',
'content' => 'Je suis le premier commentaire',
'ref' => 'Post',
'ref_id' => '1',
'ip' => '192.168.56.1',
'created' => '2014-12-17 20:32:53',
'url' => 'http://local.dev/MusicalityMaker/blog/mon-premier-article',
'parent_id' => '0',
'user_id' => '1',
'spam' => '0',
(int) 0 => array(
'id' => '2',
'username' => 'MusicalityMaker',
'mail' => 'marc@mail.com',
'content' => 'Une réponse',
'ref' => 'Post',
'ref_id' => '1',
'ip' => '192.168.56.1',
'created' => '2014-12-17 20:33:07',
'url' => 'http://local.dev/MusicalityMaker/blog/mon-premier-article',
'parent_id' => '1',
'user_id' => '1',
'spam' => '0',
'User' => array(
'id' => '1',
'username' => 'MusicalityMaker',
'mail' => 'marc@mail.com',
'thumb' => '/img/uploads/users/avatars/1/1.png'
)
),
Il y a un (int) 0 => array() dans le tableau Comment
Je fait ça dans ma vue :
Jr fait ça pour réupéré les commentaire
<?php foreach($comments as $comment): ?>
<?php foreach($comments as $comment): ?>
Pour répéré les commentaire enfant :
<?php foreach($comment['Comment'] as $children): ?>
<?php endforeach; ?>
Il me retourne une erreur :
Illegal string offet suivie du nom du champ.