Widgets - ZingPHP/Zing GitHub Wiki
What is a widget?
Not many frameworks (if any) support widgets. But what is a widget in Zing? A widget is an item you can use and place within your page by calling it, passing some optional setting and then some HTML is spit back.
Zing comes with a built in example Calendar Widget that it's basic purpose is to show how a widget is created with the Zing Framework.
class Home extends Zing{
public function main(){
$cal = $this->getWidget("Calendar");
$this->smarty->assign("myCalendar", $cal);
}
}
The calendar widget accepts 3 different options:
dayWhich accepts eithershortorfulland is meant to showMonorMonday,TueorTuesday, etc.zerofillWhich accepts a boolean and is meant to enabled/disable prefixing zeros before days 1-9linkWhich creates a link from a format such%Y-%m-%dfor example
Widgets can be very helpful and can allow you to easily create parts of a webpage that do a particular thing really well, such as creating a Calendar, or a Photo Gallery, or anything really.