开发者

same layout across multiple xhtml files

开发者 https://www.devze.com 2022-12-18 07:49 出处:网络
Is it possible to reference one xhtml file (say a menu) from multiple xhtml files? Sort of like how external css is used to avoid multiple instances of the same code.

Is it possible to reference one xhtml file (say a menu) from multiple xhtml files? Sort of like how external css is used to avoid multiple instances of the same code.

I want the layout to reside in one place in case I nee开发者_JAVA百科d to make changes later on.


You need to use some kind of server side scripting language to import your template files. In PHP, you could do something like this:

<html>
<head>
</head>
<body>
    <?php include('menu.html'); ?>
    <div id="content">
        Page specific content here.
    </div>
    <?php include('footer.html'); ?>
</body>
</html>

XHTML on itself does not support importing files.

0

精彩评论

暂无评论...
验证码 换一张
取 消