Example #1
0
    }
} elseif ($current_page == "CITY_PAGE") {
    //get city page info
    $tmpl_inner = fillItemInfo($con, $url_region, $url_city, $tmpl_inner);
    if ($tmpl_inner == null) {
        fireCall404();
        //$tmpl_inner = file_get_contents("tmpl_main_block.html");
    }
    $page_title = CITY_PAGE_TITLE;
    $page_meta_description = CITY_META_DESCRIPTION;
    $page_meta_keywords = CITY_META_KEYWORDS;
    $page_h1 = CITY_PAGE_H1;
    $page_h2 = CITY_PAGE_H2;
} elseif ($current_page == "ARTICLES_LIST_PAGE") {
    //get city page info
    $tmpl_inner = fillArticleList($con, $tmpl_inner);
    if ($tmpl_inner == null) {
        fireCall404();
        //$tmpl_inner = file_get_contents("tmpl_main_block.html");
    }
    $page_title = ARTICLES_LIST_PAGE_TITLE;
    $page_meta_description = ARTICLES_LIST_META_DESCRIPTION;
    $page_meta_keywords = ARTICLES_LIST_META_KEYWORDS;
} elseif ($current_page == "ARTICLE_PAGE") {
    //get city page info
    $tmpl_inner = fillArticle($con, $url_city, $tmpl_inner);
    if ($tmpl_inner == null) {
        fireCall404();
        //$tmpl_inner = file_get_contents("tmpl_main_block.html");
    }
}
}
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;
}
$con = mysqli_connect(DB_HOST, DB_USER_NAME, DB_USER_PWD, DB_NAME);
#echo "Connecting...";
if (mysqli_connect_errno()) {
    #echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con, "set character_set_client='utf8'");
mysqli_query($con, "set character_set_results='utf8'");
mysqli_query($con, "set collation_connection='utf8_general_ci'");
$template = fillArticleList($con);
mysqli_close($con);
echo $template;