Webpage full made of only includes

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Webpage full made of only includes

Post by davidtube »

Just wondering if people ever make pages like this ?

Code: Select all

<html>
<?php
include header.php;
include top.php;
include middle.php;
include bottom.php;
?>
</html>
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Webpage full made of only includes

Post by aceconcepts »

I don't think it would offer much flexibility for future development.

Is this how you're planning to structure your site?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Webpage full made of only includes

Post by Chris Corbyn »

I think what you're referring to is a "composite view". That's a very common way of piecing together the components on the page. If you've got complicated logic (i.e. business logic) inside any of those includes then there are better ways of structuring things :)
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Re: Webpage full made of only includes

Post by davidtube »

Well it's a simplified version of what I was thinking of. More likely It'll be more like this:

Code: Select all

<html>
<?php
include header.php;
include top.php;?>
This is page 4. It's the best page!
<?php include bottom.php;
?>
</html>
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Webpage full made of only includes

Post by aceconcepts »

Yeh, that seems more flexible to me :D
Post Reply