Phpcms v9专题设置里面,默认专题子分类是无模板设置的,本文教你通过官方论坛给出的教程实现专题分类增加模板设置。先来看看默认专题子分类设置界面: |
修改后的的专题子分类设置界面多了模板设置: |
修改方法 |
第一步:修改 phpcms\modules\special index.php |
找到 |
$list_template ? $list_template : 'list' ; |
替换成 |
$template = $info [ 'template' ] ? $info [ 'template' ] : ( $list_template ? $list_template : 'list' ); |
第二步 修改 phpcms\modules\special special.php |
找到 |
`typedir` |
替换成 |
`typedir`, `template` |
第三步 修改 phpcms\modules\special\templates special_add.tpl.php |
找到 |
</span> <span id= "typeTip" > |
替换成 |
<?php echo form::select_template( 'default' , 'special' , 'list' , 'name="type[1][template]"' , 'list' );?></span> <span id= "typeTip" > |
找到 |
var n = $( '#option_list' ).find( 'input[name]' ).length/3+1; |
替换成 |
var n = $( '#option_list' ).find( 'input[name]' ).length/3+1; |
var template = '<?php echo str_replace("' ", "\'" , form::select_template(' default ', ' special ', ' list ', ' name= "type[|id|][template]" ', ' list '));?>' ; |
找到 |
</span> <a href= "javascript:;" |
替换成 |
'+template.replace(' |id| ', n)+' </span> <a href= "javascript:;" |
第三步 修改 phpcms\modules\special\templates special_edit.tpl.php |
找到 |
</span> <?php if ( $k !=1) |
修改成 |
<?php echo form::select_template( 'default' , 'special' , $t [ 'template' ], 'name="type[' . $k . '][template]"' , 'list' );?> </span> <?php if ( $k !=1) |
找到 |
var n = $( '#option_list' ).find( 'input[type="text"]' ).length/3+1; |
替换成 |
var n = $( '#option_list' ).find( 'input[type="text"]' ).length/3+1; |
var template = '<?php echo str_replace("' ", "\'" , form::select_template(' default ', ' special ', ' list ', ' name= "type[|id|][template]" ', ' list '));?>' ; |
找到 |
</span> <a href= "javascript:;" |
替换成 |
'+template.replace(' |id| ', n)+' </span> <a href= "javascript:;" |
修改完了 可以去添加模版了 比如 list_hehe.html 然后专题页面就可以自动搜索到了 |