function Detail() { $Host = $_SERVER['HTTP_HOST']; $Info = BottomInfo($Host); list($Company, $ICP, $MonitorCode) = $Info; $this->assign("Company", $Company); $this->assign("ICP", $ICP); $this->assign("MonitorCode", $MonitorCode); //文章的详细页面的跳转操作 $id = intval(I("get.id", 0)); $where["id"] = $id; $News = M("News"); $data = $News->where($where)->find(); if ($data) { unset($data); $data[] = $News->where($where)->find(); $this->assign("data", $data); //上,下篇文章的设置 //1.上篇文章设置 $wherePrex["id"] = array("lt", $id); $prexData = $News->Field("title,id")->where($wherePrex)->order("id desc")->find(); //只取小于当前的id的数据 //存在即有对应的数据 if ($prexData) { $this->assign("prexTitle", $prexData["title"]); $this->assign("prexId", $prexData["id"]); } else { $this->assign("prexTitle", "没有了"); $this->assign("prexId", 0); } //2.下篇文章设置 $whereNext["id"] = array("gt", $id); $nextData = $News->Field("title,id")->where($whereNext)->order("id asc")->find(); //只取大于当前的id的数据 //存在即有对应的数据 if ($nextData) { $this->assign("nextTitle", $nextData["title"]); $this->assign("nextId", $nextData["id"]); } else { $this->assign("nextTitle", "没有了"); $this->assign("nextId", 0); } //3.当前文章 $this->display(); } else { $this->error("抱歉,您查询的新闻资讯不存在,请联系网站管理员,谢谢合作!"); } }
public function Index() { $Url = __SELF__; //搜索引擎代码 //先获取最后一个 / 的位置 ,然后用 现在的长度减去 该位置,剩下的就是最后一个 / 后面的内容了,截取该部分即可 $LastStr = strrchr($Url, "/"); $UrlLength = strlen($Url); $LastStrLength = strlen($LastStr) - 2; //去掉 /? 占用两个字符 $PosStrLength = $UrlLength - $LastStrLength; $SEOCode = substr($Url, $PosStrLength, $UrlLength); //$SEOCode=substr($Url,""); //$appUrl=__APP__."/Appmaka/Index"; //判断是否手机端 $isMoblie = D("Phone"); //var_dump($isMoblie); if ($isMoblie->judge()) { //手机端 $this->redirect("/Appejhp/Index/Index/SEOCode/{$SEOCode}"); } //2.调出新闻资讯列表 $News = M("News"); //不需要调出 content内容。浪费资源 $newsList = $News->Field("content,pushtime", True)->order("pushtime desc")->limit(14)->select(); $this->assign("newsList", $newsList); /* 3.底部信息的给予 */ $Host = $_SERVER['HTTP_HOST']; $Info = BottomInfo($Host); list($Company, $ICP, $MonitorCode) = $Info; $this->assign("Company", $Company); $this->assign("ICP", $ICP); $this->assign("MonitorCode", $MonitorCode); //调出产品的数据 $product = M("products"); $data = $product->where("flag=1")->order('id asc')->select(); $this->assign("data", $data); //调出问答 $question = M("question"); $questionData = $question->select(); $this->assign("questionData", $questionData); $this->display(); }
public function Index() { $Url = __SELF__; //搜索引擎代码 //先获取最后一个 / 的位置 ,然后用 现在的长度减去 该位置,剩下的就是最后一个 / 后面的内容了,截取该部分即可 $LastStr = strrchr($Url, "/"); $UrlLength = strlen($Url); $LastStrLength = strlen($LastStr) - 2; //去掉 /? 占用两个字符 $PosStrLength = $UrlLength - $LastStrLength; $SEOCode = substr($Url, $PosStrLength, $UrlLength); //$SEOCode=substr($Url,""); //$appUrl=__APP__."/Appmaka/Index"; //判断是否手机端 $isMoblie = D("Phone"); //var_dump($isMoblie); if ($isMoblie->judge()) { //手机端 $this->redirect("/Appmaka/Index/Index/SEOCode/{$SEOCode}"); } /*底部版权 icp备案 的判断 */ $Host = $_SERVER['HTTP_HOST']; //当前网址 //粤ICP备14090790号 // 1 .haoli13 $Str1 = "haoli13"; /**审核阶段****************************************/ /* if(strpos($Host,$Str1)>-1){ //查看是否为玛卡 页面 if(strtolower(MODULE_NAME)=="mk"){ $this->Redirect("Test/Index"); } }if(strpos($Host,$Str1)>-1){ //查看是否为玛卡 页面 if(strtolower(MODULE_NAME)=="mk"){ $this->Redirect("Test/Index"); } } */ /****************************************************************/ /* 3.底部信息的给予 */ $Host = $_SERVER['HTTP_HOST']; $Info = BottomInfo($Host); list($Company, $ICP, $MonitorCode) = $Info; $this->assign("Company", $Company); $this->assign("ICP", $ICP); $this->assign("MonitorCode", $MonitorCode); //调出产品的数据 $product = M("products"); $data = $product->select(); $this->assign("data", $data); $this->assign("Company", $Company); $this->assign("ICP", $ICP); $this->display(); }