关于浏览器标签显示为文章标题的有关问题

WBOY
Release: 2016-06-13 11:50:01
Original
1085 people have browsed it

关于浏览器标签显示为文章标题的问题

本帖最后由 lan12050972 于 2014-03-04 15:34:12 编辑 公司一个新闻管理系统,发布新闻后打开各个页面显示的都还是一个网站名称。想修改一下打个各新闻后显示为文章标题。这也适合微信等工具传播。
谢谢之。
这是打开连接时的地址http://192.168.0.253:8088/business/index.php?m=index&a=actionClass&actype=content&fid=2&cid=2  它是通过cid=X这个来判断是打开某个文章的。

这是显示文章的模板源码
<!doctype html><br /><html><br /><head><br /><meta charset="utf-8"><br /><meta http-equiv="X-UA-Compatible" content="IE=9"><br /><br /><title><?php  echo $SITETITLE;?></title>  //就是这里修改为显示所显示文章标题<br /><br /><link href="[!CSS]test.css" rel="stylesheet" type="text/css"><br /></head><br /></html><br /><br /><body><br /><div class="wrapper"><br />  <div class="content"> <br />    <!--头部开始--><br />    <div class="header"><br />      <h1><a href="[!ROOT]"><img src="[!IMG]logo.jpg" alt="logo" /></a></h1><br />      <!--头部导航--><br />      <ul class="maniNav"><br />        <menu id="rs" lim="10" ><br />          <li><a href="{$rs.url}">{$rs.title} </a></li><br />        </menu><br />      </ul><br />      <!--头部导航结束--> <br />      <span class="header-msg">公司文章管理系统</span> </div><br />    <!--头部结束--> <br />    <!--中间开始--><br />    <div class="aimee-box cFloat"> </div><br />    <!--end aimee-box--> <br />    <!--文章内容开始--><br />    <br />    <div class="text-content"><br />      <view id="rs" cid='$cid'><br />        <h3 >{$rs.title}</h3><br />        <p>编辑 {$rs.aut} / {$rs.time|date="Y-m-d",###}</p><br />        {$rs.content} </view><br />    </div><br />    <br />    <!--文章内容结束--> <br />    <!--中间结束--> <br />    <!--底部开始--> <br />    <include file="default:foother" /><!--底部结束--> <br />  </div><br /></div><br /></body><br /></html>
Copy after login



这是我打开一个文章时的效果

------解决方案--------------------
那就在php后台通过cid=2去数据库查询文章的标题出来 赋值给$SITETITLE传到页面就行了
------解决方案--------------------
{$rs.title}把这个放到的地方
------解决方案--------------------
引用:
Quote: 引用:

那就在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']
所以<?php echo $rs['title'];?>
还不行的话绝对是你代码没遵循正常的TP框架流程走。。
其实还有一种笨方法应急。
就是用JQUERY取标题代替title中的内容
$(function(){
    $('title').text($('h3').text());
})
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!