...

View Full Version : Is it possible to import text into HTML?



Doctor_Varney
11-17-2008, 05:27 AM
I was wondering if it is possible to import text, from a .txt document (or another HTML one) into my page...

The idea would be, to keep the text of the document seperate from the HTML and just call in lumps (or paragraphs) from the sourced document.
Reason: Well, it would make my written source material a lot easier to organise and manage.

I've looked around the internet, and have so far not found any HTML (or CSS) properties which will allow this. So, I thought I'd ask here. Maybe you have some ideas, other than using a series of i-frames (which I'd rather not do).

(I'm thinking there must be something, along the lines of: #div src="...", or <p src="..."></p> in order to do this?)

But having said that, are i-frames considered bad, in the realm of Web-Standards, in the same sense that framesets, themselves, are?

Many thanks,
http://i183.photobucket.com/albums/x103/Doctor_Varney/signature.gif

_Aerospace_Eng_
11-17-2008, 05:38 AM
There isn't something in HTML only. You would need to look into PHP includes or server-side includes. You may also want to look into a CMS.

Avril
11-17-2008, 06:30 AM
Do you have a lot of text to import each time? Dynamicdrive has an interesting JavaScript "Switch Content Script" which switches content (images or text) in a division with a click on the relevant link. You might want to check it out at:

http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

The same source gives you the reasons for avoiding frames and iFrames:
www.dynamicsitesolutions.com/html/reasons-to-avoid-frames-and-iframes/

Cheers!

oesxyl
11-17-2008, 12:26 PM
But having said that, are i-frames considered bad, in the realm of Web-Standards, in the same sense that framesets, themselves, are?
both i-frames and framesets are part of the w3c recommandation which are web standards. Usualy people have other reasons then standards when they say that something "is not standard", :)

best regards

Apostropartheid
11-17-2008, 04:11 PM
I well and truly could not express more my distastes for both frames and JavaScript calling in content. Server-side includes would be the best option, and the most ubiquitous language you could do it in is PHP.

Major Payne
11-18-2008, 04:33 AM
Interesting. I haven't tried this code with a text file, but it should work. Probably not what you intended though.


<div style="margin: 0 auto; width:100%; height:400px;"><object type="text/html" data="http://Domain_Name.com/File_name.html" style="width:100%; height:100%; margin:1%;"></object></div>

Doctor_Varney
11-18-2008, 07:38 AM
Interesting. I haven't tried this code with a text file, but it should work. Probably not what you intended though.


<div style="margin: 0 auto; width:100%; height:400px;"><object type="text/html" data="http://Domain_Name.com/File_name.html" style="width:100%; height:100%; margin:1%;"></object></div>

Thank you, Major Payne. Would that work on it's own, or would this still necessitate me learning PHP?

Cyanlight, I can easily relate to the frames distaste although I get the impression that the people who show the most distaste for it, are often less distracted by internal design considerations, than by efficient interchanges of information across webs. This would also go for flash, I guess, though I'm not sure. The point being, that if you're looking at some projects, the visual look could be of overriding importance to whether the page makes web-standards. For some things, visual things, knowing my site was viewable without style, might be a little like being observed without trousers, in public.

I'm improving, though not quite yet out of the woods and homefree with CSS. Granted, it's only style, not major programming, but I still feel I have a long way to go with it. I can see myself looking at a new language, next year, at this rate.

But having said that, I will have to discover first, how much more steep of a learning curve PHP will be. How much it differs to HTML. I'm aware of it's uses in fora, for organising large quantities of data.

Thanks,
http://i183.photobucket.com/albums/x103/Doctor_Varney/signature.gif

Doctor_Varney
11-18-2008, 08:07 AM
I've tried the above code and it works, though styling up the actual content of the div seems not to work. Like you said, Major, probably not what I expected, but it's giving me ideas already. Many thanks!

_Aerospace_Eng_
11-18-2008, 08:08 AM
I've tried the above code and it works, though styling up the actual content of the div seems not to work. Like you said, Major, probably not what I expected, but it's giving me ideas already. Many thanks!

Be sure to try it in other browsers. Browser support may be a little flaky.

FWDrew
11-18-2008, 08:35 AM
Just want to put my vote in for a php include, it does exactly what you need and will work in any browser with the tiny code below:


<?php include("textfile.txt") ?>

This is a great way to easily update items such as your navigation and footer once you have a lot of pages up as you only need edit the text file that holds the html.

http://us3.php.net/include/

Best Regards,

Drew

Doctor_Varney
11-18-2008, 10:00 AM
Just want to put my vote in for a php include, it does exactly what you need and will work in any browser with the tiny code below:


<?php include("textfile.txt") ?>

This is a great way to easily update items such as your navigation and footer once you have a lot of pages up as you only need edit the text file that holds the html.

http://us3.php.net/include/

Best Regards,

Drew

I'll certainly have a look into that, Drew. It's got me tempted now... Thankyou! :thumbsup:

Cheers,
http://i183.photobucket.com/albums/x103/Doctor_Varney/signature.gif

effpeetee
11-18-2008, 02:50 PM
Doctor. Regarding one of your earlier queries about side to side images.
Perhaps you will find this (http://www.brunildo.org/test/ImgThumbIB.html)of interest.

The parent page (http://www.brunildo.org/test/)is also of interest.

A different view. (http://www.brunildo.org/test/indext1.shtml)

Frank

Apostropartheid
11-18-2008, 04:53 PM
Cyanlight, I can easily relate to the frames distaste although I get the impression that the people who show the most distaste for it, are often less distracted by internal design considerations, than by efficient interchanges of information across webs. This would also go for flash, I guess, though I'm not sure. The point being, that if you're looking at some projects, the visual look could be of overriding importance to whether the page makes web-standards. For some things, visual things, knowing my site was viewable without style, might be a little like being observed without trousers, in public.
For the record, I'm a designer and have never been anything but that. But the disadvantages of using frames, like its inherent hate of accessibility and printing, outweigh its "benefits", of which I'm not exactly sure of. A web professional worth his salt will always make sure that the content is king and nothing but, so I'm not sure how visual look takes precedence. Web standards are here for a reason, and, to be honest, I've never come across a situation where standards cannot be adhered to.

Your metaphor doesn't make much sense to me either. A page without styles is nothing like being inspected in public without trousers, because our users have x-ray goggles so you don't know when they're looking at you without trousers. Not that I would, of course...

Back to frames, don't use them. They cannot be accessed on their own by a non-tech savvy user, are probably slower (not sure on this fact but I'm sure that server-side includes are faster) and are just generally annoying. I would vote for PHP, but simple server side includes (SSIs) are also a viable choice--but keep in mind, most people are going to get onto using PHP at some point.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum