PHPCMS V9栏目添加自定义字段,描述使用编辑器

@描述使用系统默认编辑器
进入如下模板文件
/modules/admin/templates/category_add.tpl.php
/modules/admin/templates/category_edit.tpl.php
修改
<textarea name="info[description]"><?php echo $description;?></textarea>

<script type="text/javascript" src="<?php echo APP_PATH; ?>/statics/js/ckeditor/ckeditor.js"></script>
<textarea name="info[description]" cols="50" rows="8" id="content"><?php echo $description;?></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'content',{height:200,width:500,pages:false,subtitle:false,textareaid:'content',module:'',catid:'',
flashupload:true,alowuploadexts:'',allowbrowser:'1',allowuploadnum:'10',authkey:'c8e07e653e467f2f1b2058ee44db799c',
filebrowserUploadUrl : '<?php echo APP_PATH; ?>/index.php?m=attachment&c=attachments&a=upload&module=&catid=&dosubmit=1',
toolbar :
[
['Source'],['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],['Maximize'],    //这是工具列表
]
});
</script>

@这里加上自定义字段brand_nationality, brand_site, brand_business
修改phpcms_category表如下:
ALTER TABLE `ge_category`  ADD `brand_nationality` CHAR(45) NOT NULL  AFTER `description`,  ADD `brand_site` VARCHAR(100) NOT NULL  AFTER `brand_nationality`,  ADD `brand_business` VARCHAR(200) NOT NULL  AFTER `brand_site`;

在语言包文件里/languages/zh-cn/admin.lang.php加入如下:
$LANG['brand_nationality'] = '品牌国籍';
$LANG['brand_site'] = '品牌网址';
$LANG['brand_business'] = '品牌主营';

在添加栏目模板文件里/modules/admin/templates/category_add.tpl.php加入如下:
<tr>
<th><?php echo L('brand_nationality');?></th>
<td><input name='info[brand_nationality]' id='brand_nationality' type='text' class="input-text" value='' size='40' maxlength='40'></td>
</tr>
<tr>
<th><?php echo L('brand_site');?></th>
<td><input name='info[brand_site]' id='brand_site' type='text' class="input-text" value='' size='60' maxlength='60'></td>
</tr>
<tr>
<th><?php echo L('brand_business');?></th>
<td><input name='info[brand_business]' id='brand_business' type='text' class="input-text" value='' size='70' maxlength='70'></td>
</tr>

在添加栏目模板文件里/modules/admin/templates/category_edit.tpl.php加入如下:
<tr>
<th><?php echo L('brand_nationality');?></th>
<td><input name='info[brand_nationality]' id='brand_nationality' type='text' class="input-text" value='<?php echo $brand_nationality;?>' size='40' maxlength='40'></td>
</tr>
<tr>
<th><?php echo L('brand_site');?></th>
<td><input name='info[brand_site]' id='brand_site' type='text' class="input-text" value='<?php echo $brand_site;?>' size='60' maxlength='60'></td>
</tr>
<tr>
<th><?php echo L('brand_business');?></th>
<td><input name='info[brand_business]' id='brand_business' type='text' class="input-text" value='<?php echo $brand_business;?>' size='70' maxlength='70'></td>
</tr>

@调用方法
{pc:content action="category" catid="0" num="10" siteid="$siteid" order="listorder ASC"}
<ul>
<li><a href="{siteurl($siteid)}"><span>首页</span></a></li>
{loop $data $r}
<li><a href="{$r[url]}"><span>{$r[catname]} {$r[brand_nationality]}</span></a></li>
{/loop}
</ul>
{/pc}

郑重声明:

1 本资源来源于互联网,资源的版权归资源原作者所持有,受《中华人民共和国著作权法》等相关法律保护。

2 由于无法和原作者取得联系,所以上传的部分资源无法先通过原作者的同意就分享给大家了,如本资源侵犯了您(原作者)的权益,请联系我们(微信号 xiaohaimei1989),我们会立马删除您的资源,并向您表达诚挚的歉意!

3 本站是一个公益型网站,分享资源的目的在于传播知识,分享知识,收取一点点打赏的辛苦费是用于网站的日常运营开支,并非用于商业用途。

4 本站资源只提供学习和参考研究使用,使用过后请在第一时间内删除。本站不承担资源被单位或个人商用带来的法律责任。

发表评论