server side includes (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


d a v e -> server side includes (3/16/2008 16:38:25)

does anyone know of a good beginners resource for ssi? i'm not sure what server i will be writing for so something that includes methods on finding out what it supports (er, linux/apache... windows...) and then how about doing it. i get the concept behind but i need some a tut on it ;)




Tailslide -> RE: server side includes (3/16/2008 17:12:52)

I haven't found a good single source but here's two:

SSIs - http://www.yourhtmlsource.com/sitemanagement/includes.html
PHP Includes - http://www.w3schools.com/php/php_includes.asp

With SSIs you need to rename pages to .shtml and with PHP includes to .php UNLESS you're sneaky and add in a line into the .htaccess file (in apache) like this:

AddType application/x-httpd-php .htm .html .shtml


Then you can keep the .html suffix.

I've used SSIs on Windows servers but I don't know if there's a clever way around the whole filename thing so I stuck with .shtml in that case.

You can check what server a site is on by using FF web developer toolbar. PHP is enabled on many Windows servers too these days so if in doubt just chuck up a php info page to see if it works ( put <?php phpinfo() ?> in a page called info.php and upload it - see if you can view it).




Mane -> RE: server side includes (3/16/2008 17:28:40)

Adding a line like that to .htaccess makes the server parse every single page for PHP (or SSI). Not sure how noticeable the performance difference really is, but it's a good idea to do that only if most of the files actually use PHP.




Tailslide -> RE: server side includes (3/16/2008 17:44:47)

Yeah it'd be a problem with a really huge site - but on most normal sites shouldn't make a big difference. If you're going to use SSIs then the assumption would be that you'd use them on every page for all the common bits.

Oh I forgot to say - Dave, you use DW don't you? For god's sake don't do the .htaccess thing if you still use FP or want FP extensions to work any time in the future as it will jump up and down on them until they're a nasty mess.




d a v e -> RE: server side includes (3/16/2008 17:48:56)

i use DW but i'm coding site for FP editors but NOT using any FP extensions. i'll probably just stick with the .shtml / .php thing ;)




jaybee -> RE: server side includes (3/16/2008 19:30:34)

See my other post about PHP includes going belly up when hosts install PHP5.




coreybryant -> RE: server side includes (3/18/2008 15:20:30)

Last week I was working on a blog for this actually. And then another forum that I just moderate on - I became one of the Administrators and had to help fixed some major problems.

So in the meantime, I did attempt to get something up at File Includes. I did do a couple of files that can be downloaded. I think they are correct - I did check them at one time - but they are pretty basic.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625