2013-03-26 59 views
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> 

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

+0

如果可以的话,你从哪儿弄来从模板? – egig 2013-03-26 02:52:38

+0

我真的不记得我只是在一个文件中很长一段时间,并碰到它。 – Sakai 2013-03-26 02:53:35

回答

0

PHP包括()表示嵌入文件的内容。它会根据它的实际顺序进行分析。我想你需要一些框架。你不能在这个body模板上加入一些东西,只需要包含这个文件,然后把东西放在那里。

0

也许不是最好的方式做到这一点,但它确实工作。

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

function body_content(){ 
    echo 'simple content'; 
} 
0

我不会继续走这条道路。包括是,你需要重复每个页面上,像一个页脚,侧边栏,导航,标题等,你可以复制所有的东西到一些东西,包括有益的,但它会做很多更有意义的.html单独或。每个页面的PHP文档。或者,使用像jQuery mobile这样的框架,但它听起来并不像你准备好的那样。祝你好运!