加入收藏 | 设为首页 | 会员中心 | 我要投稿 | RSS
当前位置: 首页  文集文档  实用存档

dede5.5 调用站内新闻代码

时间:2009-11-06 00:00:00  来源:TIANZI.ORG  作者:天子  阅读:2280次
DEDE GBK 5.5 调用站内新闻的代码
首页调用新闻公告的标题,点击后打开详细内容页面

首页模板上调用代码:

{dede:sql sql="Select aid,typeid,title,writer,senddate,body From dede_mynews order by aid desc limit 0,8"} [field:senddate function="MyDate('Y-m-d',@me)" /] <a target="_blank" href="/new.php?id=[field:aid/]">[field:title/]</a>  {/dede:sql}

new.php放在根目录下,代码如下:

<?php
require_once (dirname(__FILE__) . "/include/common.inc.php");
$id=$_REQUEST['id'];
$dsql="select * from dede_mynews where aid='".$id."'";
$result=mysql_query($dsql); 
while($rs=mysql_fetch_object($result))
{
$title=$rs->title; 
$writer=$rs->writer;
$body=$rs->body;
$senddate=$rs->senddate;
$time=MyDate("Y-m-d",$senddate);
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>站内公告:<?=$title?> - <?php echo $cfg_webname;?></title>
</head>
<body><table width="760px" border="0" cellspacing="1" cellpadding="1" align="center"><tr><td height="30" align="center" bgcolor="#F9F9F9"><FONT style="size=5"><STRONG><b><?=$title?></b></STRONG></FONT></td></tr><tr><td height="30" align="center"><font color="#666666">发布人:<?=$writer?>   时间:<?=$time?></font></td></tr><tr><td> </td></tr><tr><td><?=$body?></td></tr><tr><td height="25"></td></tr><tr><td height="30" align="center">Powered by <a href="<?php echo $cfg_basehost;?>/"><?php echo $cfg_webname;?></a></td></tr></table></body>
</html>
来顶一下
返回首页
返回首页

发表评论 【查看全部条评论】
用户名:
密码:
验证码:
匿名:
推荐资讯
找了个帝国CMS程序和百度云服务器BCC
找了个帝国CMS程序和
帝国CMS管理员登陆页面修改美化
帝国CMS管理员登陆页
留言本从access数据库直接转入帝国MYSQL
留言本从access数据
MacBookPro安装win10双系统
MacBookPro安装win1
相关文章
    无相关信息
栏目更新
栏目热门