在本文中,我们将带你了解织梦DedeCMS5.7二开新闻页实现阅读全文功能的在这篇文章中,我们将为您详细介绍织梦DedeCMS5.7二开新闻页实现阅读全文功能的的方方面面,并解答织梦内容页调用常见的疑
在本文中,我们将带你了解织梦DedeCMS5.7二开新闻页实现阅读全文功能的在这篇文章中,我们将为您详细介绍织梦DedeCMS5.7二开新闻页实现阅读全文功能的的方方面面,并解答织梦内容页调用常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的DedeCMS 5.5 实现全文搜索功能的办法、DedeCMS 5.5 实现全文搜索功能的方法、dedecms5.7文章二次开发实现阅读全文功能的方法、dedecms5.7文章实现阅读全文功能二次开发_html/css_WEB-ITnose。
本文目录一览:- 织梦DedeCMS5.7二开新闻页实现阅读全文功能的(织梦内容页调用)
- DedeCMS 5.5 实现全文搜索功能的办法
- DedeCMS 5.5 实现全文搜索功能的方法
- dedecms5.7文章二次开发实现阅读全文功能的方法
- dedecms5.7文章实现阅读全文功能二次开发_html/css_WEB-ITnose
织梦DedeCMS5.7二开新闻页实现阅读全文功能的(织梦内容页调用)
现在很多网站尤其是文章类网站都有阅读全文功能,当一个页面有多个分页的时候就会显示出这个“在本页阅读全文”的链接,点击这个链接之后就是这篇新闻以没有分页出现的形式,那么dedecms5.7怎么在新闻内容详细页也实现这个功能呢?
具体实现办法:
首先找到并打开/include/arc.archives.class.php文件,在大概第145行左右的位置找到如下代码:
$this->Fields['userip'] = $this->addTableRow['userip'];
在其下面添加如下代码:
$this->Fields['body2'] = $this->addTableRow['body'];
添加完成之后再继续查找如下代
$this->dsql->ExecuteNoneQuery("Update `#【分隔符】@__archives` SET ismake=1 WHERE id='".$this->ArcID."'");
注意查找的时候手动去掉上面的那个【分隔符】字样,找到后在其上面添加如下代码:
注:
1、现在很多网站下面这段代码是有误的,本站已经做了修正,请注意分辨。
2、下面的请替换为标准的分页符,,就是去掉空格,因为设置为默认分页符,本文会分页。
//阅读全文开始
if($this->TotalPage > 1) {
//用正则匹配把分页符去掉
$this->Fields['body2'] = preg_replace('/#p #副标题 #e#/U', '',$this->Fields['body2']);
$this->SplitFields = explode("#p2222#",$this->Fields['body2']);
$this->Fields['tmptitle'] = (empty($this->Fields['tmptitle']) ? $this->Fields['title'] : $this->Fields['tmptitle']);
$this->Fields['title'] = $this->Fields['tmptitle'];
$this->TotalPage = count($this->SplitFields);
$this->Fields['totalpage'] = $this->TotalPage;
$TRUEfilenameall = $this->GetTruePath().$fileFirst."_all.".$this->ShortName;
$this->ParseDMFields(1,0);
$this->dtp->SaveTo($TRUEfilenameall);
if($cfg_remote_site=='Y' && $isremote == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '', $TRUEfilename);
$localfile = '..'.$remotefile;
//创建远程文件夹
$remotedir = preg_replace("#[^\/]*\.html#", '', $remotefile);
$this->ftp->rmkdir($remotedir);
$this->ftp->upload($localfile, $remotefile, 'ascii');
}
}
//阅读全文结束
添加完成之后继续在里面查找获得静态页面分页列表的代码,里面有return $PageList;
在其上面添加如下代码:
$PageList.= "<a href='".$this->NameFirst."_all.".$this->ShortName."'>阅读全文</a>";
修改完成后,生成一下内容详细页就可以看到效果了,当新闻内容太多分成多页之后就会在列表后面出现阅读全文的链接了,大家赶快试试吧。
本文章网址:http://www.ppssdd.com/code/10556.html。转载请保留出处,谢谢合作!DedeCMS 5.5 实现全文搜索功能的办法
dedecms 5.5 默认的模糊搜索只能根据网站新闻的名称进行搜索,无法搜索到新闻内部信息,对此经过研究得出以下修改办法,现共享下:
登入后台-核心-频道模型-内容模型管理-
-普通新闻-【点击后面那个放大镜日志o】(*重要一步)-
附件表可供自定义搜索的字段:
这里的字段是程序依据字段类型自动选择生成的。新闻内容
将“新闻内容”前面那个打勾,此时将修改掉搜索字段,但是还没有成功,还需要修改源码相应的代码:
修改源码文件中的:head.htm 文件中。
Copy to ClipboardLiehuo.Net Codes引用的内容:[]
<form action="{dede:field name='phpurl'/}/search.php" name="formsearch">
<div>
<h4>搜索</h4>
<input type="hidden" name="kwtype" value="0" />
<input name="keyword" type="text"id="search-keyword" />
<select name="searchtype"id="search-option">
<option value="titlekeyword" selected='1'>智能模糊搜索</option>
<option value="title">仅搜索标题</option>
</select>
<button type="submit">搜索</button>
</div>
</form>
修改为:
Copy to ClipboardLiehuo.Net Codes引用的内容:[]
<form action="/plus/advancedsearch.php" method="post">
<div>
<h4>搜索</h4>
<input type="hidden" name="mid" value="1" />
<input type="hidden" name="dopost" value="search" />
Keywords:<input type="text" name="q" /> <input type="submit" name="submit" value="开始全文搜索" />
</div>
</form>
此时更新网站,将会发现搜索数据已经有了质的飞跃。
本文章网址:http://www.ppssdd.com/code/4188.html。转载请保留出处,谢谢合作!DedeCMS 5.5 实现全文搜索功能的方法
PHP" method="post"> |
总结
以上是小编为你收集整理的DedeCMS 5.5 实现全文搜索功能的方法全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
dedecms5.7文章二次开发实现阅读全文功能的方法
文章二次开发实现阅读全文功能的方法。分享给大家供大家参考。具体分析如下:
站点都有的,比如网易,新浪等,随着文章内容的增加,当一个页面有多个分页的时候,就会显示出这个“在本页阅读全文”的链接,点击这个链接之后出现的,将是这篇文章以没有分页出现的型式,那么在Dedecms5.7如何在文章内容页添加阅读全文功能呢?
功能.
文件:include/arc.archives.class.PHP
文件.
PHP
stem==-1
dedecms5.7文章实现阅读全文功能二次开发_html/css_WEB-ITnose
阅读全文功能其实在很多的流行站点都有的,比如网易,新浪等,随着文章内容的增加,当一个页面有多个分页的时候,就会显示出这个“在本页阅读全文”的链接,点击这个链接之后,出现的,将是这篇文章以没有分页出现的型式。,那么在dedecms5.7如何在文章内容页添加阅读全文功能呢?
如图所示:
这个阅读全文有什么用呢?说白了,也就是提高用户体验。下面让我们看看,怎么简单现实这个功能。
修改文件:include/arc.archives.class.php
注意:做任何修改前都要备份好原文件。
立即学习“前端免费学习笔记(深入)”;
第一步:打开include/arc.archives.class.php
文件查找://issystem==-1
往下 大概 145行 找到 $this->Fields[''userip''] = $this->addTableRow[''userip''];
在下面一行添加:$this->Fields[''body2''] = $this->addTableRow[''body''];
第二步查找:$this->dsql->ExecuteNoneQuery("Update `#@__archives` SET ismake=1 WHERE id=''".$this->ArcID."''");
在上一行添加以下代码
代码如下 复制代码
//阅读全文开始
if($this->TotalPage > 1) {
//用正则匹配把分页符去掉
$this->Fields[''body2''] = preg_replace(''/#p#副标题#e#/U'', '''',$this->Fields[''body2'']);
$this->SplitFields = explode("#p2222#",$this->Fields[''body2'']);
$this->Fields[''tmptitle''] = (empty($this->Fields[''tmptitle'']) ? $this->Fields[''title''] : $this->Fields[''tmptitle'']);
$this->Fields[''title''] = $this->Fields[''tmptitle''];
$this->TotalPage = count($this->SplitFields);
$this->Fields[''totalpage''] = $this->TotalPage;
$TRUEfilenameall = $this->GetTruePath().$fileFirst."_all.".$this->ShortName;
$this->ParseDMFields(1,0);
$this->dtp->SaveTo($TRUEfilenameall);
if($cfg_remote_site==''Y'' && $isremote == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, '''', $TRUEfilename);
$localfile = ''..''.$remotefile;
//创建远程文件夹
$remotedir = preg_replace("#[^\/]*\.html#", '''', $remotefile);
$this->ftp->rmkdir($remotedir);
$this->ftp->upload($localfile, $remotefile, ''ascii'');
}
}
//阅读全文结束
第三步:查找 获得静态页面分页列表
代码如下 复制代码
/**
* 获得静态页面分页列表
*
* @access public
* @param int $totalPage 总页数
* @param int $nowPage 当前页数
* @param int $aid 文档id
* @return string
*/
function GetPagebreak($totalPage, $nowPage, $aid)
{
if($totalPage==1)
{
return "";
}
//$PageList = "
$PageList = "";
$nPage = $nowPage-1;
$lPage = $nowPage+1;
if($nowPage==1)
{
$PageList.="";
}
else
{
if($nPage==1)
{
$PageList.="NameFirst.%22.%22.%24this->ShortName.%22" target="_self">";
}
else
{
$PageList.="NameFirst.%22_%22.%24nPage.%22.%22.%24this->ShortName.%22" target="_self">";
}
}
for($i=1;$i {
if($i==1)
{
if($nowPage!=1)
{
$PageList.="NameFirst.%22.%22.%24this->ShortName.%22" target="_self">1";
}
else
{
$PageList.="
}
}
else
{
$n = $i;
if($nowPage!=$i)
{
$PageList.="NameFirst.%22_%22.%24i.%22.%22.%24this->ShortName.%22" target="_self">".$n."";
}
else
{
$PageList.="
}
}
}
if($lPage {
$PageList.="NameFirst.%22_%22.%24lPage.%22.%22.%24this->ShortName.%22" target="_self">>";
}
else
{
$PageList.= ">";
}
$PageList.= "NameFirst.%22_all.%22.%24this->ShortName.%22">阅读全文";
return $PageList;
}
也就是在return $PageList 上一行添加了一行代码,
$PageList.= "NameFirst.%22_all.%22.%24this->ShortName.%22">阅读全文";
修改完成后,保存文件,更新一下页面就可以看到效果了。
from:http://www.111cn.net/wy/Dedecms/66572.htm
关于织梦DedeCMS5.7二开新闻页实现阅读全文功能的和织梦内容页调用的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于DedeCMS 5.5 实现全文搜索功能的办法、DedeCMS 5.5 实现全文搜索功能的方法、dedecms5.7文章二次开发实现阅读全文功能的方法、dedecms5.7文章实现阅读全文功能二次开发_html/css_WEB-ITnose等相关内容,可以在本站寻找。
本文标签: