How to return a file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bryan

    #16
    Re: How to return a file

    Sorry I'm just now getting around to looking at this some more. It's
    been a long week! I'll try this again and let you guys know if it
    works.

    Thanks again for all the help you guys have offered! Again, I'll let
    you know if I get it to work for me.

    Bryan

    Johnny wrote:
    "Jerry Stuckle" <jstucklex@attg lobal.netwrote in message
    news:7rydnS6W7r JT3ajYnZ2dnUVZ_ vydnZ2d@comcast .com...
    <snip/>
    >>What a confusing way to do it - when Joe's method works quite well.
    >>
    >
    what a confusing and totally uncalled for response: when argument fails
    just
    dismiss... oi!
    >
    what is so confusing about replacing 'foo.js' with 'script.php?foo '
    after
    all it is that simple, the rest is illustration padding...
    and BTW in case you didn't notice Joe and I are essentailly in agreement
    except for the header part, which you don't argue with, just dismiss the
    entire post. Anyone can dismiss. All I have done is expand on what Joe
    said
    with an example but showing that it works just fine without the header.
    And your contribution is...even more confusing but lacking any
    substance.
    >
    >
    >
    No, I disagree.

    Yes, your answer and Joe's do the same thing.
    OK...
    >
    But his is
    straightforward and easy to understand.
    >
    That's clearly _not_ the case as Bryan responded "Thanks for the help guys,
    but I can't get it to work."
    >
    Yours is more complicated,
    harder to understand and more prone to errors - especially when you have
    to later modify it.
    >
    err...since Joe's didn't cut it , I felt that expansion might help.
    and I'm very surprised that you find such a simple example as the few lines
    I supplied hard to understand.
    LOL The "prone to errors" assertion is interesting in such a short piece of
    script...
    >
    It was meant as the simplest, yet complete, _working_ example of returning
    javascipt using a PHP script.
    A place to start from...
    the basic minimum HTML tags around the script tag,
    <html>...<scrip t...></script><html>
    don't see what's so prone to error there... I must be missing something
    >
    the other the bare minimum to return some javascript:
    <?php #foo.php
    $js = do_what_you_do_ to_get_the_java script();
    echo $js;
    ?>
    prone to error? well I guess do_what_you_do_ to_get_the_java script(); is
    prone to error but it is just as prone when done from Joe's same difference.
    >

    KISS. And Joe's is much simpler.
    The point of the exercise is to help Bryan "get it to work"
    Clearly, although simpler, Joe's post failed in that end.
    Has my post failed to help Bryan get it to work? Only Bryan can say.
    >
    Just in case Bryan hasn't got it to work yet:
    I'll simplify bits for Jerry and expand some more for Bryan, best of both
    worlds :-)
    >
    in the html (simplified...j ust the script line from the file):
    <script type='text/javascript' src='bar.php?fi le=foo'></script>
    >
    in the javascript file foo.js:
    alert("hi there!");
    >
    in the PHP file, with Joe's header:
    <?php #bar.php
    header('Content-type: text/javascript');
    echo file_get_conten ts($_GET['file'].".js");
    ?>
    >
    or even simpler, which Jerry professes to like :-), without Joe's header
    <?php #bar.php
    echo file_get_conten ts($_GET['file'].".js");
    ?>
    >
    This works with and without the header in bar.php
    minimum 1 code line in each file. simple enough? and yet not so simple as
    Joe's post but yet expanded to a working example.
    >
    Hope this helps get it to work for you Bryan.

    Comment

    Working...