本文整理汇总了PHP中news::getNewsById方法的典型用法代码示例。如果您正苦于以下问题:PHP news::getNewsById方法的具体用法?PHP news::getNewsById怎么用?PHP news::getNewsById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::getNewsById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
<?php
include "function.php";
$id = isset($_REQUEST["id"]) ? $_REQUEST["id"] : "";
if (empty($id)) {
error("非法访问!");
}
$newsClass = new news();
$news = $newsClass->getNewsById($id);
$index = new index();
//获取首页置顶消息
$index_msg = $index->getIndexMsg();
//获取首页置顶消息
$index_top_msg = $index->getTopMsg();
//获取首页置顶消息
//$index_slide_images = $index->getIndexSlideImages(10);
//检查是否登陆
$isLogin = login::isLogin();
//
$user = user::getUserSession();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
//导入meta数据及js库
echo $systemHead["meta"] . $systemHead["title"] . CSS_BASE . JS_JQUERY . JS_COMMON . JS_BASE . JS_DIALOG;
?>
<script>
var isLogin = <?php
echo json_encode($isLogin);
示例2: news
<?php
require_once '../models/config.php';
require_once '../models/class.php';
require_once '../models/class-news.php';
require_once '../models/class-cat.php';
if (isset($_GET['id'])) {
$news_obj = new news();
$temp = $news_obj->getNewsById($_GET['id']);
}
?>
<div class="panel panel-danger">
<div class="panel-heading">
<h3 class="panel-title">
<i class="livicon" data-name="bell" data-loop="true" data-color="#fff" data-hovercolor="#fff" data-size="18"></i>
<?php
if (isset($_GET['act'])) {
echo $_GET['act'] == 'update' ? 'Sửa' : 'Thêm';
} else {
echo "Thêm";
}
?>
tin bài
</h3>
<span class="pull-right">
<i class="fa fa-fw fa-chevron-up clickable"></i>
<i class="fa fa-fw fa-times removepanel clickable"></i>
</span>
</div>
<div class="panel-body border">
<form action="control/proccess-news.php" method="post" class="form-horizontal form-bordered" enctype="multipart/form-data">
示例3: isset
<?php
include "../function.php";
$id = isset($_REQUEST["id"]) ? $_REQUEST["id"] : "";
if (empty($id)) {
error("非法访问!");
}
$news = new news();
$newTypeArray = $news->getNewsType();
$rs = $news->getNewsById($id);
$user = new user();
$userSession = $user->getUserSession();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
//导入meta数据及js库
echo $systemHead["meta"] . $systemHead["title"] . JS_JQUERY . JS_DIALOG . JS_COMMON . KINDEDITOR . LIB_LIGERUI;
?>
<script>
var editor;
$(function() {
$.metadata.setType("attr", "validate");
var v = $("form").validate({
debug: false,
errorPlacement: function(lable, element) {
if (element.hasClass("l-textarea")) element.ligerTip({
content: lable.html(),
appendIdTo: lable
});
示例4: news
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div style=" width:700px;" class="news-detail">
<!--lấy bài viết-->
<?php
$news_obj = new news();
$news = $news_obj->getNewsById($_GET['n_id']);
?>
<div class="doc-tintuc" style=" padding-top:20px;border:#287FA2 solid 1px; margin-top:10px; line-height:20px; padding-left:10px;padding-right:10px;">
<ul>
<li style=" text-align:center; line-height:40px; font-size:2em; font-weight:bold; color:#287FA2; margin-top:5px; margin-bottom:10px;">
<?php
echo $news['title'];
?>
</li>
<li>
<p style="padding-top:3px; float:right;"><?php
$date_int = strtotime($news['ngaydangbai']);
$time_vietnam = date('d-m-Y', $date_int);
echo $time_vietnam;
?>
</p>