コード例 #1
0
 public function listAction()
 {
     $this->tplVars['page_js'][] = 'comments.js';
     $this->tplVars['header']['actions']['names'][] = array('name' => 'add', 'menu_name' => 'Add Comment');
     array_push($this->viewIncludes, 'comments/commentsList.tpl');
     $comments = new CommentsModel();
     /*        
             if($this->_hasParam('order')){
                 $order = array($this->_getParam('order'));
             }
     */
     $this->tplVars['comments'] = $comments->getComments();
     $hostname = $this->getNCSiteHostname();
     foreach ($this->tplVars['comments'] as $key => $comment) {
         foreach ($comment['comments'] as $key2 => $comment2) {
             $pages = array();
             $string = '';
             if (strlen($comment2['comment_pages']) > 1) {
                 $pages = explode(',', $comment2['comment_pages']);
                 foreach ($pages as $page) {
                     $string .= "<a href=\"http://{$hostname}{$page}\" target=\"_blank\">{$page}</a>, ";
                 }
                 if (strlen($string)) {
                     $string = substr($string, 0, -2);
                 }
                 $this->tplVars['comments'][$key]['comments'][$key2]['comment_pages'] = $string;
             }
         }
     }
     unset($comments);
 }