Home > CMS Tutorial > PHPCMS > How does phpcms determine whether it is the home page?

How does phpcms determine whether it is the home page?

angryTom
Release: 2020-02-15 14:44:43
Original
2033 people have browsed it

How does phpcms determine whether it is the home page?

phpcms如何判断是不是首页

Phpcms V9判断是否首页具体代码是:

{if !$catid}我是首页{/if}
Copy after login

判断依据是:首页$catid变量为空,所以判断他是否有值即可判定是否首页。

在此,再附带送上只有首页调用友情连接的代码:

{if !$catid}
    <div class="friendlink">
        <ul>
            <li><h3>友情链接:</h3></li>
            {pc:link  action="type_list" siteid="$siteid" order="listorder DESC" num="10" return="dat"}
            <li><a href="{siteurl($siteid)}/" target="_self" title="{$SEO[&#39;site_title&#39;]}">{$SEO[&#39;site_title&#39;]}</a></li>
            {loop $dat $v}{if $type==0}
                <li><a href="{$v[url]}" target="_blank" title="{$v[name]}">{$v[name]}</a>{else}<a href="{$v[url]}" target="_blank" title="{$v[name]}"><img src="{$v[logo]}" width="88" height="31" style="border: 0px"></a></li>{/if}
            {/loop}
            {/pc}
            <li><a href=""><strong>申请友链 &gt;&gt;</strong></a></li>
        </ul>
    </div>
{/if}
Copy after login

这样,就可以放在统一的footer代码里边,自动识别是否首页,如果是首页则调用推荐友情连接,如果不是首页则不显示。

相关推荐:phpcms教程

The above is the detailed content of How does phpcms determine whether it is the home page?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template