PHP网站设计一页 [英] php website one page for design

查看:152
本文介绍了PHP网站设计一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了创建一个拥有6个页面的php网站,并且每个页面的结构都是相同的,唯一改变的是内容,同样的标题,相同的设计和相同的页脚,像我之前说的那样改变的唯一的东西就是内容本身。



所以我想的不是有很多页面,我只能有一个设计页面,并且只更改内容,你有什么建议?,以及我该怎么做?我也不打算安装Typo3,wordpress,joomla或任何在我的服务器上的东西,所以我想要使用php idk做的事情。谢谢!

解决方案

最简单的解决方案是创建单独的文件。


  • header.php

  • footer.php

  • menu.php

>

header.php中将您的代码放在标题中

 <?php?> 
< HTML>
< HEAD>
< / HEAD>
< BODY>
...
<? ?>

同样适用于页脚和菜单文件。



然后你可以通过包括它们来使用它。



你的index.php可能看起来像下面这样。

 <?php 
include(header.php);
include(menu.php);
?>

< h1>这是我的内容< / h1>

<?php
include(footer.php);
?>

对于不想花钱使用模板,CMS等的人来说,这是最简单的选择。 。你也可以创建一个名为header的函数,它带有$ title并改变你窗口的标题。由你决定。


I'm done creating a php website that has 6 pages, and the structure of the pages is the same for each one of them, the only thing that changes is the content, so is the same header, same design and same footer, the only thing that changes like I said before is the content itself.

so i was thinking instead of having many pages, I could have only one design page, and change only the content, what do you recommend?,and how do I do that?, also im not planning installing anything like Typo3, wordpress, joomla or whatever in my server, so I want something i could do using php idk. thank you!

解决方案

Simplest solution is to create separate files.

  • header.php
  • footer.php
  • menu.php

In header.php put your code from header

<?php ?>
<HTML>
<HEAD>
</HEAD>
<BODY>
...
<? ?>

Same goes for footer and menu files.

Then you can use it by including them.

Your index.php could look like following.

<?php 
include("header.php");
include("menu.php");
?>

<h1> This is my content </h1>

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

This is the easiest option I think for someone who doesn't want to spend using templates, CMS etc. Also you can create function called header that takes $title and changes title of your window. Up to you.

这篇关于PHP网站设计一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆