Portlet Tutorial
From PRADO Wiki
What is portlet
Portlet is a template tag that represented a function, widget, code, etc to a simple tag. This can help you to organize your code and easy to understand. Very functional on template system.
How to use it
Here a basic portlet example for represented menu on website. I'm usually write menu on template than write in in portlet. But this is for example for portlet and it's easy to use if you want to display menu on many page:
protected/portlets/menu.tpl
<ul class="h-list right"> <li> <a href="<%=$this->Request->constructUrl('page','admin.home')%>">Dashboard</a> </li> <li> <a href="<%=$this->Request->constructUrl('page','admin.stats')%>">Statisctic</a> </li> <li> <com:TLinkButton OnCommand="logout" Text="Logout"/> </li> </ul>
protected/portlets/menu.php
<?php class menu extends TTemplateControl{ function logout($sender,$param) { $auth=$this->Application->getModule('auth'); $auth->logout(); $this->Response->Redirect($this->Request->constructUrl('page',$auth->LoginPage)); } } ?>
How to include in in template? Is easy like other template tag, just write this template tag anywhere you want to display this menu.
<com:Application.portlets.menu/>
That code is indicated that you put your portlet in protected/porlet directory with filename menu.php and menu.tpl.
This concept very useful if you want to create widget system in your application.

