Jump to content

Gathering files, Defacing the earth with them


XA-9

Recommended Posts

Hi everyone!

I'm on a mission to make a simple (I hope :/ ) script that takes some files from a folder and sends them off to a snippet of javascript.

 

I have a folder creatively named 'files' that is full of Google Earth .kml files. I want to get some PHP code to grab those files, and pass them to the javascript that handles the Google Earth plugin, which looks like this:

 

var link = ge.createLink('');
var href = '<?php echo($testvar); ?>'
link.setHref(href);

var networkLink = ge.createNetworkLink('');
networkLink.set(link, true, true);

 

The php in there is me testing out php-to-javascript variables, which seems to be working fine for a single file.

 

My plan for the code was to:

1) Detect all the files in the folder

2) Make the paths for each file into string variables

4) Loop the above javascript once for each file

 

The end result would be the kml files, which are all building models, populating the earth. The files in the folder will be added and removed all the time, so It has to check it every time.

 

Unfortunately this had to be my first experience with php and so this is as far as I got:

 

foreach(glob("files/"."*.kml") as $file){
    echo $file." - ";
}

 

So, it lists out the files in the directory with a ' - ' between each one, but from there I've been lost for days

 

Does anyone have some pointers on what to do with this?

 

Thanks, Love ya!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.