How to store nav bar in one file?

前端 未结 5 1487
囚心锁ツ
囚心锁ツ 2021-01-30 11:39

I have a navigation bar for my website:

    
  • Home
5条回答
  •  面向向阳花
    2021-01-30 12:02

    Assuming you are using a scripting language such as PHP, you simply save that HTML above in a php file called header.php (or something to your liking)

    Then in your other php files you write:

    include_once('header.php'); and it will plop that HTML right in there.

    Some resources for you:

    http://php.net/manual/en/function.include.php

    http://www.php.net/manual/en/function.include-once.php

    http://php.about.com/od/tutorials/ht/template_site.htm

    Enjoy!

提交回复
热议问题