[英]Html theme for every page
I'm creating a theme for my php
project. 我正在为我的
php
项目创建一个主题。 I want to decrease my code amount by creating a simple theme.html
page and include that to every page. 我想通过创建一个简单的
theme.html
页面来减少代码量,并将其包含在每个页面中。
Can you help me guys? 你能帮我吗?
Example 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>
And now i want to include this code to index.html
and write form codes to content div? 现在,我想将此代码包括到
index.html
并将表单代码写入到内容div? Help me... 帮我...
您可以使用php来做到这一点,因为您必须将.php
类的.php
文件保存index.html into index.php
然后包含如下文件
<?php include 'theme.php';?>
您还可以使用twig ,它是php的出色模板管理器(最初是为Symfony制作的),非常易于使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.