Template Splitting Problem.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apking
    New Member
    • Feb 2007
    • 32

    Template Splitting Problem.

    Hi Friends,

    Iam new to PHP.i am designing a CSS layout.Now i need to split the head and footer and left parts.then include those files in every page.This is mu code How to split this.and splitted parts save to PHp files.Please help me?
    [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Aatapaat a</title>
    <link href="css/aata.css" rel="stylesheet " type="text/css" />
    <link href="css/tag.css" rel="stylesheet " type="text/css" />
    </head>
    <body><center >
    <div id="main">
    <div id="headerlogo" ><img src="images/1.gif" align="left"/>
    <div id="toplinks">
    <p>|<img src="images/home.gif" class="topimage " /><a href="#"> Home</a> |<img src="images/sitemap.gif" class="topimage " /> <a href="#"> Sitemap</a> | <img src="images/contact.gif" /><a href="#"> Reach us</a> |</p>
    </div>
    </div>
    <div><img src="images/bg1.gif" width="800" height="2" style="backgrou nd-repeat:repeat; padding-bottom:1px" /></div>
    <div id="headimage"> <img src="images/headerimage.gif " /></div>
    <div id="navmenu">
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Movies </a></li>
    <li><a href="#">Regist er</a></li>
    <li><a href="#">MyAcco unt</a></li>
    <li><a href="#">Find a Song</a></li>
    <li><a href="#">Feedba ck</a></li>
    </ul>
    </div>
    </div>
    <div id="page">
    <div id="container" >
    <div id="center"></div>
    <div id="leftside">
    <h1>Forthcoming </h1>
    <img src="images/imagelogo.jpg"/>
    <h1>Find a Song</h1>
    <select>
    <option>Artis t</option>
    <option>Directo r</option>
    <option>Music Director</option>
    </select>
    <div>&nbsp;</div>
    <select>
    <option>Artis t</option>
    <option>Directo r</option>
    <option>Music Director</option>
    </select>
    <div>&nbsp;</div>
    <select>
    <option>Artis t</option>
    <option>Directo r</option>
    <option>Music Director</option>
    </select>
    <br /><br/>
    <input type="button" value="Search" name="search"/>
    </div>
    <div id="rightside"> </div>
    <div id="footer"><p> Copyright© 2008 &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;
    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nb sp;&nbsp; | <a href="#">Discla imer</a> | <a href="#">Privac y Policy</a> | <a href="#">Terms & Conditions</a> |</p>
    </div>
    </div>
    </div>
    </center>
    </body>
    </html>
    [/HTML]
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    Make a php file called: header.php with the following:
    [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Aatapaat a</title>
    <link href="css/aata.css" rel="stylesheet " type="text/css" />
    <link href="css/tag.css" rel="stylesheet " type="text/css" />
    </head>
    <body><center >
    <div id="main">
    <div id="headerlogo" ><img src="images/1.gif" align="left"/>
    <div id="toplinks">
    <p>|<img src="images/home.gif" class="topimage " /><a href="#"> Home</a> |<img src="images/sitemap.gif" class="topimage " /> <a href="#"> Sitemap</a> | <img src="images/contact.gif" /><a href="#"> Reach us</a> |</p>
    </div>
    </div>
    <div><img src="images/bg1.gif" width="800" height="2" style="backgrou nd-repeat:repeat; padding-bottom:1px" /></div>
    <div id="headimage"> <img src="images/headerimage.gif " /></div>
    <div id="navmenu">
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Movies </a></li>
    <li><a href="#">Regist er</a></li>
    <li><a href="#">MyAcco unt</a></li>
    <li><a href="#">Find a Song</a></li>
    <li><a href="#">Feedba ck</a></li>
    </ul>
    </div>
    </div>
    [/HTML]And a file called footer.php:[HTML]<div id="footer"><p> Copyright© 2008 aatapaata.com&n bsp;&nbsp;&nbsp ;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nb sp;&nbsp; | <a href="#">Discla imer</a> | <a href="#">Privac y Policy</a> | <a href="#">Terms & Conditions</a> |</p>
    </div>
    </div>
    </div>
    </center>
    </body>
    </html>[/HTML]And then in your main page you will have:[PHP]<?php
    include('header .php');
    ?>
    <div>
    {YOUR PAGE CONTENT}
    </div>
    <?php
    include('footer .php')
    ?>[/PHP]I have probably not broken up your code correctly, but you can put any common code in the header.php and footer.php and it will be read exactly the same as if it was all there as one file.

    Comment

    Working...