millsy007 Posted October 22, 2008 Share Posted October 22, 2008 I have set up two pages, content.php and template.php, I was the content.php file to contain a variable that will contain all the html for my content that will then be displayed within my template.php file, mostly this works fine. However the problem I have is that I want additional html in my content.php file so that when other people are editing it looks more like the finished file. My problem is that when I add this additional html it is being passed into the template.php file even though it is not within the content variable. Hopefully this code snippet will explain it: template.php <html><head><head><body <table width="100%" cellpadding="10" cellspacing="0"><tr><td width="30%" valign="top" bgcolor="#EEEEEE"> Beach Hostel is located right next to one of Holland’s beautiful beaches. There’s nothing that can beat the sound of waves and the tranquility of the beach-life, especially after you’ve been surrounded by the madness of the city (of Amsterdam) for a while. This Flying Pig Hostel is known for offering you the best chill out spot you can imagine; in this backpacker hostel you can relax, smoke, hang out with friends, party or challenge your limits and abilities in various beach sports! </td> <td width="70%" valign="top"> <?php echo $content; ?> </td></tr></table> </body></html> content.php <p>TEST CONTENT - this is displayed even though it is outside the php tags?</p> <?php ob_start(); ?> <p>The Beach Hostel is located right next to one of Holland’s beautiful beaches. There’s nothing that can beat the sound of waves and the tranquility of the beach-life, especially after you’ve been surrounded by the madness of the city (of Amsterdam) for a while. This Flying Pig Hostel is known for offering you the best chill out spot you can imagine; in this backpacker hostel you can relax, smoke, hang out with friends, party or challenge your limits and abilities in various beach sports!</p> <?php //Assign all Page Specific variables $content = ob_get_contents(); ob_end_clean(); //Apply the template include("template.php"); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.