Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,665 members, 7,955,401 topics. Date: Sunday, 22 September 2024 at 03:49 AM

The Need For Server-side Includes - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / The Need For Server-side Includes (1067 Views)

Yahoo Apologises For Server Malfunctions / The Need To Be Using Custom Designs For You Web Design Projects / Daily Independent Website Suspended By CoreNetHosting For "Server Overload" (2) (3) (4)

(1) (Reply) (Go Down)

The Need For Server-side Includes by yawatide(f): 6:29pm On Oct 02, 2008
In reviewing at least 3 sites over the past 24 hours on here, I have come to realize that perhaps some of us do not know of Server side includes (SSIs). I will attempt to explain the concept here.

If you already know about SSIs and/or won't have anything constructive to say here, please close this thread and return no more. Otherwise:

In lay mans terms, an SSI is a logical way of grouping similar items of a web page that will appear GLOBALLY throughout the site. Since there are many backend languages out there (it could also be done in HTML but I won't go there, at least not this time as you really need to think in terms of PHP et al), I won't go into specifics as you can always grab the necessary code from a book. I will just discuss the theory. Sorry.

Take a typical web page. Such a page will always be a header, footer, and navigation sections. Of course, there could be others but for brevity's sake, I will stick to these 3. Now, let's take a 100-page website (they do exist wink). Assuming no content on each page, you could easily copy and paste the same code into those 100 pages. Fine and dandy but let's suppose I ask you to make a change to the logo in the header. Now you start to rip your hair off. Why? because you have to make the change 100 times. How do you avoid this? Read on please.

By using SSIs, you just include say, the header include code, in all 100 pages. But you ask, "if I need to make a change, I will have to touch all 100 pages." Nope, unless you need to change the name of the include. All you have to do is open the header include file, make the change(s) ONCE and see that change on all 100 pages instantly! Pretty cool right?

CONCLUSION:
- Take advantage of SSIs. They are a definite time saver.
- Website architecture is key to any successful web project, no matter how small. Tis best to spend 80% of your time planning properly and 20% of your time coding than the other way around.
Re: The Need For Server-side Includes by Nobody: 2:59pm On Oct 03, 2008
yawa-ti-de:

(it could also be done in HTML but I won't go there, at least not this time as you really need to think in terms of PHP et al)

i am hearing this for the first time, guess u are talking about iframe or javascript

would love to know if there is a better way to this with html, cos I hate to name all my pages .php in the name of saving SSI's neck

and you really cannot tell if SSI was used or not except you view the underlying code.

Addition to posted:

It also allows you to invite variables and functions from another file into ur code, that way, you can have just 1 function that completes a task in one file and you just call it from anywhere
Re: The Need For Server-side Includes by bug24(m): 3:22pm On Oct 03, 2008
Yawatide,
i love this thread, talking about the SSI, i always use this when am designing, mostly with PHP
it aids flexibility and fast corrections or when u wanna add additional links.
Seems you know how to go about doing it with HTML
lets hear it bro.
Re: The Need For Server-side Includes by yawatide(f): 3:44pm On Oct 03, 2008
whoops! I knew I was going to get this question grin

I haven't done this since 1999, just before backend languages became the norm, which is why I said you might want to google this one. Webdezzi, no, I am not talking about javascript/iframes. Having said that, here is the little I remember:

The code would look like so: <!--#include virtual="insertthisfile.html" -->

The important thing is to make sure your server supports it. If the html extension doesn't work, then try shtml. Again the first thing to do would be to ask your host to make sure their servers support it.

webdezzi:
I feel your pain about having to name your files with PHP extensions just for a 5-page (or whatever) website. I have been down that road too. But let's face it, the web is moving more towards web apps and so you might as well name all your files PHP (or whatever backend language). The HTML SSI doesn't allow for backend logic, just pure raw HTMLso again, you might as well.
Re: The Need For Server-side Includes by Nobody: 3:56pm On Oct 03, 2008
1999?

I guess u are older in this, i started sometime around 2004 -then with viewing html source code and playing around with it

unlike many ppl here who have 9 years experience
Re: The Need For Server-side Includes by Nobody: 4:34pm On Oct 03, 2008
that tag is very close to asp
Re: The Need For Server-side Includes by yawatide(f): 5:17pm On Oct 03, 2008
@webdezzi

he he, u c y i say certain things the way I do and y i feel i need to impart what i hv learnt to others? wink

I don't blv in blowing my own trumpet. I like to let wat I say or do speak for itself. Hopefully with time, others will see it that way instead of criticizing me for "criticizing"
Re: The Need For Server-side Includes by bug24(m): 5:34pm On Oct 03, 2008
@Yawatide
Its ok to criticize,  it brings out the action in you,  if no one criticizes ur job, how will u know u need to improve?
in short,  i have refused to post any of my jobs on NL for review,  i think am going to post one now. www.nethomesng.com
u guys tell me what u think about it. i deployed that site last month and still working on the international section of it.

If anyone shuld go as far as contacting my client as regarding the website, I will also go as far as baba Ijebu to get justice done to the person. grin grin

Yawatide, i will appreciate it if you can really talk a little more on the html include thang.
Re: The Need For Server-side Includes by cmon(m): 5:56pm On Oct 03, 2008
i think am going to post one now. www.nethomesng.com
u guys tell me what u think about it.

You should have started a new thread for this however, your site has a horizontal scroll (even for a wide screen 1024). Please remove that it sucks to me.
Re: The Need For Server-side Includes by yawatide(f): 6:10pm On Oct 03, 2008
@bugs
I think I have said all that needs to be said about HTML SSIs. The key again is to ask your host to see if they support it.  If they do, you can use my example above, as-is.  Bottomline, SSIs are the way to go, with respect to logically organizing similar content that will appear globally throughout your site.

Per site review, to add to cmon (the scrolling part only though wink):

1) I think the home page is too busy.  It would be nice for it to look like this:
http://www.nethomesng.com/register.php

2) the first thing I wanted to do was contact you for details.  It took me a while to find the "contact us" link.  Perhaps you need to make it more visible.

3) It would be nice to offer a better message, when a record is not found, than "NO Record fund!!!."  It sounded like you were yelling at me.  Either way, correct "fund" to "found"

4) http://www.nethomesng.com/register.php - I think it is backwards to have me fill out a form, then ask me to log in before proceeding. It begs the question, "why even bother logging in, in the first place?"  Speaking of forms, when validating long forms, it helps to offer a visual cue around fields that weren't filled out properly.  That way, I don't hv to scroll ad infinitum.

5) I also am of the opinion that increasing the font size by just 1 or 2 pixels wdnt hurt anything.  I had to squint for information

6) I don't know if you test your sites at the local cybercafe.  I say this to say that you might want to think about optimizing some of your files. To mention but a few:
a) http://www.nethomesng.com/homeflash.swf - 89KB (yet it looks so small where you have it playing)
b) http://www.nethomesng.com/images/el.jpg 0 46KB
c) http://www.nethomesng.com/images/forsale2.jpg - 36KB

7) You have a total of 34 images on the home page alone.  This again affects download times and isn't suitable for those browsing with PDAs.


8 ) The top and bottom portions of your code are not indented.  Might seem fine and dandy to you but imagine I were the one who did it then I left the job and you took over.  Can you imagine how hard it would be to find that one missing TD or TR?

9) Try to move to web standards (CSS, XHTML). The use of tables and nested tables adds significantly to page weight, not to mention, it makes it harder to find stuff.  Use tables strictly for tabular data. Your horizontal scroll issue would hv been very easy to fix using CSS. With tables, you actually have to go into each page (if you aren't using SSIs) and manually change table and cell widths. After a while, I am sure u will agree with me that it will get frustrating.

Other than that, nice concept.
Re: The Need For Server-side Includes by Nmeri17: 3:22am On Nov 26, 2014
yawatide:
whoops! I knew I was going to get this question grin

I haven't done this since 1999, just before backend languages became the norm, which is why I said you might want to google this one. Webdezzi, no, I am not talking about javascript/iframes. Having said that, here is the little I remember:

The code would look like so: <!--#include virtual="insertthisfile.html" -->

The important thing is to make sure your server supports it. If the html extension doesn't work, then try shtml. Again the first thing to do would be to ask your host to make sure their servers support it.

webdezzi:
I feel your pain about having to name your files with PHP extensions just for a 5-page (or whatever) website. I have been down that road too. But let's face it, the web is moving more towards web apps and so you might as well name all your files PHP (or whatever backend language). The HTML SSI doesn't allow for backend logic, just pure raw HTMLso again, you might as well.


1999?? shocked jeeez!! You na set mate with bill gates o shocked shocked wonder where I was then guess you'll be talking about retirement now

(1) (Reply)

Help / How Do I Get People To Register And Actively Participate On My Forum? / Media Net Is The Best Ppc Now

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 38
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.