Forum Moderators: coopster

Message Too Old, No Replies

Server Side Includes

Which approach to adopt

         

mvaz

1:21 pm on Mar 26, 2010 (gmt 0)

10+ Year Member



All, I am aware of includes and how they work. My question today is, if I am creating a webpage, say index.php and I want to include files like header.php, left_col.php, centre_col.php and right_col.php (for a three column layout) and ofcourse, footer.php, do all these files have to be nested within a table?

Is it necessary that index.php which houses these files be created as :
<table>
<tr>
<td>
include header and the rest of the SSI include files
</td>
</tr>
</table>

The include files have tables within them.

I am in a dilemma as to whether to house them within a table on index.php or just have them as
Include – header
Include – other files
Include – footer

All valuable suggestions and opinions along with pitfalls of either approach are welcome and highly appreciated. Thanks - Melwyn

Matthew1980

2:29 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Mvaz,

From my understanding of this, all that is important is that you retain/preserve the structure of html when using includes to create a page, ergo: the structure is there anyway, and there is no need to create a container unless that is how you specifically design it.

What I mean by that is, if these includes have just non-structure type html tags in, then you would need to have the container setup.

Using includes means that you can split a page up, literally and place them into relevantly labelled files ie:-

header (containing html, head, title, opening body tag)
content (Your main content, split up as you see fit)
footer (closing body, closing html)

At least this is how I approach this ;-p

And doing it this way negates the need for nesting in a nest if you see where I am coming from.

Also, I stopped using tables about a year ago, I am now 100% tableless in design, and its so much easier to do, takes a while to grasp, but its worth the learning.

I'm not too sure on SSI so I can't comment on this, I really should look it up though ;-p

Apologies if I have misunderstood your post.

Cheers,
MRb

mvaz

4:38 pm on Mar 26, 2010 (gmt 0)

10+ Year Member



Hi there Matt, you are spot on with my query. I was in two mind, but not now, I will not nest my various components, but as suggested will ensure that the structure of the files is maintained.

Once again, thanks for the info posted.

Matthew1980

6:50 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Mvaz,

Glad to help ;-p

I will just reiterate something though:-

------header------
<html>
<head>
<title>My include structure :)
</title>
</head>
<body>
-----End of header---

-----content-------
<p>Hi there</p>
<p>Whatever your content is</p>
-----end of content----

----footer--------
</body>
</html>
----end of footer----

That's how a template could be done, a typical header/content/footer. The integrity of the html structure is kept. Therefore you can use them as templates and ergo: fluidity and continuity of design when programming!

Cheers,
MRb

rocknbil

6:51 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



M addressed the root answer - as long as the final page with the includes generates a stable page output. But if you're starting from scratch, start right . . .

.. do all these files have to be nested within a table?


No, because you shouldn't use tables for layout. Tables are for tabular data, rows and columns of intersecting data, like a spread sheet. Dig into CSS a little, understand document semantics, this is all important.