EyouCms

EyouCms

EyouCms是基于TP5.0框架为核心开发的免费+开源的企业内容管理系统,专注企业建站用户需求 提供海量各行业模板,降低中小企业网站建设、网络营销成本,致力于打造用户舒适的建站体验

Eyoucms自定义tag模板风格的方法

2020-11-19

eyoucms自定义tag模板风格的方法来自小秋姑娘。

涉及的修改文件:

1、application\home\controller\tags.php文件

找到:

1
2
3
if (!empty($tagindexInfo)) {  
 $tagid $tagindexInfo['id'];
 $tag $tagindexInfo['tag'];

下面增加:

1
$viewfile $tagindexInfo['viewfile'];

找到:

1
2
3
 $field_data array(
 'tag'   => $tag,
 'tagid'   => $tagid,

下面增加:

1
'viewfile' => $viewfile,

找到:

1
2
/*模板文件*/
 $viewfile 'lists_tags';

改为:

1
2
3
4
5
6
7
8
/*模板文件*/
if($viewfile) {
    $viewfile $viewfile;
}
else
{
    $viewfile 'lists_tags';
}

保存。


2、application\admin\controller\Tags.php

找到

1
2
3
4
5
6
7
8
9
10
11
/**     * 编辑
     */    
    public function edit()
    {
        if (IS_POST) {
            $post = input('post.');
            if (empty($post['id'])) $this->error('操作异常');
            $updata = [
                'add_time' => time(),
                'seo_title' => !empty($post['tag_seo_title']) ? $post['tag_seo_title'] : '',
                'seo_keywords' => !empty($post['tag_seo_keywords']) ? $post['tag_seo_keywords'] : '',

下面增加

1
'viewfile' => !empty($post['viewfile']) ? $post['viewfile'] : '',


3、application\admin\template\tags\edit.htm

找到

1
2
3
4
5
6
7
8
9
10
11
12
<dl class="row">
                <dt class="tit">
                    <label for="tag_seo_description">SEO描述</label>
                </dt>
                <dd class="opt">
  
                   <textarea rows="5" cols="60" 
name="tag_seo_description" id="tag_seo_description" style="height: 
60px;">{$tag.seo_description}</textarea>
                    <p class="notic">标签调用方法:{literal}{$eyou.field.seo_description}{/literal}</p>
                </dd>
            </dl>

下面增加

1
2
3
4
5
6
7
8
9
<dl class="row">
<dt class="tit">
    <label for="viewfile">指定风格</label>
 </dt>
 <dd class="opt">
 <input type="text" name="viewfile" id="viewfile" value="{$tag.viewfile}" class="input-txt">
  <p class="notic">只要填写风格名称即可不包含.htm类型,比如:tagindex</p>
</dd>
</dl>

保存。


4、在phpmyadmin里增加字段viewfile,执行下面SQL语句,重启Mysql。

Eyoucms自定义tag模板风格的方法(图1)1-200Q6122959641.zip


5、效果及使用方法

Eyoucms自定义tag模板风格的方法(图1)


TAG: eyoucms