|
Posted by Johnny on 10/18/06 01:20
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:7rydnS6W7rJT3ajYnZ2dnUVZ_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>...<script...></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_javascript();
echo $js;
?>
prone to error? well I guess do_what_you_do_to_get_the_javascript(); 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...just the script line from the file):
<script type='text/javascript' src='bar.php?file=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_contents($_GET['file'].".js");
?>
or even simpler, which Jerry professes to like :-), without Joe's header
<?php #bar.php
echo file_get_contents($_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.
Navigation:
[Reply to this message]
|