homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Text to html with javascript?
can I read text into html with javascript?
stevenjm




msg:1480001
 8:00 am on Aug 24, 2003 (gmt 0)

Probably been asked a million times before.

Can a text document be read by javascript and output to a html page?

I mean without pulling a text file into an I frame or something similar is there any client side way to have a text file output into an html page so it can have html formatting ie. retain body font etc so that a client can just make changes to the text file?

 

tedster




msg:1480002
 10:26 am on Aug 24, 2003 (gmt 0)

What you are asking about is really a basic Content Management System (CMS). Javascript alone is not up to the job you describe -- for instance, text files do NOT contain font information, just characters and line breaks.

There is a lot to choose from in CMS -- MacroMedia's Contribute offers something like what you describe for at a modest price, and there are blogging scripts that may also suit your purpose that are freeware.

stevenjm




msg:1480003
 11:00 am on Aug 24, 2003 (gmt 0)

Thanks for that. I realise that text files are the characters only but was hoping maybe that javascript could read text in and output it in some way as to inherit the html body properties etc of the page.

ShawnR




msg:1480004
 11:15 am on Aug 24, 2003 (gmt 0)

Hi Steven

tedster is right, of course. You can't use javascript for what you describe. Javascript doesn't manipulate (read/write) files except for cookies, as it is client side, and allowing file access would compromise security.

Could you describe a bit more of what you are trying to achieve, and perhaps someone can help. For example, you want the file to be on the visitor's machine? So the visitor can change their own file, but no one else would ever see the results? Is the information small enough to fit into a cookie file? Is this on an Intranet, or for a general Internet site?

MonkeeSage




msg:1480005
 8:11 pm on Aug 24, 2003 (gmt 0)

JSlib (hosted at MozDev) is a JS wrapper for XPCONNECT controls, and has a nice FIO implementation (also network, sound, zip, &.c). But I doubt that stevenjm is interested in learning to write a Mozilla app, so an extant CMS would be my recommendation as well.

Jordan

MonkeeSage




msg:1480006
 8:36 pm on Aug 24, 2003 (gmt 0)

Actually, what about SSI? Can't you use text files for your includes?

Like you have
..
/
/users/
/users/bob
/users/mary

You make templates that reside in "/" and include text files from "/users/bob" or "/users/mary" &c.

E.g.,

<html>
<head>
<title>Bob's Page</title>
</head>
<body>
<!--#include virtual="/users/bob/bob.txt" -->
</body>
</html>

Wouldn't something like that work (assuming the server supports SSI)? I know next to nothing about server side stuff, but I think that would work...

Jordan

Purple Martin




msg:1480007
 5:30 am on Aug 25, 2003 (gmt 0)

Jordan,

The question was about a client side way of doing it. The client side user isn't going to have access to the include files.

stevenjm




msg:1480008
 8:53 am on Aug 25, 2003 (gmt 0)

Thanks everyone for the advice.

What I was hoping to do was to have it so a client could create a text file with a certain name and ftp it to the server where it would be included on a dhtml page.

Server side is out of the question for this particular site because of the type of hosting.

and I did not want the plain text look that using an iframe would provide.

stevenjm




msg:1480009
 1:24 am on Aug 28, 2003 (gmt 0)

Just for future reference can anyone recommend a good free cms preferably without the use of a database?

Purple Martin




msg:1480010
 1:34 am on Aug 28, 2003 (gmt 0)

Sorry, a good CMS will cost money. Luckily not much, Macromedia Contribute is fairly cheap.

Why don't you want one with a database? There's nothing scary about using a database. Sure the hosting is a bit more than those cut-down budget hosting plans, but on the other hand you'll probably get heaps more bandwith thrown in.

stevenjm




msg:1480011
 4:57 am on Aug 28, 2003 (gmt 0)

Thanks. I have macromedia contribute. I have never really looked into cms but did notice there are quite a few free php versions.(eg ezedit etc)that do not require a database.

This is only for future reference for server side options.

Just thought that there may be some more popular of the free ones to save me the time of evaluating quite a few.:)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved