公司一个新闻管理系统,发布新闻后打开各个页面显示的都还是一个网站名称。想修改一下打个各新闻后显示为文章标题。这也适合微信等工具传播。
谢谢之。
这是打开连接时的地址http://192.168.0.253:8088/business/index.php?m=index&a=actionClass&actype=content&fid=2&cid=2 它是通过cid=X这个来判断是打开某个文章的。
这是显示文章的模板源码
<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=9"><title><?php echo $SITETITLE;?></title> //就是这里修改为显示所显示文章标题<link href="[!CSS]test.css" rel="stylesheet" type="text/css"></head></html><body><div class="wrapper"> <div class="content"> <!--头部开始--> <div class="header"> <h1><a href="[!ROOT]"><img src="[!IMG]logo.jpg" alt="logo" /></a></h1> <!--头部导航--> <ul class="maniNav"> <menu id="rs" lim="10" > <li><a href="{$rs.url}">{$rs.title} </a></li> </menu> </ul> <!--头部导航结束--> <span class="header-msg">公司文章管理系统</span> </div> <!--头部结束--> <!--中间开始--> <div class="aimee-box cFloat"> </div> <!--end aimee-box--> <!--文章内容开始--> <div class="text-content"> <view id="rs" cid='$cid'> <h3 >{$rs.title}</h3> <p>编辑 {$rs.aut} / {$rs.time|date="y-m-d",###}</p>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/2327">
<img src="https://img.php.cn/upload/ai_manual/001/246/273/175885682336816.png" alt="影像之匠PixPretty">
</a>
<div class="aritcle_card_info">
<a href="/ai/2327">影像之匠PixPretty</a>
<p>商业级AI人像后期软件,专注于人像精修,色彩调节及批量图片编辑,支持Windows、Mac多平台使用。适用于写真、婚纱、旅拍、外景等批量修图场景。</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="影像之匠PixPretty">
<span>299</span>
</div>
</div>
<a href="/ai/2327" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="影像之匠PixPretty">
</a>
</div>
{$rs.content} </view> </div> <!--文章内容结束--> <!--中间结束--> <!--底部开始--> <include file="default:foother" /><!--底部结束--> </div></div></body></html>
那就在php后台通过cid=2去数据库查询文章的标题出来 赋值给$SITETITLE传到页面就行了
{$rs.title}把这个放到的地方
{$rs.title}把这个放到的地方 不行。已经试过了。
那就在php后台通过cid=2去数据库查询文章的标题出来 赋值给$SITETITLE传到页面就行了
我通过什么方式查询到当前网页打开的cid编号呢?
那就在php后台通过cid=2去数据库查询文章的标题出来 赋值给$SITETITLE传到页面就行了
我通过什么方式查询到当前网页打开的cid编号呢?
你不是通过链接打开的吗?http://192.168.0.253:8088/business/index.php?m=index&a=actionClass&actype=content&fid=2&cid=2?
$cid = $_GET['cid'];
你说的是一种得到cid的方法,还有一种可以用substr
$Model=new Model();
$Model->query("select nr_name from ai_content where id=$_GET['cid']");
无法调出对应标题来。
还希望指点。数据ai_centent id 对应cid 要显示的标题对应rn_name
这是通过thinkphp开发的。还希望指点。谢谢。
那就在php后台通过cid=2去数据库查询文章的标题出来 赋值给$SITETITLE传到页面就行了
我通过什么方式查询到当前网页打开的cid编号呢?
你不是通过链接打开的吗?http://192.168.0.253:8088/business/index.php?m=index&a=actionClass&actype=content&fid=2&cid=2?
$cid = $_GET['cid'];
thinkphp我没用过 你看下你其他调用数据库是怎么调用的 参考下就行了 都一样的
$rs.title其实就是$rs['title']
所以
$rs.title其实就是$rs['title']
所以
<div class="text-content"> <view id="rs" cid='$cid'> <h3 >{$rs.title}</h3> <p>编辑 {$rs.aut} / {$rs.time|date="y-m-d",###}</p> {$rs.content} </view> </div><title><view id="rs" cid='$cid'> {$rs.title}</view></title>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号