如果$ page = name,你如何隐藏特定的内容 [英] How do you hide specific content if $page = name

查看:131
本文介绍了如果$ page = name,你如何隐藏特定的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何隐藏特定内容如果$ page = name



例如:

 <?php 
if($ page =='special'){
echo< div> hello< / div>;
}
?>

以上示例将显示$ page = special的div。

编辑:

$ b如何做到与此相反,隐藏特定的div
$ b

更具体地说,我想在$ clients页面上隐藏我的主导航。



包装< nav> 使用PHP,或者可以隐藏特定的div,例如,如果我给它一个名字。 < nav id =clients> PHP将是:if $ clients 然后隐藏名为clients的id 。

我还应该提及有问题的内容<?php echo $ url;



这是我想隐藏在$ clients页面上的确切内容。

 < nav> 
< ul>
< li>< a<?php if($ page ==work)echoclass = \current \?> href =<?php echo $ url;?>标题= 工作 >工作< / A>< /锂>
< li>< a<?php if($ page ==profile)echoclass = \current \? href =<?php echo $ url;?> profile /title =Profile>个人资料< / a>< / li>
< li>< a<?php if($ page ==approach)echoclass = \current \?> href =<?php echo $ url;?> approach /title =Approach> Approach< / a>< / li>
< li>< a<?php if($ page ==contact)echoclass = \current \?> href =<?php echo $ url;?> contact /title =联系人>联系人< / a>< / li>
< / ul>
< / nav>


解决方案

如果您希望每隔一页如果($ page!='special'){
echo')特殊

 <?php 
< DIV>你好< / DIV>中;
}
?>


How do you hide specific content if $page = name

For example:

<?php
if ($page=='special'){
    echo "<div>hello</div>";
}
?>

The above example will show the div if the $page = special. How do I do the opposite of this, hide a specific div if the $page = something?

Edit:

To be more specific I would like to hide my main navigation when on the $clients page.

Do I wrap the <nav> with PHP or is it possible to hide a specific div if I give it a name, for example. <nav id="clients"> the PHP would be: if $clients then hide the id named clients.

I should also mention that the content in question has <?php echo $url; ?> and the likes contained within it.

This is the exact content I would like to hide on $clients pages.

<nav>
<ul>
<li><a <?php if ($page=="work") echo "class=\"current\"" ?> href="<?php echo $url; ?>" title="Work">Work</a></li>
<li><a <?php if ($page=="profile") echo "class=\"current\"" ?> href="<?php echo $url; ?>profile/" title="Profile">Profile</a></li>
<li><a <?php if ($page=="approach") echo "class=\"current\"" ?> href="<?php echo $url; ?>approach/" title="Approach">Approach</a></li>
<li><a <?php if ($page=="contact") echo "class=\"current\"" ?> href="<?php echo $url; ?>contact/" title="Contact">Contact</a></li>
</ul>
</nav>

解决方案

If you want it on every other page that is not special

<?php
if ($page!='special'){
    echo "<div>hello</div>";
}
?>

这篇关于如果$ page = name,你如何隐藏特定的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆