2013-03-26 76 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這樣的框架,但它聽起來並不像你準備好的那樣。祝你好運!