Location: PHPKode > projects > Mac's MVC Framework > Application/plugins/CMS/views/common/comments.php
<?php
  $html = '
    <style type="text/css">
      table.comments {
        padding: 5px;
        border: 1px solid #CCCCCC;
        margin-top: 10px;
      }

      table.comments td {
        padding-bottom: 10px;
      }
    </style>';


  $html .='<div id="viewComments">';

  if( count($comments) > 0 )
    $html .= '<h3>View Comments Below:</h3>';

  require_once 'libs/standalone/Pagination.php';
  $pagination = new Pagination('comments', 6);

  $pagenationIndex = 0;

  if( Get::isExists('pageIndex') )
    $pagenationIndex = Get::getByKey('pageIndex');

  $pagination->setResults($comments);
  $results = $pagination->getResultsByPageIndex($pagenationIndex);

  foreach ($results as $index=>$comment)
  {
    $moderationTools = '';
    if($isAdminLoggedIn)
    {
      $moderationTools = "
          <div class='adminTools'>
            <a href='{siteURL}{currentController}/{adminFunction}/deleteComment/?commentId=$comment->ID' class='ajax' ajaxOutput='#moderationDetails$index'>Delete Comment</a>
        ";

      if( isset($enableCommentModeration) && ($enableCommentModeration) && (!$comment->ShowOnSite))
      {
        $moderationTools .= "
                <a href='{siteURL}{currentController}/{adminFunction}/allowComment/?commentId=$comment->ID' class='ajax' ajaxOutput='#moderationDetails$index'>Allow Comment</a>
          ";
      }

      $moderationTools .= "              
              <div class='moderationDetails' id='moderationDetails$index'></div>
          </div>
        ";
    }

    $html .= "      
      <div class='comment".(($comment->IsAdminComment)? ' adminComment':'')."'>
        <div class='header'>
          $moderationTools
          <strong>Posted By:</strong> $comment->VisitorName <strong>On</strong> ".date('F j, Y, g:i a',$comment->CreatedOn)."<br />
          <strong>Subject:</strong> $comment->Subject<br />
          <strong>URL:</strong> <a href='$comment->URL' target='_blank'>$comment->URL</a><br />
        </div>
        <div class='body'>
          $comment->Comment
        </div>
      </div>";
  }
  
  $html .= $pagination->renderNav($pagenationIndex, 'ajax', '#viewComments','{siteURL}{currentController}/{adminFunction}/getComments/','controller={currentController}&function={currentFunction}');
  $html .= '</div>';

  echo $html;
?>
Return current item: Mac's MVC Framework