Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) Passing a JavaScript string into SSI

  • Curtis Thompson

    November 16, 2006 at 6:21 am

    hello marco…

    ya – javascript can’t read files in that sense. there are activex ways to do this, but i wouldn’t rely on those for a variety of security reasons. but here would be an activex way:

    https://www.thescripts.com/forum/thread460516.html

    there are a few other suggestions there as well, but none are really practical….

    it’s a super-easy thing to do in php if you have that option:

    https://php.net/filesize

    now you could get really fancy with a simple javascript ajax implmentation, but i think that would be overkill here and would introduce a large amount of learning on your end that you wouldn’t want to undertake…

    but in most ssi implementations, you can reference external files via a virtual call (although some servers disable that for security reasons), so you could perhaps create a small php or perl script that took a file name as a param and and generated a pretty file size string and then reference it via ssi:

    https://httpd.apache.org/docs/2.0/mod/mod_include.html#element.include

    i think that’s the easiest way to go about it…

    make sense?

    sitruc

  • Curtis Thompson

    November 16, 2006 at 6:30 am

    hello…

    ugh – i’m sorry. i didn’t quite read your post correctly. my answer won’t work for you because you need the javascript…

    unless your javascript is drawing based on a value at load time? or is it drawing dynamically based on selections the user makes after the page loads? if it’s the former, my thing might work because you could pass that value at load time; otherwise you need the ajax kind of thing…

    sitruc

  • Marco Solorio

    November 16, 2006 at 8:18 am

    Yo Curtis!!!

    Nice to hear from ya, bro! Thanks for the reply. Yeah, the values are created at run time when the page loads up. Thanks for the links you provided, especially the PHP one. Since I first posted this thread, I’ve been looking into the PHP route. I’ve found a lot of info on it and I think I might try to go that route. I discovered that PHP can even look at the files in the directory and gather the file names that way which would be really cool since I then wouldn’t even need to do the JavaScript string method. I’ve been avoiding PHP for years, but I don’t know why. Seems like it shouldn’t take too long to adapt.

    BTW, what’s a good way to view PHP files locally without having to actually upload them to the server? Kind of a dumb question but is there a plugin I can install so my browsers displays PHP as it should?

    Marco Solorio  |  OneRiver Media

  • Curtis Thompson

    November 16, 2006 at 8:31 am

    hello…

    if you mean run it as it would run on the server then the only real option is to install apache and php on your local box and run it as a webserver – pretty easy but if i’m reading you correct then that’s what your path would be…

    and ya – php is a nice language. you can use it in conjunction with your ssi or as a standalone – the latter is naturally easier, but the former would keep you going on your current path w/o a lot of new dev work on your site…

    lemme know if you need any assistance on this!

    sitruc

  • Marco Solorio

    November 16, 2006 at 11:46 pm

    Thanks Curtis. Your help is greatly appreciated as always. I’m really determined to get this working in PHP after much thought. It’ll really do exactly what I want in the end.

    And hey, are you still in the area? If so, we should go grab lunch again some time. It’s been a long while… we should catch up!

    Take care,

    Marco Solorio  |  OneRiver Media

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy