Question

I'm trying to add a way for members to comment on articles. From what I have gathered, it should be as simple as using:

<?php echo $this->content()->renderWidget('modulename.widget-name') ?>

So this is my attempt in my view:

<div>

<?php
echo("<h2>".$this->news['title']."</h2>");

print_r($this->news['news']);

echo $this->content()->renderWidget('core.comment')

?>   

</div>

I only seem to get an empty <div> tag at the bottom of my page.

Does anyone know what I am doing wrong?

Edit: works for 'core.admin-dashboard' but not 'core.comment'. Why is this?

Was it helpful?

Solution

Widget core.comment will appear only if the page where you're placing this widget has subject and there is methods 'comments' and 'likes' for this subject:

if( !($subject instanceof Core_Model_Item_Abstract) ||
    !$subject->getIdentity() ||
    (!method_exists($subject, 'comments') && !method_exists($subject, 'likes')) ) {
  return $this->setNoRender();
}

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top