TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Breaking Pages Up (http://www.talkphp.com/general/4689-breaking-pages-up.html)

rguy84 07-06-2009 12:02 AM

Breaking Pages Up
 
I am playing around with an idea. I have both a breadcrumb and a YUI menu bar on my page. I took from the opening <html> tag to the opening main content tag and threw them all into a file and include that. I gave the text that goes between <title> a variable. So now each page on the back end looks like:
PHP Code:

<?php
  $page_title 
'xxx';
  
$bread 'YYY'// I give my pages {sitename} :: {article title}
  
include_once('header.php');
?>
  {content}
<?php 
  
include_once('footer.php');
?>

This makes things so much cleaner and faster. However now the source layout looks crappy. Has anybody done this? Thoughts?

adamdecaf 07-06-2009 12:50 AM

I did it with the meta tags on my personal site, it works. It's neither really good or really bad.

rguy84 07-06-2009 07:49 AM

I am not sure what you mean. If you took that chunk of code, wrote a paragraph in place of {content} and saved it as something.php, the page would fully work...

ScottRiley 07-06-2009 06:46 PM

If I understand what you're talking about correctly, I do it all the time, separate PHP files for; top navigation, any sidebars that appear on multiple pages, the footer and the breadcrumb if I'm using one.

I code the general layout I want of the site using CSS-styled DIVs and then include all the pages with PHP.

Just so much better, if your nav changes, you change one file, if your footer changes, you change one file, if a site contains 2 or more pages that share common elements then I believe that these common elements should be put in their own file, it just makes everything so much easier.

What problems are you having with the source layout?


All times are GMT. The time now is 02:41 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0