在母版页中包含内容页面 [英] Include Content pages in Master page

查看:72
本文介绍了在母版页中包含内容页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关使用PHP的方法的反馈。


以下是主页的精简版:index.php。


网站内容显示在页面中间,

是包含的内容。通过Page1.htm,Page2.htm或Page3.htm。


要包含的页面通过在导航超链接中指定的QueryString

指定;例如,
,index.php?Page1。

< html>

< head>

< title><?php echo $ _SERVER [" PHP_SELF"]?>< / title>

< / head>

< body>

< table border =" 0" CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 100%"

height =" 100%">

< tr>

< td bgcolor = QUOT;绿色" colspan =" 3">& nbsp;< / td>

< / tr>

< tr>

< td bgcolor =" red" width =" 5"%>& nbsp;< / td>

< td bgcolor =" white" width =" 90%">

< p align =" center">

< a href =" index.php?Page1" > Page 1< / a |

< a href =" index.php?Page2"> Page 1< / a |

< a href = " index.php?Page3"> Page 3< / a>

< hr>

< / p>

< ; - - 下面的内容 - >

<?php

$ QS = $ _SERVER [" QUERY_STRING"];

echo $ QS;

if($ QS ==" Page1")包括" Page1.htm";

elseif($ QS ==" Page2")包括Page2.htm;

elseif($ QS ==" Page3")包括Page3.htm;

其他包括Page1.htm ;;

?>

<! - 上面的内容 - >

< br>< br>

< / td>

< td bgcolor =" blue" width =" 5%">& nbsp;< / td>

< / tr>

< tr>

< td bgcolor =" yellow" colspan =" 3">& nbsp;< / td>

< / tr>

< / table>

< / body>

< / html>


我看到这种方法的一个优点是内容页面

与主相关联。页面,并且可以很容易地维护。


我看到这种方法的一个缺点是搜索引擎

将无法在主页之外对网站进行编目。


还有其他缺点(或其他考虑因素)我看不到吗?


提前致谢。


PS我是PHP的新手,但已与ASP合作多年。

I am looking for feedback on an approach to using PHP.

Below is a stripped down version of a Home page: "index.php".

The content of the site is displayed in the middle of the page and
is "included" via "Page1.htm", "Page2.htm", or "Page3.htm".

The page to be "included" is specified via the QueryString
which is specified in the navigational hyper links;
for example, "index.php?Page1".
<html>
<head>
<title><?php echo $_SERVER["PHP_SELF"] ?></title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%"
height="100%">
<tr>
<td bgcolor="green" colspan="3">&nbsp;</td>
</tr>
<tr>
<td bgcolor="red" width="5"%>&nbsp;</td>
<td bgcolor="white" width="90%">
<p align="center">
<a href="index.php?Page1">Page 1</a|
<a href="index.php?Page2">Page 1</a|
<a href="index.php?Page3">Page 3</a>
<hr>
</p>
<!-- Content Below -->
<?php
$QS = $_SERVER["QUERY_STRING"];
echo $QS;
if ($QS == "Page1") include "Page1.htm";
elseif ($QS == "Page2") include "Page2.htm";
elseif ($QS == "Page3") include "Page3.htm";
else include "Page1.htm";
?>
<!-- Content Above -->
<br><br>
</td>
<td bgcolor="blue" width="5%">&nbsp;</td>
</tr>
<tr>
<td bgcolor="yellow" colspan="3">&nbsp;</td>
</tr>
</table>
</body>
</html>

One advantage I see to this approach is that the "content" pages
are isolated from the "master" page and can be easily maintained.

One disadvantage I see to this approach is that search engines
would not be able to catalog the site beyond the Home page.

Are there other disadvantages (or other considerations) that I don''t see?

Thanks in advance.

P.S. I am new to PHP but have worked with ASP for years.

推荐答案

_SERVER [" PHP_SELF"]?>< / title>

< / head>

< body>

< table border =" 0" CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 100%"

height =" 100%">

< tr>

< td bgcolor = QUOT;绿色" colspan =" 3">& nbsp;< / td>

< / tr>

< tr>

< td bgcolor =" red" width =" 5"%>& nbsp;< / td>

< td bgcolor =" white" width =" 90%">

< p align =" center">

< a href =" index.php?Page1" > Page 1< / a |

< a href =" index.php?Page2"> Page 1< / a |

< a href = " index.php?Page3"> Page 3< / a>

< hr>

< / p>

< ; - - 下面的内容 - >

<?php
_SERVER["PHP_SELF"] ?></title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%"
height="100%">
<tr>
<td bgcolor="green" colspan="3">&nbsp;</td>
</tr>
<tr>
<td bgcolor="red" width="5"%>&nbsp;</td>
<td bgcolor="white" width="90%">
<p align="center">
<a href="index.php?Page1">Page 1</a|
<a href="index.php?Page2">Page 1</a|
<a href="index.php?Page3">Page 3</a>
<hr>
</p>
<!-- Content Below -->
<?php


QS =


_SERVER [" QUERY_STRING"];

echo
_SERVER["QUERY_STRING"];
echo


这篇关于在母版页中包含内容页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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