![]() |
Or do you have to use php or shtml or some other extension?
|
They can if you ask your host to set it up for you.....but I believe it puts extra strain on your server (not a WHOLE lot, but a little) so if speed is a huge issue, you may want to use .html....
|
Server Side Includes (SSI) use CGI includes and most go to pages labeled .shtml
You can also do virtual includes using PHP, and they have to be called out on pages ending in .php However, you can also have your server set up by your host (if they're amenable to it) to have your .shtml pages actually end in just .html (but really be .shtml). I am told you can also do this with PHP, however no host will do both because then it causes too much server drag to parse for both. |
It's a value set in your apache config ... otherwise, what they said about server load.
|
If you put this line:
AddType application/x-httpd-php .php .phtml .php3 .html .htm .shtml into the root .htaccess file it will allow .htm or .html files to be parsed so that includes can be used on them. It may slow your server down, lots of debate on how significant this is. I have used this for years now with no problems or noticeable difference in speeds. |
here is a link to a SSI resource
http://bignosebird.com/ssi.shtml |
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm I run with this in my root .htaccess and have had no noticable server load. :) |
Ok and next question, what's the best way to write one out? I know the php way is pretty simple but does the html way vary much?
|
Quote:
<!--#include virtual="whatever.txt" --> |
Not sure but I re-read your post and didn't know if you meant how to write the code to call the include or if you wanting to know how to write the include itself...
For any thing you're wanting to include in to your page just write the html or text and save it as .txt |
Rather than adjusting your httpd.conf or your root .htaccess to make all .html pages parsed for SSI, just add this to your .htaccess file:
XBitHack on Then for any page(s) you want to parse for SSI, just change the permissions on that/those specific files to 0755. |
Quote:
I ask because I'd say at least 90% of my pages use includes so I'd rather just upload it and forget it. |
Quote:
I ask because I'd say at least 90% of my pages use includes so I'd rather just upload it and forget it. [/b][/quote] yeah, if you're talking about the majority of your pages using SSI then XBitHack isn't the best option. Might as well just add .html to the ServerParsed directive and pay the slight performance hit the server takes on your non-SSI pages. But, if you've only got a few pages using SSI and you don't want to rename them to .shtml XBitHack is a great option, and the SE's aren't going to drop your already listed pages because you had to rename them. :agrin: |
Hi guys :)
I have followed most of this, but I was wondering, for the benefit of those of us that might be less technically orriented... Could you explain what it is that the stuff you are telling Nick to do does ? I know that I have a cardinal rule to never include anything in my coding that I don't understand exactly what it is doing and why and I always recommend that folks follow that rule :) Thanx in advance :) |
Quote:
Yeah right :P Ok here's what I think, correct me if I'm wrong oh techless one: Once this is inserted in to the root .htaccess: AddType text/x-server-parsed-html .html AddType text/x-server-parsed-html .htm The server will then parse every .html and .htm file that is called and check for virtual includes and include them before serving. It’s very handy to use this for sponsor codes as you can change out hundreds of links by simply editing 1 .txt file. |
Quote:
|
Quote:
Don't you have some code to run through :lol: |
Quote:
lolol...nopers :) Just working down the list here. I had on there "update softball site" - check "update weekend jewelry" - check "update weekend-jewelry" - check "bother Trev" "go get rocks" You were next on the list, what can I say :yowsa: so, what's a virtual include ? :nyanya: |
Quote:
Just working down the list here. I had on there "update softball site" - check "update weekend jewelry" - check "update weekend-jewelry" - check "bother Trev" "go get rocks" You were next on the list, what can I say :yowsa: so, what's a virtual include ? :nyanya: [/b][/quote] As long as your getting the rocks after me :lol: A virtual include is html (or many other things) stored in a file that when referenced in a web page will be included as if it was directly written into the page. Even though it has been pulled from somewhere else entirely. |
Guess your getting the rocks :unsure:
|
Quote:
yep, just got back a few minutes ago. Didn't do quite a truck load but I think we now have enough for along the driveway (where my truck tires cut a ditch every winter) Our driveway has a little curve to it which looks real pretty but in actual use doesn't always work so well. |
Quote:
yep, just got back a few minutes ago. Didn't do quite a truck load but I think we now have enough for along the driveway (where my truck tires cut a ditch every winter) Our driveway has a little curve to it which looks real pretty but in actual use doesn't always work so well. [/b][/quote] Thank fuck!!! I thought you went to get them to throw at me :blink: How did I score in the quiz, I gave myself a 4 out of 15 for explanation :unsure: |
Quote:
Ok, ok, yes, I know what a virtual include does (although I have yet to use one) so your explanation was a good start, you sort of explained an "include" in there which of course a virtual include is an "include" and you sort of pointed out the difference between the two with "Even though it has been pulled from somewhere else entirely.". I probably would have said that a virtual include is an include that allows you to include a file from outside the site path ie: other places on the server :) But I don't think a non techie would get mine either :blink: |
Quote:
I'm a Merican, I owns guns :groucho: |
Quote:
Ok, ok, yes, I know what a virtual include does (although I have yet to use one) so your explanation was a good start, you sort of explained an "include" in there which of course a virtual include is an "include" and you sort of pointed out the difference between the two with "Even though it has been pulled from somewhere else entirely.". I probably would have said that a virtual include is an include that allows you to include a file from outside the site path ie: other places on the server :) But I don't think a non techie would get mine either :blink: [/b][/quote] :huh: You must be joking when you say you don't use includes!?!?! How do you update pages without really updating them :groucho: |
Quote:
I'm a Merican, I owns guns :groucho: [/b][/quote] Bugger I used the same groucho. Guns don't worry me, it's the smell of petrol that gets me :unsure: |
Quote:
|
Quote:
Ok :huh: icq me :unsure: |
Quote:
No banner systems?! :blink: |
Quote:
whats a banner ? :blink: |
Quote:
Hahahahaha :lol: I can't wait till we get to: what's a message board? :blink: |
Quote:
I can't wait till we get to: what's a message board? :blink: [/b][/quote] You all scare me! :ph34r: |
Quote:
|
It can be on a different domain on the same server if you use the server path in a php call, not sure about from a different server.
<? include("/home/username/domainname/foldername/filename.txt"); ?> EDIT- I think it can also be done across domains on the same server without php using a virtual folder. |
Quote:
Includes as far as I'm aware need to reside on the same server. |
Thank you. :okthumb:
|
Quote:
There are times when it's advisable to have php includes outside of the web root (usually /html/), so you can only include it like: <? include("/home/path/to/file"); ?> Most common these days is to slap it in a folder inside the web root, so you can use relative or absolute linking as you would any other file on the server. Relative: <? include("/path/to/file"); ?> Absolute: <? include("http:www.domain.com/path/to/file"); ?> (NB: this will allow it to be linked to from *any* domain, on-server or off-server - it can cause probs because php can only handle a certain amount of full URL connections). If you have multiple domains on a server but only want to have one folder serving all the includes, you can either call it all from one location (/home/path/to/file) or you can be sneaky and alias /symlink a folder so it can be relative across all domains. You can do this in htaccess but it's better to alias stuff in apache config. EG in your html you'd include "/includefolder/file" which would to all intents and purposes be served from domain.com/includefolder/file but in reality is served from /some/other/location/includefolder/file |
Quote:
I hate the SIMS :grrr: |
you can also do .js includes on a .html and that does not require any .htaccess mods - on the down side if your doing say a tgp gallery you won't get listed with a js script on your page
|
| All times are GMT -4. The time now is 03:03 AM.. |
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright Evil Empire Inc. 2006-2022