...
Create php class RecentItems under directory ./PF.Site/Apps/TodoList/Block/
paste Paste following code
Code Block | ||||
---|---|---|---|---|
| ||||
<?php
namespace Apps\TodoList\Block;
// RecentMembers block must be a child of \Phpfox_Components
//
class RecentItems extends \Phpfox_Component
{
// this method will be invoked by phpfox
public function process()
{
// assign variables to template
$this->template()
->assign([
'sHeader' => 'Recent Items', // block title
'aItems' => ['Item 1', 'Item 2', 'Item 3'],
]);
return 'block';
}
}
|
...
Update Install.php, change setComponent() and setComponentBlock()
Code Block | ||||
---|---|---|---|---|
| ||||
protected function setComponent()
{
$this->component = [
"block" => [
"recent_items" => "",
],
"controller" => [
"index" => "todo.index",
]
];
}
protected function setComponentBlock()
{
$this->component_block = [
"Recent Items" => [
"type_id" => "0",
"m_connection" => "todo.index",
"component" => "recent_items",
"location" => "3",
"is_active" => "1",
"ordering" => "1"
],
];
}
|
...