Eyoucms自定义tag模板风格的方法
2020-08-16
eyoucms自定义tag模板风格的方法来自小秋姑娘。
涉及的修改文件:
1、application\home\controller\tags.php文件
找到:
if (!empty($tagindexInfo)) {
$tagid = $tagindexInfo['id'];
$tag = $tagindexInfo['tag'];下面增加:
$viewfile = $tagindexInfo['viewfile'];
找到:
$field_data = array( 'tag' => $tag, 'tagid' => $tagid,
下面增加:
'viewfile' => $viewfile,
找到:
/*模板文件*/ $viewfile = 'lists_tags';
改为:
/*模板文件*/
if($viewfile) {
$viewfile = $viewfile;
}
else
{
$viewfile = 'lists_tags';
}保存。
2、application\admin\controller\Tags.php
找到
/** * 编辑
*/
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'] : '',下面增加
'viewfile' => !empty($post['viewfile']) ? $post['viewfile'] : '',
3、application\admin\template\tags\edit.htm
找到
<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>下面增加
<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。
5、效果及使用方法









