0

我不完全确定如何解释这一点,但我会尽力而为。我对此很陌生:/

这是我正在使用的基本模板,我将其作为包含,并将其包含在我的所有页面中。一切正常,但是,我希望能够在模板的正文区域中放置不同的文本/内容每一页。现在,每当我向页面添加内容时,模板正文区域都保持空白,并且我添加的所有内容都位于整个模板的下方。

<html>
<head>
<title>Title</title>
<style>
/* Start CSS */

/* This changes your link colors */
A:link 
{ text-decoration: none; color: #003399; }
A:visited 
{ text-decoration: none; color: #003399; }
A:active
{ text-decoration: none; color: #003399; }
A:hover 
{ text-decoration: none; color: #6666FF; }


/* This changes the basic properties of your layout */
body
{ font-family: Verdana; sans serif; helvetica;
color: #333333;
font-size: 10px;
background-color: #778899;
background-image: url('../ ');
text-align: justify;
margin-bottom: 5px; 
margin-right: 0px; 
margin-top: 5px;
}

/* This code centers the layout */
#container {
margin:0px auto 0px auto;
width:100%;
text-align:center;
}


/* Leave this be */
#container2 {
width: 1100px;
text-align: left;
margin: 0px auto;
position: relative;
min-height: 300px;
}


/* This code controls the properties of your left menu */
#leftmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333333;
font-size: 10px;
background-color: #E8E8E8;
background-image: url('../ ');
text-align: left;
border: 0px solid #000000;
width:160px;
padding:10px;
}
/* This code controls the link boxes on the sidebars */
a:link,a:visited
{
display:block;
font-weight:bold;
color:#FFFFFF;
background-color:#98bf21;
width:160px;
text-align:center;
padding:4px;
text-decoration:none;
}
a:hover,a:active
{
background-color:#7A991A;
}


/* This code controls the properties of your right menu */
#rightmenu
{ font-family: Verdana; sans serif; helvetica;
color: #333333;
font-size: 10px;
background-color: #E8E8E8;
background-image: url('../ ');
text-align: right;
border: 0px solid #000000;
width:160px;
padding:10px;
}


/* This code is not mandatory, but sets a background for the menu headers */
#menuheader
{ font-family: verdana; helvetica; sans serif;
color: #333333;
font size: 10px;
background-color: #CCCCCC;
background-image: url('../ ');
text-align: center;
margin-top: 5px;
padding:3px;
}

/* This code controls the properties of your content */
#content
{ font-family: Verdana; sans serif; helvetica;
color: #333333;
font-size: 10px;
background-color: #FFFFFF;
background-image: url('../ ');
border: 0px solid #000000;
padding:10px;
}


/* This code controls the properties of your disclaimer */
#disclaimer
{ font-family: Verdana; sans serif; helvetica;
color: #333333;
font-size: 10px;
background: #CCCCCC;
background-image: url('../ ');
border: 0px solid #000000;
text-align:center;
width:1100px;
height:90px;
padding:10px;
}


/* This code controls the properties of your banner */ 
#banner
{ background: #CCCCCC;
background-image: url('../Images/Banner.png');
border: 0px solid #000000;
text-align:center;
width:1100px;
height:200px;
}


/* This sets the properties for content headers */
h1
{ font-family: verdana; sans serif;
font-size: 15px;
font-weight: bold;
font-variant: small-caps;
align:center;
}


/* End CSS */

</style>
</head>
<body leftmargin="0" rightmargin="0" topmargin="10" bottommargin="10">
<div id="container">
<div id="container2">

<table cellspacing="0" cellpadding="0" border="0">
<tr><td valign="top" id="banner" colspan="3"></td></tr>
   <tr>
      <td valign="top" id="leftmenu">

<!-- Start Left Menu -->

         <div id="menuheader">Home</div>
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a>

         <div id="menuheader">Shops</div>
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a>


<!-- End Left Menu-->

      </td>
      <td valign="top" id="content">
         <div align="justify">

<!-- Start Content -->



<!-- End Content -->
</div>
      </td>
      <td valign="top" id="rightmenu">

<!-- Start Right Menu -->

         <div id="menuheader">Ranks</div>
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a>

         <div id="menuheader">Maps</div>
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a><br />
         <a href="#">Link Here</a>

<!-- End Right Menu -->

      </td>
   </tr>
   <tr>
      <td valign="top" id="disclaimer" colspan="3">

<!-- Start Disclaimer -->

Add disclaimer.

<p>

<!-- End Disclaimer -->

      </td>
   </tr>
</table>
</div>
</div>
</body>
</html>

我知道这可能是一些非常简单的愚蠢的事情,但我不知道。

4

3 回答 3

0

好吧,也许不是最好的方法,但它确实有效。

添加echo body_content();到主模板的正文标签,然后在每个页面上做这样的内容

function body_content(){
   echo 'simple content';
}
于 2013-03-26T03:01:01.510 回答
0

PHP include() 表示嵌入文件内容。它将根据它的实际顺序进行解析。我猜你需要一些框架。您不能仅通过包含文件并在其后立即放置东西来在该正文模板上放置一些东西。

于 2013-03-26T02:57:50.273 回答
0

我不会继续走这条路。包含对于您需要在每个页面上重复的内容很有帮助,例如页脚、侧边栏、导航、页眉等。您可以将所有这些内容复制到某些包含中,但使用单独的 .html 或 .html 会更有意义。每个页面的 php 文档。或者,使用像 jQuery mobile 这样的框架,但听起来你还没有准备好。祝你好运!

于 2013-03-26T03:10:28.247 回答