@描述使用系统默认编辑器
进入如下模板文件
/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}