[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/demos/blog/protected/Portlets/ -> CommentPortlet.php (source)

   1  <?php
   2  /**
   3   * CommentPortlet class file
   4   *
   5   * @author Qiang Xue <qiang.xue@gmail.com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2006 PradoSoft
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: CommentPortlet.php 1397 2006-09-07 07:55:53Z wei $
  10   */
  11  
  12  Prado::using('Application.Portlets.Portlet');
  13  
  14  /**
  15   * CommentPortlet class
  16   *
  17   * @author Qiang Xue <qiang.xue@gmail.com>
  18   * @link http://www.pradosoft.com/
  19   * @copyright Copyright &copy; 2006 PradoSoft
  20   * @license http://www.pradosoft.com/license/
  21   */
  22  class CommentPortlet extends Portlet
  23  {
  24  	public function onLoad($param)
  25      {
  26          parent::onLoad($param);
  27          $commentLimit=TPropertyValue::ensureInteger($this->Application->Parameters['RecentComments']);
  28          $comments=$this->Application->getModule('data')->queryComments('','ORDER BY create_time DESC',"LIMIT $commentLimit");
  29          foreach($comments as $comment)
  30          {
  31              $comment->ID=$this->Service->constructUrl('Posts.ViewPost',array('id'=>$comment->PostID)).'#c'.$comment->ID;
  32              if(strlen($comment->Content)>40)
  33                  $comment->Content=substr($comment->Content,0,40).' ...';
  34          }
  35          $this->CommentList->DataSource=$comments;
  36          $this->CommentList->dataBind();
  37      }
  38  }
  39  
  40  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7