By default, if you just follow the previous guide to integrate feed service. There will be the simple layout as below:
!https://docs.phpfox.com/download/attachments/851993/todolist-like.png?api=v2
And if you want your feed to become more detail and visual, let's follow these below step
<?php namespace Apps\Books\TodoList; class Feed extends \Phpfox_Component { public function process() { return "block"; } } |
Register that block in start.php:
$module->addComponentNames('block', [ 'todo.feed' => Block\Feed::class, ]) |
$aReturn = array_merge([ 'feed_title' => $aItem['name'], 'privacy' => $aItem['privacy'], 'feed_info' => _p('post_new_to_do'), 'feed_link' => Phpfox::permalink('to-do-list.view', $aItem['task_id'], $aItem['name']), 'feed_content' => $aItem['name'], 'total_comment' => $aItem['total_comment'], 'feed_total_like' => $aItem['total_like'], 'feed_is_liked' => $isLiked, 'feed_icon' => '', 'time_stamp' => $aRow['time_stamp'], 'enable_like' => true, 'comment_type_id' => 'todo', 'like_type_id' => 'todo', 'custom_data_cache' => $aRow, 'load_block' => 'block.feed', //add this line ], $aRow); //Assign todo information to template file: \Phpfox_Template::instance()->assign( [ 'aItem' => $aItem, ]); return $aReturn; |
<div class="feed-share-content" style="display: table"> <a href="{permalink module='todo.view' id=$aItem.task_id title=$aItem.name}"><h3>{$aItem.name}</h3></a> <p>{$aItem.description|clean|shorten:'15':'View More':true|split:30}</p> </div> |
If anything will be working correctly, you will see this super-cool feed with more information after reloading page:
!images/https://docs.phpfox.com/download/attachments/851993/todolist-feed2.png?api=v2