«

Emlog判断首页与列表页的方法分享

时间:2015-8-2 15:17     作者:admin     分类: emlog


判断首页函数的方法下(ps:测试5.3.1版本正常使用)

1、在模版文件module.php最低部加入如下代码


<pre style="overflow:auto" ;class="prettyprint lang-php linenums"><?php //判断是否是首页
function blog_tool_ishome(){if (BLOG_URL . trim(Dispatcher::setPath(), '/') == BLOG_URL){ return true; } else { return FALSE;}}?>
2、判断方法示例



<pre style="overflow:auto" ;class="prettyprint lang-php linenums"><?php if (blog_tool_ishome()) :?>加载的文件代码<?php endif; ?>
如果在首页不需要加载日志列表部分。则应用如下:



<pre style="overflow:auto" ;class="prettyprint lang-php linenums"><?php if (blog_tool_ishome()) :?>
<?php include View::getView('index');?>
<?php else:?>
加载日志列表部分
<?php endif;?>


标签: emlog

版权所有:Mrxn's Blog
文章标题:Emlog判断首页与列表页的方法分享
除非注明,文章均为 Mrxn's Blog 原创,请勿用于任何商业用途,转载请注明作者和出处 Mrxn's Blog

扫描二维码,在手机上阅读