From 6e0338629774fffe5fbe7136dfce34ce83844a5c Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 30 May 2006 03:26:33 +0000 Subject: Blog demo is completed. --- demos/blog/protected/Portlets/CategoryPortlet.php | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'demos/blog/protected/Portlets/CategoryPortlet.php') diff --git a/demos/blog/protected/Portlets/CategoryPortlet.php b/demos/blog/protected/Portlets/CategoryPortlet.php index 9c2033aa..e0c417bb 100644 --- a/demos/blog/protected/Portlets/CategoryPortlet.php +++ b/demos/blog/protected/Portlets/CategoryPortlet.php @@ -1,13 +1,36 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ Prado::using('Application.Portlets.Portlet'); +/** + * CategoryPortlet class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ class CategoryPortlet extends Portlet { public function onLoad($param) { parent::onLoad($param); - $this->CategoryList->DataSource=$this->Application->getModule('data')->queryCategories(); + $cats=$this->Application->getModule('data')->queryCategories(); + foreach($cats as $cat) + { + $cat->ID=$this->Service->constructUrl('Posts.ListPost',array('cat'=>$cat->ID)); + $cat->Name.=' (' . $cat->PostCount .')'; + } + $this->CategoryList->DataSource=$cats; $this->CategoryList->dataBind(); } } -- cgit v1.2.3