Closed Thread Icon

Topic awaiting preservation: link/embed external html file (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12951" title="Pages that link to Topic awaiting preservation: link/embed external html file (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: link/embed external html file <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-25-2003 06:27

Is it possible to link/embed a html file into a portion of you're code.

Lets say all of you're pages use the same element, say you have a box on the right side of you're page with something in it. Is it possible to store the code for this element in another html file, say myBox.html and embed that into you're other pages, that way if you change something on it you dont hvae to update each page?

I've never actually tried this before and thought the option would be availalbe, but either i'm doing something wrong or its not allowed?

Please advise, thanks

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-25-2003 06:30

What your looking at here is a server side include, or SSI...and as such this thread belongs in the Server-side forums...sending it there now

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-25-2003 06:43

And now that we're in the correct forum, I'd recommend you read this tute on SSI from the Gurusnetwork by our very own DL-44
http://www.gurusnetwork.com/tutorials/ssi/ssi1_intro.html

Enjoy!

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-25-2003 06:44

Hmm, im wondering since my servers are win2003 can you use SSI, i think it requires .htaccess and this is a linux server attribute if i remember correctly?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 10-25-2003 09:49

Well, on Windows servers you can always use the ASP...


H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-25-2003 10:17

Hmm... oh well guess i do it manually.. I'd prefer not to use asp myself .

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-25-2003 10:19

Wow just got an email from my host apparently it does support it... hmm im not sure why it wasnt working then =/ ill have to post some code..
>>
Hi,

Yes it does, but you get a little different response from the CGI files
as opposed to Linux based. You will see the "content type/text" stuff
all the time unless you remove it from your CGI files.

Other news, we have just finished installing MySQL on the Windows
servers.
>>

MySql as well... i love this host .. ill try the SSI again tommorow when i get home, i did what that tutorial said but it just didnt show up the linked part.. not sure why



CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 10-25-2003 17:25

H][RO,

if your server has PHP you can do that very easily along with DL's tut. Just mark up your page and where ever the HTML is, place that in a seperate file and use includes.

So if you have a div called "myBox" then inside the div include the HTML file. The html file shouldn't have any markup except for the actual content.
so you would have:

code:
<div id="myBox">

<? include "myPage.html" ?>

</div>

There are some issuse with people directly accessing the "myPage.html" but you can use .htaccess to keep them out (I think).



Later,

C:\


~Binary is best~

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-26-2003 01:26

Yeh thanks Cprompt, i know its pretty easy to do with php, but i wanted a purely html solution for this one if possible, SSI looks to be the answer if I can get it working. Thanks though.

norm
Paranoid (IV) Inmate

From: [s]underwater[/s] under-snow in Juneau
Insane since: Sep 2002

posted posted 10-26-2003 02:25

for a clientside answer to your puzzle, try looking into iframes/ilayers. This works quite well for a template.

/* Sure, go ahead and code in your fancy IDE. Just remember: it's all fun and games until someone puts an $i out */

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 10-26-2003 04:17

Hehe is that last line you're sig or where u refering to something?:P

norm
Paranoid (IV) Inmate

From: [s]underwater[/s] under-snow in Juneau
Insane since: Sep 2002

posted posted 10-26-2003 06:55

that would be my sig..... I realize that it isn't as graphicaly appealing as some, but it is very meaningful to me!

Hardly a day passes without my getting invited to fix some code that got mangled by someones visual development tools. Usually caused by the fact that the operator of said tool has a fair idea of what buttons to push and what to drag and drop, but not much of a grasp of what is happening under the hood.

I may not be the sharpest crayon in the box, but I do like to leave my mark.

/* Sure, go ahead and code in your fancy IDE. Just remember: it's all fun and games until someone puts an $i out */

Milio
Bipolar (III) Inmate

From: belgium
Insane since: Nov 2003

posted posted 11-08-2003 07:47

Cprompt using your example... can your file have an html.extension? Or does it have to be PHP?

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 11-08-2003 08:35

the closest you can get is .phtml...a page that's a mixture of PHP and HTML can have this extension, otherwise your webserver may not run it through a PHP parser if you don't give it a valid PHP extension (ie: .php, .php3, .PHTML, etc

quisja
Paranoid (IV) Inmate

From: everywhere
Insane since: Jun 2002

posted posted 11-08-2003 12:22

If you were using Apache you can get the server to parse .html with PHP (using .htaccess) but I'm not sure if this is do-able with whatever server it is your host is running.

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 11-11-2003 04:50

Milio: safe bet would be yes all the pages would be PHP. I have tried to have Apache parse it using html files but I guess I am not that well versed in it. Actually i'm not versed in it at all

Later,

C:\


~Binary is best~

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 11-11-2003 18:24

Ok, let me try to clarify some things here, as this is getting a little swampy in here....

SSI is a great tool. If you don't need to do anything fancier than including things, it's great.

If you want to have a bit more flexibility and power, PHP is the way to go.

If you don't want to use server side languages at all, you can also acomplish this with Javascript
( http://www.gurusnetwork.com/tutorials/javascript/jsmenu/javascriptmenu.html
http://www.gurusnetwork.com/tutorials/javascript/jsmenu/javascriptmenu.html
http://www.gurusnetwork.com/tutorials/javascript/javascriptssi.html )

Either way, the idea is the same. Well, actually there are two ideas.

1) You have a common header, footer, navigation mene, or whatever that is shared on all of your pages.

Each page you create includes that (or those) files with the appropriate line of code.

2) You have one page that is the template which in turn calls each content file into a designated spot with the appropriate include code.

I much prefer method 1, as it is more flexible and powerful in the long run.

Iframes should be avoided like the plague. Layers....well, they have their use, but....

Whichever method you choose, make sure that you save your files as the proper type to be parsed by your server as the server side language they make use of (.php for PHP files, .shtml for SSI is most common, you'll have to verify with your host).

And for the record, there is no pure HTML solution for this. HTML is simply a structural client-side markup language. It can't do these things.


« BackwardsOnwards »

Show Forum Drop Down Menu