예제 #1
0
function prepare_news_record(&$row_news, $type_image = 'mobile')
{
    if (isset($row_news['new_title']) && $row_news['new_title']) {
        $row_news['new_title'] = htmlspecialbo($row_news['new_title']);
    }
    if (isset($row_news['new_picture']) && $row_news['new_picture']) {
        $row_news['new_picture_low'] = get_picture_path($row_news['new_picture'], $type_image . '_low');
        $row_news['new_picture'] = get_picture_path($row_news['new_picture'], $type_image);
    }
    if (isset($row_news['new_teaser']) && $row_news['new_teaser']) {
        $row_news['new_teaser'] = removeHTML($row_news['new_teaser']);
        $row_news['full_teaser'] = $row_news['new_teaser'];
        $row_news['new_teaser'] = cut_string($row_news['new_teaser'], 50);
    }
    if (isset($row_news['new_date']) && $row_news['new_date']) {
        $row_news['post_time'] = date('d/m/Y | H:i', $row_news['new_date']);
    }
    $row_news['link_detail'] = generate_news_detail_url($row_news);
    return $row_news;
}
예제 #2
0
}
if (!$check_i) {
    //tin hot mục sức khỏe không có tin mới trong khoảng thời gian MIN_TIME_NEWS_HOT hoặc chưa thỏa mãn MIN_NEWS_VIEW
    $db_news_tsk_hot = new db_query('SELECT new_id,
                                            new_title,
                                            new_picture
                                     FROM   news
                                     WHERE  new_active = 1
                                        AND new_cat_id = ' . $cat_tsk['cat_id'] . '
                                     ORDER BY new_view DESC
                                     LIMIT 3');
    while ($row = mysqli_fetch_assoc($db_news_tsk_hot->result)) {
        $check_i++;
        $row['new_title'] = htmlspecialbo($row['new_title']);
        $row['cat_name'] = $cat_tsk['cat_name'];
        $row['link_detail'] = generate_news_detail_url($row);
        $row['new_picture'] = get_picture_path($row['new_picture'], 'medium');
        $list_news_tsk['array_news'][] = $row;
    }
}
shuffle($list_news_category);
array_pop($list_news_category);
$rainTpl->assign('list_news_category', $list_news_category);
$rainTpl->assign('list_news_tsk', $list_news_tsk);
//list câu hỏi và bệnh khối hỏi đáp bên phải
$list_qaa_sidebar = get_qaa_listing_sidebar();
$rainTpl->assign('list_qaa_sidebar', $list_qaa_sidebar);
//khối sơ đồ cơ thể
$anatomy_sex = get_cookie_anatomy_sex();
$anatomy_sex_str = getValue('anatomy-sex', 'str', 'COOKIE', 'male', 3);
$sex_male_active = $anatomy_sex == DOITUONG_NAMGIOI ? 'color-base' : 'text-muted';
예제 #3
0
function get_news_ban_co_biet($yyy = 4)
{
    global $lllll;
    if (isset($lllll['ban_co_biet'])) {
        return $lllll['ban_co_biet'];
    }
    $oooooo = 3;
    $ggggg = intval($yyy) * 5;
    $jj = 'SELECT new_id,new_picture,new_title,cat_name,cat_id
            FROM news
            LEFT JOIN categories ON cat_id = new_cat_id
            WHERE new_cat_id = ' . $oooooo . '
                AND new_active = 1
                AND new_view >= ' . MIN_NEWS_VIEW . '
                AND new_date <= ' . TIMESTAMP . '
                AND new_date >= ' . MIN_TIME_NEWS_HOT . '
            LIMIT ' . $ggggg;
    $ll = new db_query($jj);
    $kkkkkk = array();
    while ($ooooo = mysqli_fetch_assoc($ll->result)) {
        $ooooo['link_detail'] = generate_news_detail_url($ooooo);
        $ooooo['new_title'] = htmlspecialbo($ooooo['new_title']);
        $kkkkkk['link_cat'] = generate_cat_url($ooooo);
        $kkkkkk['cat_name'] = $ooooo['cat_name'];
        $kkkkkk['array_news'][] = $ooooo;
    }
    if (!$kkkkkk) {
        $jj = 'SELECT new_id,new_picture,new_title,cat_name,cat_id
                FROM news
                LEFT JOIN categories ON cat_id = new_cat_id
                WHERE new_cat_id = ' . $oooooo . '
                    AND new_active = 1
                    AND new_date <= ' . TIMESTAMP . '
                ORDER BY new_date DESC
                LIMIT ' . $ggggg;
        $ll = new db_query($jj);
        while ($ooooo = mysqli_fetch_assoc($ll->result)) {
            $ooooo['link_detail'] = generate_news_detail_url($ooooo);
            $ooooo['new_title'] = htmlspecialbo($ooooo['new_title']);
            $kkkkkk['link_cat'] = generate_cat_url($ooooo);
            $kkkkkk['cat_name'] = $ooooo['cat_name'];
            $kkkkkk['array_news'][] = $ooooo;
        }
    }
    unset($ll);
    shuffle($kkkkkk['array_news']);
    $llllll = 0;
    $mmmmmm = array();
    foreach ($kkkkkk['array_news'] as $nnnnnn) {
        $llllll++;
        if ($llllll == 1) {
            $nnnnnn['new_picture'] = get_picture_path($nnnnnn['new_picture'], 'medium');
            $nnnnnn['is_first'] = 1;
        }
        if ($llllll > $yyy) {
            break;
        }
        $mmmmmm[] = $nnnnnn;
    }
    $kkkkkk['array_news'] = $mmmmmm;
    $lllll['ban_co_biet'] = $kkkkkk;
    return $kkkkkk;
}
예제 #4
0
<?php

$db_query = new db_query('SELECT new_id, new_title, cat_name
                          FROM news LEFT JOIN categories ON cat_id = new_cat_id
                          WHERE new_active = 1
                          ORDER BY new_date DESC LIMIT 10');
$return_json = array();
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $return_json[] = DOMAIN_URL . generate_news_detail_url($row);
}
$api_result = array('success' => 1, 'urls' => $return_json);
예제 #5
0
$check_link_redirect = $_SERVER['REQUEST_URI'] == generate_news_detail_url($detail_data);
if (!$check_link_redirect) {
    move301(generate_news_detail_url($detail_data));
}
//assign quảng cáo
$rainTpl->assign('adv_top', $adv_top);
$rainTpl->assign('adv_right', $adv_right);
//quảng cáo banner
$rainTpl->assign('adv_banner_list', $adv_banner_list);
$fb_see_also = '';
if ($array_link_see_also) {
    foreach ($array_link_see_also as $see_also_url) {
        $fb_see_also .= '<meta property="og:see_also" content="' . $see_also_url . '" />';
    }
}
$facebook_og = '
<meta property="og:title" content="' . htmlspecialbo($detail_data['new_title']) . '"/>
<meta property="fb:app_id" content="1561038610796934" />
<meta property="fb:profile_id" content="1508569846068761" />
' . $fb_see_also . '
<meta property="og:type" content="article" />
<meta property="og:determiner" content="auto" />
<meta property="article:section" content="' . htmlspecialbo($detail_data['cat_name']) . '" />
<meta property="article:publisher" content="https://www.facebook.com/suckhoeankhang" />
<meta property="article:published_time" content="' . $datetime_facebook . '" />
<meta property="og:url" content="http://khang.vn' . generate_news_detail_url($detail_data) . '" />
<meta property="og:image" content="' . $detail_data['new_picture'] . '"/>
<meta property="og:description" content="' . htmlspecialbo($detail_data['new_teaser']) . '">
<meta property="og:updated_time" content="' . time() . '">';
$rainTpl->assign('facebook_og', $facebook_og);
$rainTpl->draw('news_detail');
예제 #6
0
<?php

require 'config.php';
$lastmod_first = date('Y-m-d') . 'T00:00:00+07:00';
$page = 0;
$limit = 10000;
ob_clean();
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns:xhtml="http://www.w3.org/1999/xhtml">';
$db = new db_query('SELECT * FROM news LEFT JOIN categories ON cat_id = new_cat_id WHERE new_active = 1 AND new_date >= ' . (time() - 86400) . ' LIMIT ' . $page * $limit . ',' . $limit);
while ($row = mysqli_fetch_assoc($db->result)) {
    $link_detail = generate_news_detail_url($row);
    ?>
    <url>
        <loc><?php 
    echo DOMAIN_URL . $link_detail;
    ?>
</loc>
        <?php 
    /*
    <xhtml:link rel="alternate" media="only screen and max-width: 480px" href="http://m.24h.com.vn/" />
    */
    ?>
        <lastmod><?php 
    echo $lastmod_first;
    ?>
</lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
예제 #7
0
<?php

require_once 'config.php';
//lấy ra menu
$category_news = get_menu_category_news();
$rainTpl->assign('category_news', $category_news);
$category_hoidap = get_menu_category_hoidap();
$rainTpl->assign('category_hoidap', $category_hoidap);
$category_thuoc = get_menu_category_thuoc();
$rainTpl->assign('category_thuoc', $category_thuoc);
$record_id = getValue('record_id');
include_once '../includes/mobile/inc_news_detail_init.php';
$page_title = $news_data['new_title'];
//so sánh link để redirect về link đúng
$check_link_redirect = $_SERVER['REQUEST_URI'] == generate_news_detail_url($news_data);
if (!$check_link_redirect) {
    move301(generate_news_detail_url($news_data));
}
$rainTpl->assign('page_title', $page_title);
$rainTpl->assign('news_data', $news_data);
$rainTpl->draw('news_detail');
예제 #8
0
function get_news_ban_co_biet($number = 4)
{
    global $_static_value;
    if (isset($_static_value['ban_co_biet'])) {
        return $_static_value['ban_co_biet'];
    }
    //id của danh mục bạn có biết
    $id_cat = 3;
    $limit_size = intval($number) * 5;
    $sql = 'SELECT new_id,new_picture,new_title,cat_name,cat_id
            FROM news
            LEFT JOIN categories ON cat_id = new_cat_id
            WHERE new_cat_id = ' . $id_cat . '
                AND new_active = 1
                AND new_view >= ' . MIN_NEWS_VIEW . '
                AND new_date <= ' . TIMESTAMP . '
                AND new_date >= ' . MIN_TIME_NEWS_HOT . '
            LIMIT ' . $limit_size;
    $db_query = new db_query($sql);
    $array_news = array();
    while ($row = mysqli_fetch_assoc($db_query->result)) {
        $row['link_detail'] = generate_news_detail_url($row);
        $row['new_title'] = htmlspecialbo($row['new_title']);
        $array_news['link_cat'] = generate_cat_url($row);
        $array_news['cat_name'] = $row['cat_name'];
        $array_news['array_news'][] = $row;
    }
    if (!$array_news) {
        //nếu không có tin thì lấy tin bạn có biết mới nhất
        $sql = 'SELECT new_id,new_picture,new_title,cat_name,cat_id
                FROM news
                LEFT JOIN categories ON cat_id = new_cat_id
                WHERE new_cat_id = ' . $id_cat . '
                    AND new_active = 1
                    AND new_date <= ' . TIMESTAMP . '
                ORDER BY new_date DESC
                LIMIT ' . $limit_size;
        $db_query = new db_query($sql);
        while ($row = mysqli_fetch_assoc($db_query->result)) {
            $row['link_detail'] = generate_news_detail_url($row);
            $row['new_title'] = htmlspecialbo($row['new_title']);
            $array_news['link_cat'] = generate_cat_url($row);
            $array_news['cat_name'] = $row['cat_name'];
            $array_news['array_news'][] = $row;
        }
    }
    unset($db_query);
    shuffle($array_news['array_news']);
    $count = 0;
    $return_news = array();
    foreach ($array_news['array_news'] as $a_news) {
        $count++;
        if ($count == 1) {
            $a_news['new_picture'] = get_picture_path($a_news['new_picture'], 'medium');
            $a_news['is_first'] = 1;
        }
        if ($count > $number) {
            break;
        }
        $return_news[] = $a_news;
    }
    $array_news['array_news'] = $return_news;
    $_static_value['ban_co_biet'] = $array_news;
    return $array_news;
}