function fillArticleList($con) { global $page_title, $page_meta_keywords, $page_meta_description; $result = mysqli_query($con, " SELECT ac.*, at.title, at.url, t1.posted_cnt, unix_timestamp(ac.post_dt) posted_time " . " FROM article_content ac, article_tmpl at," . " (SELECT ac.tmpl_id, MAX(ac.post_dt) max_post_dt, COUNT(1) posted_cnt " . " FROM article_content ac" . " WHERE ac.post_dt < now() GROUP BY ac.tmpl_id) AS t1" . " WHERE ac.tmpl_id = t1.tmpl_id AND at.tmpl_id = ac.tmpl_id AND ac.post_dt = t1.max_post_dt ORDER BY ac.post_dt DESC"); $text; $title; $url; $post_dt; $upd_flg; $atricles = ""; $cur_news_posted_time = ""; $mainUrl = $_SERVER["HTTP_HOST"]; while ($row = mysqli_fetch_array($result)) { global $regionName, $regionNameLatin; $text = $row['text']; $title = $row['title']; $url = $row['url']; $post_dt = $row['posted_time']; $upd_flg = $row['upd_flg']; $updTitle = ""; if ($cur_news_posted_time != engdate($post_dt, 'jS \\of F')) { $cur_news_posted_time = engdate($post_dt, 'jS \\of F'); $atricles = $atricles . "<br/><h3>" . $cur_news_posted_time . "</h3>"; } if ($upd_flg == 1) { $updTitle = "Information updated | "; } $atricles = $atricles . "{$mainUrl}/articles/{$url};" . $title . ";" . engdate($post_dt, 'jS \\of F, h:i:s A') . "\r\n"; /*$atricles = preg_replace("/\[STATE_NAME\]/", $regionName , $atricles); $atricles = preg_replace("/\[STATE_ABBR\]/", $regionName , $atricles);*/ } return $atricles; }
function fillArticleList($con) { global $page_title, $page_meta_keywords, $page_meta_description; $result = mysqli_query($con, " SELECT ac.*, at.title, at.url, t1.posted_cnt, unix_timestamp(ac.post_dt) posted_time " . " FROM article_content ac, article_tmpl at," . " (SELECT ac.tmpl_id, MAX(ac.post_dt) max_post_dt, COUNT(1) posted_cnt " . " FROM article_content ac" . " WHERE ac.post_dt < now() GROUP BY ac.tmpl_id) AS t1" . " WHERE ac.tmpl_id = t1.tmpl_id AND at.tmpl_id = ac.tmpl_id AND ac.post_dt = t1.max_post_dt ORDER BY ac.post_dt DESC"); $title; $url; $post_dt; $atricles = ""; $cur_news_posted_time = ""; $mainUrl = $_SERVER["HTTP_HOST"]; while ($row = mysqli_fetch_array($result)) { global $regionName, $regionNameLatin; $title = $row['title']; $url = $row['url']; $post_dt = $row['posted_time']; $atricles = $atricles . "http://{$mainUrl}/articles/{$url};" . $title . ";" . engdate($post_dt, 'jS \\of F, h:i:s A') . "\r\n"; } return $atricles; }
$template = preg_replace("/\\[CITY_NEWS_1\\]/", "<br/>No any news were found", $template); $template = preg_replace("/\\[PAGER\\]/", "", $template); } //fill [BREAD_CRUMBS] $bread_crumbs = "<a href =\"/#\">Main</a> "; // } $key_info = array(); if ($current_page_type == "KEY_PAGE") { //get city page info #echo "page_key: ".$page_key."<br/>"; $key_info = getKeyInfo($con, $page_key); //if page exist if ($key_info) { //fill [BREAD_CRUMBS] $bread_crumbs = "<a href =\"http://" . $site_main_domain . "\">Main</a> > <a href =\"#\">" . $key_info['key_value'] . " " . engdate($key_info['posted_time'], 'jS \\of F') . "</a>"; } else { #PAGE NOT FOUND REDIRECT header('HTTP/1.1 404 Not Found'); #header('Location: /'); $_GET['e'] = 404; include $_SERVER['DOCUMENT_ROOT'] . '/404.html'; exit; } } if ($current_page_type == "KEY_PAGE") { $template = fillSnippetsContent($template, $key_info['key_value'], $con, $page_key); //delete all unnecessary templates anchors for ($i = 0; $i < 9; $i++) { $template = preg_replace("/\\[SNIPPET_TITLE_" . ($i + 1) . "\\]/", '', $template); $template = preg_replace("/\\[SNIPPET_CONTENT_" . ($i + 1) . "\\]/", '', $template);
function fillArticleList($con, $template) { global $page_title, $page_meta_keywords, $page_meta_description, $keyword; $result = mysqli_query($con, " SELECT ac.*, at.titleOrig, at.title, at.url, t1.posted_cnt, unix_timestamp(ac.post_dt) posted_time " . " FROM article_content ac, article_tmpl at," . " (SELECT ac.tmpl_id, MAX(ac.post_dt) max_post_dt, COUNT(1) posted_cnt " . " FROM article_content ac" . " WHERE ac.post_dt < now() GROUP BY ac.tmpl_id) AS t1" . " WHERE ac.tmpl_id = t1.tmpl_id AND at.tmpl_id = ac.tmpl_id AND ac.post_dt = t1.max_post_dt ORDER BY ac.post_dt DESC"); $text; $titleOrig; $url; $post_dt; $upd_flg; $atricles = ""; $cur_news_posted_time = ""; while ($row = mysqli_fetch_array($result)) { global $categoryName, $categoryNameLatin; $text = $row['text']; $titleOrig = $row['titleOrig']; $url = $row['url']; $post_dt = $row['posted_time']; $upd_flg = $row['upd_flg']; $updTitle = ""; if ($cur_news_posted_time != engdate($post_dt, 'jS \\of F')) { $cur_news_posted_time = engdate($post_dt, 'jS \\of F'); $atricles = $atricles . "<h3>" . $cur_news_posted_time . "</h3>"; } if ($upd_flg == 1) { $updTitle = "Information updated | "; } $atricles = $atricles . "<a href=\"/articles/{$url}/\">" . $updTitle . " " . $titleOrig . " (" . engdate($post_dt, 'jS \\of F, h:i:s A') . ")</a></br>\r\n"; /*$atricles = preg_replace("/\[CATEGORY_NAME\]/", $categoryName , $atricles); $atricles = preg_replace("/\[CATEGORY_ABBR\]/", $categoryName , $atricles);*/ } //apply template $template = preg_replace("/\\[ATRICLES_LIST\\]/", $atricles, $template); return $template; }