Jump to content

Js, XML, and arrays

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
domestic

domestic

    Learning Programmer

  • Members
  • PipPipPip
  • 44 posts
Sounds like fun, huh?

Well, quite simply, I need to make a ticker (see bbc news). Simple enough but the catch is, the whole site needs to be able to continue if the IT team came out a meeting and were killed by a bus. So, I am writing a back-end via php etc. Unfortuantly, Js cant read text files, but it can read xml. Therefore, I had the idea, I'll use this:

Php writes xml
xml imported into Js
Js displays ticker

Simple. Told you so. However, as ever, there is a catch. I'm not sure how to set the length of the array. My thoughts were to make a field in the xml that would contain the number of items the array requires to hold. Couldn't think of a better way. Anyways, I nt sure how to get the xml into the Js array.

What I have: Js Ticker, Js file for reading xml (both IE and FF etc)

Anyways, the above is really for background, just in case there was a better way. However, I couldn't find it, so assistance in showing me how to create the array according to the bit in the xml file would be great.

Cheers,

Domestic
.
Posted Image

Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS

Website: http://abdn.ac.uk/~u41am6

Opportunity is missed by most people because it is dressed in overalls and looks like work.

#2
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
I didn't finish reading your thread because you said "write to a file". Why would you write to a file when you can read/write with PHP? Second, why not just use AJAX? Create a PHP file in the backend. The front end will consist of JavaScript executing a PHP file (hey, AJAX!) that reads the file again.

#3
domestic

domestic

    Learning Programmer

  • Members
  • PipPipPip
  • 44 posts
tickers are js things. its how they continually update what you see. php wont do this for me, so I would still need to get the information into a js array.
.
Posted Image

Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS

Website: http://abdn.ac.uk/~u41am6

Opportunity is missed by most people because it is dressed in overalls and looks like work.

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
If you create an asynchronous connection between your JavaScript file and your PHP file, every time your JavaScript file calls the PHP script, the PHP script will execute and update the information.

#5
Makubex

Makubex

    Newbie

  • Members
  • Pip
  • 1 posts
ok:)