PDA

View Full Version : include remote file into a variable



formattedc
03-27-2005, 02:58 AM
Using script from DD: Cross Browser marquee II

The line:

var marqueecontent=' '

------------------------

Question:

How can I put a link there to include a file remotely, when I put any kind of include script there it shows the rest of the script below it on the page

Thanks!

jscheuer1
03-27-2005, 03:48 AM
I don't think there is a way to do that. You have at least two choices though:

1) Write your content there, don't have an external file.

2) Make the entire script an external file (you will still need to write your content in at that spot though).

formattedc
03-27-2005, 05:12 AM
yeah but the problem is, its a parsed rss feed that needs to be included, and ofcourse its constantly updated so that won't work : (

jscheuer1
03-27-2005, 06:03 AM
Not familiar with that. Perhaps if you explain more, there could be a way. If the feed is suitable to be marquee content, how did it get that way, is it configurable via template or some other means? Can it be written to a file or referenced as a filename of your choosing?

cr3ative
03-27-2005, 08:24 AM
Ooh, I know this one.

Take out this line:

var marqueecontent=' '

And replace it with

</script>
<script src="marquee.js" type="text/javascript"></script>
<script type="text/javascript">

And then create a new file, marquee.js in the same folder with this in:

var marqueecontent='Content Here'


Please note this will NOT work if you have already got the marquee script running from external.

cr3ative

accxess
06-02-2005, 05:07 AM
Take out this line:

var marqueecontent=' '

And replace it with

</script>
<script src="marquee.js" type="text/javascript"></script>
<script type="text/javascript">



THis sounds like the answer to my problem however would the src="marquee.js" also be able to add to an absolute URL of src="http://www.domain.com/marquee.js" as well?

The reason I ask is that i want to use the same source file on several sites using the script so i can display common files edited in a single place.

Mark

cr3ative
06-02-2005, 09:02 AM
Yes, an absolute URL should be fine.

cr3

sleipner
11-15-2005, 06:52 PM
if you wanna display the info from an external page, try using an iframe (inline frame)

var marqueecontent="<iframe src='your file path' width='100%'>"

with any other specs on the iframe that you want, then it should work, whether you are putting the script directly in the page or in an external file you can still have an external content source which could be dynamically updated (since I dont know php, I did something like this to create a forum with a form writing to a specified html file and displaying it in an iframe)