douchujian8124 2014-04-10 15:56 采纳率: 100%
浏览 28
已采纳

在导航到不同的页面时更改我的网站标题的外观[关闭]

Hi i am new to web development. I am making a website of eCommerce. I have different pages in my website. For all pages i have made a header.php file because header remains almost same on different pages. But i want to customize my header in some cases. Like if i go to signin page from my home page then i would want my search bar to hide. how can i do this. do i have to make different header files for all pages or is there any other way too.

<?php require_once "header.php";?>

now on my signin page i am using my already made header.php file like this as shown in the above line. in my header.php i have my logo ,a search bar , sign in and signup option etc. that is fine for the home page but when i go to the signin page i want search bar as well as sign in and signup options to hide. i have tried this but still not working

<?php if ($_SERVER['REQUEST_URI']!="http://localhost/projectt/sign-up.php")    

      { echo '<div id="nav-search">
       <form>
       <table>
       <tr>
       <td>Search</td>
       <td><input type="text" placeholder="search for items" id="textbox" size="15px"/></td>
       <td><button type="submit" id="search" name="search" ></td>
       </tr>
       </table>
       </form>

       </div>
        </div>';
} 
?>
  • 写回答

1条回答 默认 最新

  • dsai1991 2014-04-10 16:01
    关注

    You can do this in two ways:

    1. (the one I would choose) Write your customised code for the login page and put it directly into the file
    2. Write a condition like this into header.php

      if($_SERVER['REQUEST_URI']!="addressofyourloginpage"){
      //the code you want to hide
              }
      
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号