Пример #1
0
<?php

include_once 'front.php';
$nav_id = intval($_GET['nav_id']);
$smarty = new smarty();
smarty_front();
get_nav();
get_left_nav($nav_id);
get_notice();
get_nav_name($nav_id);
$format = "SELECT `news_id`, `news_name`, `news_author`, `news_date` FROM `{$GLOBALS['db_prefix']}news` WHERE `news_class`='%d'";
$format = sprintf($format, $nav_id);
$query = $GLOBALS['db']->getAll($format);
$rows = array();
if ($query) {
    foreach ($query as $v) {
        $rows[$v['news_id']]['id'] = $v['news_id'];
        $rows[$v['news_id']]['name'] = $v['news_name'];
        $rows[$v['news_id']]['author'] = $v['news_author'];
        $rows[$v['news_id']]['date'] = date("y-m-d h:i:s", $v['news_date']);
    }
}
$smarty->assign('content', $rows);
$smarty->display('page.html');
Пример #2
0
<?php

include_once 'front.php';
$content_id = empty($_GET['id']) ? '' : intval($_GET['id']);
$format = "SELECT * FROM `{$db_prefix}news` WHERE `news_id`= '%d'";
$format = sprintf($format, $content_id);
$query = $GLOBALS['db']->query($format);
$content = array();
if ($rows = $query->fetch_assoc()) {
    $content['content'] = $rows['news_content'];
    $content['name'] = $rows['news_name'];
    $content['author'] = $rows['news_author'];
    $content['time'] = date("Y-m-d h:i:s", $rows['news_date']);
}
$smarty = new smarty();
smarty_front();
get_nav();
get_left_nav($content_id);
get_notice();
get_nav_news($content_id);
$smarty->assign('content', $content);
$smarty->display('content.html');