function article_load_entries($var_name = 'article_entries', $limit = 10, $where = "", $sort = "article_date_start DESC") { global $smarty; $criterias = array("article_approved = '1'", "article_draft = '0'", "article_search= '1'"); if ($where != "") { $criterias[] = $where; } $where = join(' AND ', $criterias); $rc_article = new rc_article(); $article_array = $rc_article->article_list(0, $limit, $sort, $where, 1); foreach ($article_array as $k => $article_entry) { $article_array[$k]['article']->article_info['article_body'] = str_replace("\r\n", "", html_entity_decode($article_entry['article']->article_info['article_body'])); } $smarty->assign($var_name, $article_array); }
$article = new rc_article(); $start = ($p - 1) * $entries_per_page; // GET TOTAL ENTRIES $total_articleentries = $article->article_total($where); //rc_toolkit::debug($total_articleentries,"total_articleentries"); // MAKE ENTRY PAGES $page_vars = make_page($total_articleentries, $entries_per_page, $p); if ($total_articleentries > 0) { // GET ENTRY ARRAY $articleentries = $article->article_list($page_vars[0], $entries_per_page, $sort, $where, 1); } //rc_toolkit::debug($articleentries); // ASSIGN VARIABLES AND SHOW VIEW ENTRIES PAGE $smarty->assign('s', $s); $smarty->assign('d', $d); $smarty->assign('t', $t); $smarty->assign('c', $c); $smarty->assign('o', $o); $smarty->assign('r', $r); $smarty->assign('a', $a); $smarty->assign('f', $f); $smarty->assign('g', $g);
<?php switch ($page) { // CODE FOR PROFILE PAGE case "profile": $entries = array(); $total_entries = 0; if ($owner->level_info[level_article_allow] != 0) { $current_time = time(); // START article $article = new rc_article($owner->user_info[user_id]); $entries_per_page = 5; $sort = "article_date_start DESC"; // GET PRIVACY LEVEL AND SET WHERE $privacy_level = $owner->user_privacy_max($user, $owner->level_info[level_article_privacy]); $where = "(article_privacy<='{$privacy_level}') AND article_approved = '1' AND article_draft = '0'"; // GET TOTAL ENTRIES $total_entries = $article->article_total($where); // GET ENTRY ARRAY $entries = $article->article_list(0, $entries_per_page, $sort, $where, 1); } // ASSIGN ENTRIES SMARY VARIABLE $smarty->assign('article_entries', $entries); $smarty->assign('total_article_entries', $total_entries); break; }
else { $sort = "article_date_start DESC"; $s = 'date'; } $category_info = $rc_articlecats->get_record($articlecat_id); /* rc_toolkit::debug($categories, "CATEGORIES MENU"); rc_toolkit::debug($total_articles, "total_articles"); rc_toolkit::debug($where, "where"); rc_toolkit::debug($sort, "sort"); */ // GET ARTICLES $article_array = $article->article_list($page_vars[0], $articles_per_page, $sort, $where, 1); foreach ($article_array as $k => $article_entry) { $article_array[$k]['article']->article_info['article_body'] = str_replace("\r\n", "",html_entity_decode($article_entry['article']->article_info['article_body'])); } //rc_toolkit::debug($article_array, "article_array"); // POPULAR TAGS $popular_max_tags = 50; $popular_order_tag_by = 'name'; // use 'count' or 'name' $popular_distribution_classes=array(1,3,7,10,16,25,40,50); $popular_tags = $rc_tag->get_popular_tags($popular_max_tags, $popular_order_tag_by, null, $popular_distribution_classes); $smarty->assign('popular_tags', $popular_tags); //rc_toolkit::debug($popular_tags, "popular_tags");