I've made some substantial mods (related to display) to the pets plugin offered for the Socialengine platform, and need comments added to the posts in the discussions area. I've been trying to accomplish this and thus far have this item:
<a name="comments"></a>
<?php echo $this->action("list", "comment", "core", array("type"=>$object->getType(),"id"=>$object->getIdentity())) ?>
Which won't even run on the page (breaks the display and outputs no data). I was hoping that would display a box that would grab the needed data from the item and use the petid, topicid, and userid in creating a comment stored in engine4_core_comments. Just need to get some kind of commenting functionality going on the page, anything will do really if you have experience with this type of functionality.
Here is the full view.tpl page:
<?php
/**
* Radcodes - SocialEngine Module
*
* @category Application_Extensions
* @package Pet
* @copyright Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
* @license http://www.radcodes.com/license/
* @version $Id$
* @author Vincent Van <vincent@radcodes.com>
*/
?>
<h2>
<?php echo $this->translate("%s » Discussions", $this->pet->__toString())?>
</h2>
<h3>
<?php echo $this->topic->getTitle() ?>
</h3>
<?php $this->placeholder('pettopicnavi')->captureStart(); ?>
<div class="pet_discussions_thread_options">
<?php echo $this->htmlLink(array('route' => 'pet_extended', 'controller' => 'topic', 'action' => 'index', 'pet_id' => $this->pet->getIdentity()), $this->translate('Back to Topics'), array(
'class' => 'buttonlink icon_back'
)) ?>
<?php if( $this->form ): ?>
<?php echo $this->htmlLink($this->url(array()) . '#reply', $this->translate('Post Reply'), array(
'class' => 'buttonlink icon_pet_post_reply'
)) ?>
<?php endif; ?>
<?php if( $this->can_edit): ?>
<?php if( !$this->topic->sticky ): ?>
<?php echo $this->htmlLink(array('action' => 'sticky', 'sticky' => '1', 'reset' => false), $this->translate('Make Sticky'), array(
'class' => 'buttonlink icon_pet_post_stick'
)) ?>
<?php else: ?>
<?php echo $this->htmlLink(array('action' => 'sticky', 'sticky' => '0', 'reset' => false), $this->translate('Remove Sticky'), array(
'class' => 'buttonlink icon_pet_post_unstick'
)) ?>
<?php endif; ?>
<?php if( !$this->topic->closed ): ?>
<?php echo $this->htmlLink(array('action' => 'close', 'close' => '1', 'reset' => false), $this->translate('Close'), array(
'class' => 'buttonlink icon_pet_post_close'
)) ?>
<?php else: ?>
<?php echo $this->htmlLink(array('action' => 'close', 'close' => '0', 'reset' => false), $this->translate('Open'), array(
'class' => 'buttonlink icon_pet_post_open'
)) ?>
<?php endif; ?>
<?php echo $this->htmlLink(array('action' => 'rename', 'reset' => false), $this->translate('Rename'), array(
'class' => 'buttonlink smoothbox icon_pet_post_rename'
)) ?>
<?php echo $this->htmlLink(array('action' => 'delete', 'reset' => false), $this->translate('Delete'), array(
'class' => 'buttonlink smoothbox icon_pet_post_delete'
)) ?>
<?php elseif( !$this->can_edit): ?>
<?php if( $this->topic->closed ): ?>
<div class="pet_discussions_thread_options_closed">
<?php echo $this->translate('This topic has been closed.')?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php $this->placeholder('pettopicnavi')->captureEnd(); ?>
<?php echo $this->placeholder('pettopicnavi') ?>
<?php echo $this->paginationControl(null, null, null, array(
'params' => array(
'post_id' => null // Remove post id
)
)) ?>
<script type="text/javascript">
var quotePost = function(user, href, body)
{
$("body").value = '[blockquote]' + '[b][url=' + href + ']' + user + '[/url] said:[/b]
' + body + '[/blockquote]
';
$("body").focus();
$("body").scrollTo(0, $("body").getScrollSize().y);
}
</script>
<ul class='pet_discussions_thread'>
<?php foreach( $this->paginator as $post ): ?>
<li>
<div class="pet_discussions_thread_photo">
<?php
$user = $this->item('user', $post->user_id);
echo $this->htmlLink($user->getHref(), $user->getTitle());
echo $this->htmlLink($user->getHref(), $this->itemPhoto($user, 'thumb.icon'));
?>
</div>
<div class="pet_discussions_thread_info">
<div class="pet_discussions_thread_details">
<div class="pet_discussions_thread_details_options">
<?php if( $this->form ): ?>
<?php echo $this->htmlLink('javascript:void(0);', $this->translate('Quote'), array(
'class' => 'buttonlink icon_pet_post_quote',
'onclick' => 'quotePost("'.$this->escape($user->getTitle()).'", "'.$this->escape($user->getHref()).'", "'.$this->string()->escapeJavascript($post->body).'");'
)) ?>
<?php endif; ?>
<?php if( $post->user_id == $this->viewer()->getIdentity() || $this->pet->getOwner()->getIdentity() == $this->viewer()->getIdentity() ): ?>
<?php echo $this->htmlLink(array('route' => 'pet_extended', 'controller' => 'post', 'action' => 'edit', 'post_id' => $post->getIdentity(), 'format' => 'smoothbox'), $this->translate('Edit'), array(
'class' => 'buttonlink smoothbox icon_pet_post_edit'
)) ?>
<?php echo $this->htmlLink(array('route' => 'pet_extended', 'controller' => 'post', 'action' => 'delete', 'post_id' => $post->getIdentity(), 'format' => 'smoothbox'), $this->translate('Delete'), array(
'class' => 'buttonlink smoothbox icon_pet_post_delete'
)) ?>
<?php endif; ?>
</div>
<div class="pet_discussions_thread_details_date">
<?php echo $this->timestamp(strtotime($post->creation_date)) ?>
</div>
</div>
<div class="pet_discussions_thread_body">
<?php echo nl2br($this->BBCode($post->body)) ?>
</div>
</div>
</li>
<?php endforeach; ?>
<?php if($this->paginator->getCurrentItemCount() > 4): ?>
<?php echo $this->paginationControl(null, null, null, array(
'params' => array(
'post_id' => null // Remove post id
)
)) ?>
<br />
<?php echo $this->placeholder('pettopicnavi') ?>
<?php endif; ?>
<br />
<?php if( $this->form ): ?>
<a name="reply" />
<?php echo $this->form->setAttrib('id', 'pet_topic_reply')->render($this) ?>
<?php endif; ?>
Thanks!