1234567891011121314151617181920212223242526 |
- <?php
- class BlogNav implements INavigationController{
- private $_uri;
-
- public function __construct() {
- $this->_uri=new URI("Blog","/blog","/images/blog.svg");
- }
-
- public function GetItems() {
- $repo=new BlogPostRepository();
- $posts=$repo->GetLatest(5);
- $links=array();
- foreach ($posts as $post){
- $title=$post->PostTitle;
- if (strlen($title)>50)
- $title=substr($title,0,47).'...';
- $links[]=new URI($title, "view/".$post->PostUrl);
- }
- $links[]=new URI("<i>View all</i>","");
- return $links;
- }
- public function GetURI() {
- return $this->_uri;
- }
- }
|