#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    364
    Rep Power
    12

    Can Javascript do the same as PHP?


    A PHP script dynamically creates a table of contents and thumbnail images.I was wondering if the same script could be written using Javascript.

    I havent coded in JS before and dont know if there are JS equivalents to PHP's fgetcsv(), ImageCopyResampled(),ImageJpg()...etc functions which are needed to read the contents of a csv file and thunbnail an image.

    Would appreciate all suggestions. Thanks.
  2. #2
  3. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    if all the content that JS needed was available to it I beileve it is, there might not be functins premade for it but you could create them. I have a limited knowledge of JS but from what I've seen alot can be done with it.
  4. #3
  5. Gogo Google.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Adelaide, Australia
    Posts
    226
    Rep Power
    12
    Javascript doesn't do that sort of thing, unfortunately. It doesn't read the filesystem, nor have any image functions. It's a basic scripting language It can never do that either, because it's a client-side language.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    364
    Rep Power
    12
    Thanks Jeb

    The site already contains a JS shopping cart script. Would you happen to know if the pages are saved as .php, would that script still work? I dont see why not, but would like to ask before i mess up the site.
  8. #5
  9. Gogo Google.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Adelaide, Australia
    Posts
    226
    Rep Power
    12
    Yes, the site will still work. Whenever PHP encounters anything outside of a PHP code block, it simply spits it out to the browser with no changes. That includes HTML, and JavaScript.

IMN logo majestic logo threadwatch logo seochat tools logo