织梦文章内容页独立内容页模板

织梦内容页独立内容模板,可以让文章不同样式展示,同样就是需要提前准备好内容页的模板,比较适合正对性的内容去做页面,学技巧认为比专题页面又好用一点。

1、后台-系统-SQL命令行工具-执行

ALTER TABLE `xjq_archives` ADD `tempname` VARCHAR( 40 ) NOT NULL DEFAULT '';

2、后台文档发布模板里添加表单

文章模型的是

dede/templets/article_add.htm

dede/templets/article_edit.htm

图集模型的是

dede/templets/album_add.htm

dede/templets/album_edit.htm

软件模型的是

dede/templets/soft_add.htm

dede/templets/soft_edit.htm

商品和自定义模型的是

dede/templets/archives_add.htm

根据你自己的模型来添加表单,搜索自定义文件名

发布和编辑都是插入如下的代码:

<script type="text/javascript">
function SelectTemplets(fname)
{
var posLeft = 200;
var posTop = 300;
window.open("../include/dialog/select_templets.php?f="+fname, "poptempWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=400,left="+posLeft+", top="+posTop);
}
</script>
<tr>
<td colspan="2">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
   <tr>
    <td width="90" class="bline" height='24'>&nbsp;自定义模板:</td>
    <td class="bline"><input type='text' name="tempname" id="tempname" style='width:300px' class='text' value="<?php echo $$arcRow['tempname']; ?>" /> <input name='diytemp_bt' type='button' class='inputbut' value='浏览...' onClick="SelectTemplets('form1.tempname')" />
    </td>
   </tr>
  </table>
</td>
</tr>

插入后的效果如下:

3、后台文档发布和编辑处理php文件修改

文章模型的是

dede/article_add.php

dede/article_edit.php

图集模型的是

dede/album_add.php

dede/album_edit.php

软件模型的是

dede/soft_add.php

dede/soft_edit.php

商品和自定义模型的是

dede/archives_add.php

dede/archives_edit.php

打开对应的文档发布处理,php文件是 xxx_add.php

找到,weight修改成,weight,tempname

继续找到,'$$weight'修改成,'$$weight','$$tempname'

文档编辑处理php文件是 xxx_edit.php

找到weight='$$weight'改成weight='$$weight',tempname='$$tempname'

4、/include/arc.archives.class.php 找到

$$this->Fields['filename'] = empty($$this->Fields['filename'])? '' : $$this->Fields['filename'];在他的下面加入:

$$this->Fields['tempname'] = empty($$this->Fields['tempname'])? '' : $$this->Fields['tempname'];

继续找到$$cid = $$this->ChannelUnit->ChannelInfos['nid']; 在他的下面加入:

$$this->Fields['tempname'] = empty($$this->Fields['tempname'])? '' : $$this->Fields['tempname'];

继续找到$$filetag = str_replace('{tid}', $$tid,$$filetag);在它下面加入:

if(!empty($$this->Fields['tempname'])) $$filetag = $$this->Fields['tempname'];

修改到现在就已经完成了。

+