先将echo_log.php中顶部php代码?>之后的所有代码清空,
这里echo_log.php在此处用作中转用,
不做模板使用,
添加以下代码
- <?php
- if($sortid == "1"){
- //分类id为1时用模板echo_log1.php
- require_once View::getView('echo_log1');
- }else if($sortid == "2"){
- //分类id为2时用模板echo_log2.php
- require_once View::getView('echo_log2');
- }else if($sort == "$log"){
- //其它分类用模板echo_log3.php
- require_once View::getView('echo_log3');
- }
- ?>
最后直接加在echo_log.php中if(!defined('EMLOG_ROOT')) {exit('error!');}的后面,
- if($sortid==1){include View::getView('echo_log1');exit;}
- if($sortid==3){include View::getView('echo_log3');exit;}
分类id为1时使用模板echo_log1.php,
为3时使用模板echo_log3.php,
否则仍使用echo_log.php,
温馨提示
不同作者也可以使用此方法,
只需要把其中的sortid改为author即可.