function post_link($post) { $type = array_search($post['type'], blog_types()); $alias = form_prep(nice_title($post['title'])); return site_url('blog/show/' . $post['id'] . '-' . $alias . '.html'); }
/** * Shows last comments in the right Sidebar * * @param type $limit * @return type */ function last_comments_widget($limit = 10) { CI()->load->model('comment'); $comments = CI()->comment->order_by('added_at', 'DESC')->find(NULL, $limit); if (empty($comments)) { return; } foreach ($comments as $c) { $type = array_search($c['type'], blog_types()); // now we have got 'news' key $alias = nice_title($c['title']); $c['post_url'] = site_url('blog/' . $type . '/' . $c['post_id'] . '/' . $alias . '.html#com' . $c['id']); ?> <div> <?php echo anchor($c['post_url'], $c['title']); ?> <br/><span class="author">Написал: <a href="<?php echo site_url('user/profile/' . $c['login']); ?> "><?php echo $c['login']; ?> </a></span> </div> <?php } }