Example #1
0
 /**
  * Displays the realblog topics with a link to the blog page from the template.
  *
  * A page calling #cmsimple $output.=showrealblog();# must exist.
  * Options: realblog_page [required] : this is the page containing the
  *          showrealblog() function
  *
  * @param mixed $pageUrl A URL of a page where the blog is shown.
  *
  * @return string (X)HTML.
  *
  * @global array  The URLs of the pages.
  * @global array  The configuration of the plugins.
  * @global array  The localization of the plugins.
  */
 public function link($pageUrl)
 {
     global $u, $plugin_cf, $plugin_tx;
     if (!in_array($pageUrl, $u)) {
         return '';
     }
     if ($plugin_cf['realblog']['links_visible'] <= 0) {
         return '';
     }
     $html = '<p class="realbloglink">' . $plugin_tx['realblog']['links_visible_text'] . '</p>';
     $articles = Realblog_Article::findArticles(1);
     if (!empty($articles)) {
         $articles = array_slice($articles, 0, $plugin_cf['realblog']['links_visible']);
         $html .= '<div class="realblog_tpl_show_box">';
         foreach ($articles as $article) {
             $html .= $this->renderArticleLink($article, $pageUrl);
         }
         $html .= '<div style="clear: both;"></div></div>';
     } else {
         $html .= $plugin_tx['realblog']['no_topics'];
     }
     return $html;
 }