我正在为我的php
项目创建一个主题。我希望通过创建一个简单的theme.html
页面来减少代码量,并将其包含到每个页面中。
你们能帮我吗?
示例theme.html
<html>
<body>
<h1>Welcome to panel</h1>
<ul>
<li><a class="home" href="#">Home</a></li>
<li><a class="about" href="#">About us</a></li>
<li><a class="contact" href="#">Contact us</a></li>
</ul>
<!-- content -->
<div class="content"><!-- other page codes will write here --></div>
<!-- content -->
</body>
<html>
现在,我想把这些代码包含到index.html
中,并将表单代码写入内容div?帮我..。
发布于 2018-08-02 08:05:50
您可以使用php进行操作,因为您必须保存.php
类似于index.html into index.php
的文件,然后包括如下所示的文件
<?php include 'theme.php';?>
发布于 2018-08-02 08:32:27
您还可以使用细枝,它是php的一个很好的模板管理器(最初是为Symfony制作的),并且非常容易使用。
https://stackoverflow.com/questions/51648325
复制相似问题