代码之家  ›  专栏  ›  技术社区  ›  Jaakko Seppälä

php+css多站点通用代码

  •  0
  • Jaakko Seppälä  · 技术社区  · 15 年前

    我正在学习使用PHP、CSS和XHTML。我想做一个有共同风格的多个网站?我如何做一些一般的背景和如何导入到我的所有网站?我希望每一页都有以下代码:

    <div id="document">
    <div class="nav">
    <ul>
    <li><a href="site/register">Register</a></li>
    <li><a href="site/login">Log in</a></li>
    </ul>
    </div>
    </div>
    </ul>
    
    2 回复  |  直到 15 年前
        1
  •  2
  •   drew    15 年前

    尝试使用include: http://php.net/manual/en/function.include.php

    <?php include("standardpage.php"); ?>
    

    或者像这样通过网络:

    include('http://www.example.com/mymenu.html');
    

    对于CSS样式表,可以使用:

    <LINK rel="stylesheet" href="http://www.example.com/sharedstylesheet.css" type="text/css" />