PDA

View Full Version : Any Idea if this is possible?


mota
12-10-2003, 11:37 AM
Hi there just starting out in JavaScript, been posting a few messages trying to learn from the people in the know.

BTW...Thanks for all the help so far.

Does anyone know if you can do the following?

I want to create a script that could load and format a text file into the website. For example: -

| Latest News |
|------------------ |
| $£%£$^$^ |
| $%£$%£$% |
| £$%£%£$% |
| £$%$£%£$ |
| £$%£$% |
| £$%£$^^ |
--------------------


Where by you can place the information in the text file into the web page.

The reason i was wondering is because i'm doing a website for my mate, and am looking for ways for him to be able to ammend his website with the minimum of effort, as he aint very computer literate.

Trying to think of things which will make his site dynamic and interesting for people to look at.

I could do it using a server side language like ASP, but i'm trying to learn JavaScript at the moment, and am trying to increase my kowledge in the area.

Its not a problem if it can't be done, as i will probably use some server side scripting later on in the site anyway.

Thanks again for all your advice.:thumbsup:

Caffeine
12-10-2003, 11:47 AM
Its not a problem if it can't be done, as i will probably use some server side scripting later on in the site anyway.

Good, because this cannot be done with js. A server-sided language is required :)

If you do not have the time to develop a content management system, there are some pretty half-decent[me being nice] ones to download, but most of them are basically crap.[me being honest] :p

Links:
www.hotscripts.com
www.aspin.com

- both have lots of resources/scripts.

jalarie
12-10-2003, 01:32 PM
Is your friend computer-literate enough to put lines in quotes? If so, create a file named "news.js" which looks something like this for him:

 NewsLines=new Array(
  'News Line 1',
  'News line 2',
  'line 3',
  '...',
  'final line. no comma'
 );
&nbsp;for (i=0; i<NewsLines.length; i++) {
&nbsp;&nbsp;NL=NewsLines[i];
&nbsp;&nbsp;document.write(NL+'<br>');
&nbsp;}

He can now change, delete, or add lines within the array but must not touch the first line nor the last five. He must enclose each line in quotes, not use a quote mark within any line, and must make sure that every line except the last ends with a comma.

Then you put a line like this into your main web page:

&nbsp;<script type="text/javascript" src="news.js"></script>

adios
12-10-2003, 05:52 PM
A somewhat basic solution....

http://forums.devshed.com/showthread.php?threadid=51316&highlight=convertor

[working on an upgrade]

brothercake
12-11-2003, 09:04 PM
You could always keep your data in XML. Both IE6 and mozilla can import data from XML in Javascript.