hi guys,... I can't retrieve blog comments on cake 1.3 when it used to work on cake 1.2
can anyone help please,...
I call comments ajax page with remoteFunction,... using jQuery:
<script type="text/javascript">
<?php echo $ajax->remoteFunction(array('url' => array('controller' => 'blog_comments', 'action' => 'ajax_show/','blog_id:'.$blog['Blog']['id']), 'update' => 'comments')); ?>
</script>
which is similar to Prototype call (I used to have on cake 1.2,... and it's working on 1.2):
<script>
new Ajax.Updater("comments", "<?php echo $html->url('/blog_comments/ajax_show/blog_id:' . $blog['Blog']['id']) ?>", { evalScripts:true, onComplete:function() { $("comments_loading").hide() } });
</script>
And this is ajax_show function in blog_comments controller:
function ajax_show()
{
$this->layout = 'ajax';
$id = array_key_exists('blog_id', $this->params['pass']) ? $this->params['pass']['blog_id'] : null;
if(!($blog = $this->Blog->findById($id)))
{
die();
}
else
{
$this->set('url_options', array('blog_id' => $id));
$this->set('blog', $blog);
$this->set('blog_comments', $this->paginate('BlogComment', array('BlogComment.blog_id' => $blog['Blog']['id'] )));
$this->set('offset', ($this->params['paging']['BlogComment']['page'] - 1) * $this->paginate['limit'] + 1);
debug($blog);
debug($blog_comments);
}
}
thanks in advance,
chris
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment