如何将评论添加到以前没有可用的Socialengine页面?

时间:2012-08-18 03:17:13

标签: php zend-framework module socialengine

我已经为为Socialengine平台提供的宠物插件制作了一些实质性的mod(与显示相关),并且需要在讨论区域的帖子中添加评论。我一直试图做到这一点,到目前为止还有这个项目:

 <a name="comments"></a>
<?php echo $this->action("list", "comment", "core", array("type"=>$object->getType(),"id"=>$object->getIdentity())) ?> 

甚至不会在页面上运行(打破显示并输出无数据)。我希望这会显示一个框,可以从项目中获取所需的数据,并使用petid,topicid和userid创建存储在engine4_core_comments中的注释。只需要在页面上获得某种评论功能,如果您有使用此类功能的经验,任何事情都会真正发挥作用。

这是完整的view.tpl页面:

<?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 &#187; 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]\n' + body + '[/blockquote]\n\n';
    $("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; ?>

谢谢!

1 个答案:

答案 0 :(得分:1)

在最新版本的SocialEngine中,布局管理器中有一个Comment窗口小部件。您可以尝试使用它。