Connecting Tech Pros Worldwide Help | Site Map

nesting JS in echo's

Request-1
Guest
 
Posts: n/a
#1: Nov 8 '08
hi folks,

html coder here, new and terrified * of php!!
aaaaaa!

i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.

worked fine.

thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.

i tried escaping the double quotes (my echo used double quotes), but to no
avail.

here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.

any help much appreciated..


++++++++++++++++

{ echo "

<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }

++++++++++++++++++++++++++

thanks


jimp@specsol.spam.sux.com
Guest
 
Posts: n/a
#2: Nov 8 '08

re: nesting JS in echo's


Request-1 <hello@you.comwrote:
Quote:
hi folks,
>
html coder here, new and terrified * of php!!
aaaaaa!
>
i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
worked fine.
>
thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.
>
i tried escaping the double quotes (my echo used double quotes), but to no
avail.
>
here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.
>
any help much appreciated..
>
>
++++++++++++++++
>
{ echo "
>
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }
>
++++++++++++++++++++++++++
>
thanks
It will work, but it is probably easier to do a line at a time, as in
these example lines from a PHP page that does JS:

echo "<script LANGUAGE='JavaScript'>\n";

echo "<INPUT type=\"hidden\" name=\"clock\" size=\"3\" value=\"\">\n";


--
Jim Pennino

Remove .spam.sux to reply.
703designs
Guest
 
Posts: n/a
#3: Nov 8 '08

re: nesting JS in echo's


On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
Quote:
hi folks,
>
html coder here, new and terrified * of php!!
aaaaaa!
>
i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
worked fine.
>
thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.
>
i tried escaping the double quotes (my echo used double quotes), but to no
avail.
>
here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture.
>
any help much appreciated..
>
++++++++++++++++
>
{ echo "
>
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
>
++++++++++++++++++++++++++
>
thanks
You can do this:

{ ?>

<!-- No escaping required -->

<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>

<?php }

Is "picnumber" a JavaScript or PHP veriable?

Thomas
703designs
Guest
 
Posts: n/a
#4: Nov 8 '08

re: nesting JS in echo's


On Nov 7, 7:16*pm, 703designs <thomasmal...@gmail.comwrote:
Quote:
On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
>
>
>
Quote:
hi folks,
>
Quote:
html coder here, new and terrified * of php!!
aaaaaa!
>
Quote:
i'm trying to bury a JS script to rotate a photo, in a page i convertedfrom
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
Quote:
worked fine.
>
Quote:
thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in theJS.
>
Quote:
i tried escaping the double quotes (my echo used double quotes), but tono
avail.
>
Quote:
here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture.
>
Quote:
any help much appreciated..
>
Quote:
++++++++++++++++
>
Quote:
{ echo "
>
Quote:
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
>
Quote:
++++++++++++++++++++++++++
>
Quote:
thanks
>
You can do this:
>
{ ?>
>
<!-- No escaping required -->
>
<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
>
<?php }
>
Is "picnumber" a JavaScript or PHP veriable?
>
Thomas
You can also use "heredoc":
http://us3.php.net/manual/en/languag...syntax.heredoc

<?php
echo <<<DOESNTMATTERWHATTHISSAYS

<!-- No escaping required -->
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>


DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line

Thomas
703designs
Guest
 
Posts: n/a
#5: Nov 8 '08

re: nesting JS in echo's


On Nov 7, 7:24*pm, 703designs <thomasmal...@gmail.comwrote:
Quote:
On Nov 7, 7:16*pm, 703designs <thomasmal...@gmail.comwrote:
>
>
>
Quote:
On Nov 7, 6:58*pm, "Request-1" <he...@you.comwrote:
>
Quote:
Quote:
hi folks,
>
Quote:
Quote:
html coder here, new and terrified * of php!!
aaaaaa!
>
Quote:
Quote:
i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
Quote:
Quote:
worked fine.
>
Quote:
Quote:
thought I'd try integrating a tested and true JS image random rotatorscript
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.
>
Quote:
Quote:
i tried escaping the double quotes (my echo used double quotes), but to no
avail.
>
Quote:
Quote:
here's the JS CODE i use in the tail end of my PHP. *"picnumber" isthe
variable holding the randomly assigned number that chooses the picture.
>
Quote:
Quote:
any help much appreciated..
>
Quote:
Quote:
++++++++++++++++
>
Quote:
Quote:
{ echo "
>
Quote:
Quote:
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
>
Quote:
Quote:
++++++++++++++++++++++++++
>
Quote:
Quote:
thanks
>
Quote:
You can do this:
>
Quote:
{ ?>
>
Quote:
<!-- No escaping required -->
>
Quote:
<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
>
Quote:
<?php }
>
Quote:
Is "picnumber" a JavaScript or PHP veriable?
>
Quote:
Thomas
>
You can also use "heredoc":http://us3.php.net/manual/en/languag...language.types...
>
<?php
echo <<<DOESNTMATTERWHATTHISSAYS
>
<!-- No escaping required -->
<script type='text/javascript'>
* * document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
>
DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line
>
Thomas
My bad, should have clarified: "DOESNTMATTERWHATTHISSAYS" means just
that, but those two have to match precisely.

Thomas
Request-1
Guest
 
Posts: n/a
#6: Nov 8 '08

re: nesting JS in echo's


"703designs" <thomasmallen@gmail.comwrote in message
news:3501dda4-b5a3-4581-9940-e036eb3146e6@r37g2000prr.googlegroups.com...
On Nov 7, 7:24 pm, 703designs <thomasmal...@gmail.comwrote:
Quote:
On Nov 7, 7:16 pm, 703designs <thomasmal...@gmail.comwrote:
>
>
>
Quote:
On Nov 7, 6:58 pm, "Request-1" <he...@you.comwrote:
>
Quote:
Quote:
hi folks,
>
Quote:
Quote:
html coder here, new and terrified * of php!!
aaaaaa!
>
Quote:
Quote:
i'm trying to bury a JS script to rotate a photo, in a page i
converted from
html to php.
the conversion went well, it was to use a php session cookie to stop
the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie
value
was nil.
>
Quote:
Quote:
worked fine.
>
Quote:
Quote:
thought I'd try integrating a tested and true JS image random rotator
script
into the echo command, but the problem was the syntax of the single
quotes
and double quotes needed in the doc.write and variable sequences in
the JS.
>
Quote:
Quote:
i tried escaping the double quotes (my echo used double quotes), but
to no
avail.
>
Quote:
Quote:
here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the
picture.
>
Quote:
Quote:
any help much appreciated..
>
Quote:
Quote:
++++++++++++++++
>
Quote:
Quote:
{ echo "
>
Quote:
Quote:
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }
>
Quote:
Quote:
++++++++++++++++++++++++++
>
Quote:
Quote:
thanks
>
Quote:
You can do this:
>
Quote:
{ ?>
>
Quote:
<!-- No escaping required -->
>
Quote:
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
>
Quote:
<?php }
>
Quote:
Is "picnumber" a JavaScript or PHP veriable?
>
Quote:
Thomas
>
You can also use
"heredoc":http://us3.php.net/manual/en/languag...language.types...
>
<?php
echo <<<DOESNTMATTERWHATTHISSAYS
>
<!-- No escaping required -->
<script type='text/javascript'>
document.write("<img src='images/swap/' + picnumber + '.jpg'>");
</script>
>
DOESNTMATTERWHATTHISSAYS;
// Don't indent the above line line
>
Thomas
My bad, should have clarified: "DOESNTMATTERWHATTHISSAYS" means just
that, but those two have to match precisely.

Thomas







thanks guys but no luck.
i'm swimming in single & double-quote-land.


I'll list the segments of PHP code I used below; if anyone can spot the
problem,
please bellow..

thanks ...
(problem seems in the php echo'ing of the JS)
(doc is saved with ".php" extension)






at very top of doc...

<?php setcookie("firsttime","no") ?>

then, the normal doctype, html tags, plus the following scripts to run the
activex for the video ...

<script src="Scripts/AC_RunActiveContent.js"
type="text/javascript"></script>
<script src="Scripts/AC_ActiveX.js"
type="text/javascript"></script>

then, I tried to "php-ize" the JS that sets the random variable ... (in
single lines as suggestd....)

<?php
echo '<script language="javascript">\n';
echo 'var picswap;\n';
echo 'picswap=new Image(320, 240);\n';
echo 'picswap.src="/images/swap/1.jpg"\n';
echo 'var picno = Math.random()*26;\n';
echo 'picno = Math.round(picno)\n';
echo '</script>';
?>


then, end of <headand more <htmlstuff ...
then, the PHP codes the ECHO's the activx/object embed stuff which plays the
movie only if you are 1st-time loading the page...


<?php
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") { echo "


<script type='text/javascript'>
AC_AX_RunContent(
'id','mediaPlayer','width','320','height','280','c lassid','CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95','codebase','http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701','standby','Loadin g
Microsoft Windows Media Player
components...','type','application/x-oleobject','pluginspage','http://microsoft.com/windows/mediaplayer/en/download/','name','mediaPlayer','displaysize','4','autosize ','-1','bgcolor','darkblue','showcontrols','true','sho wtracker','-1','showdisplay','0','showstatusbar','true','video border3d','-1','src','movies/bodymechs.wmv','autostart','true','designtimesp',' 5311','loop','false','filename','movies/bodymechs.wmv','animationatstart','true','transpar entatstart','true'
); //end AC code
</script><noscript><OBJECT id='mediaPlayer' width='320' height='280'
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...'
type='application/x-oleobject'>
<param name='fileName' value='movies/movie01.wmv'><param
name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value='true'>
<param name='showControls' value='true'>
<param name='loop' value='false'>
<param name='ShowStatusBar' value='true'>
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
bgcolor='darkblue' showcontrols='true' showtracker='-1'
showdisplay='0' showstatusbar='0' videoborder3d='-1' width='320'
height='240'
src='movies/movie01.wmv' autostart='false' designtimesp='5311'
loop='false'>
</EMBED>
</OBJECT></noscript>"; }



then, the IF branch, that sets the condition for followup visits to the
page....


if (@$firsttime != "")
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write(\"'<img src='images/swap/'+
picno + '.jpg'>\");\n";
echo "// end -->\n";
echo "</script>"; }

?>









Jerry Stuckle
Guest
 
Posts: n/a
#7: Nov 8 '08

re: nesting JS in echo's


Request-1 wrote:
Quote:
hi folks,
>
html coder here, new and terrified * of php!!
aaaaaa!
>
i'm trying to bury a JS script to rotate a photo, in a page i converted from
html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
worked fine.
>
thought I'd try integrating a tested and true JS image random rotator script
into the echo command, but the problem was the syntax of the single quotes
and double quotes needed in the doc.write and variable sequences in the JS.
>
i tried escaping the double quotes (my echo used double quotes), but to no
avail.
>
here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.
>
any help much appreciated..
>
>
++++++++++++++++
>
{ echo "
>
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }
>
++++++++++++++++++++++++++
>
thanks
>
>
You have an extra single quote before <img ...



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Request-1
Guest
 
Posts: n/a
#8: Nov 8 '08

re: nesting JS in echo's



"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
Request-1 wrote:
Quote:
>hi folks,
>>
>html coder here, new and terrified * of php!!
>aaaaaa!
>>
>i'm trying to bury a JS script to rotate a photo, in a page i converted
>from html to php.
>the conversion went well, it was to use a php session cookie to stop the
>repeating of an embedded video file on a per session basis;
>i amended the php code to display a still pic if the session cookie value
>was nil.
>>
>worked fine.
>>
>thought I'd try integrating a tested and true JS image random rotator
>script into the echo command, but the problem was the syntax of the
>single quotes and double quotes needed in the doc.write and variable
>sequences in the JS.
>>
>i tried escaping the double quotes (my echo used double quotes), but to
>no avail.
>>
>here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
>variable holding the randomly assigned number that chooses the picture.
>>
>any help much appreciated..
>>
>>
>++++++++++++++++
>>
>{ echo "
>>
> <script language='JavaScript1.2'>
> <!-- begin
> document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
> // end -->
></script>
> "; }
>>
>++++++++++++++++++++++++++
>>
>thanks
>
You have an extra single quote before <img ...


Hi Jerry,

the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }


but no avail. still no pic shows up.

anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!


703designs
Guest
 
Posts: n/a
#9: Nov 8 '08

re: nesting JS in echo's


On Nov 7, 9:47*pm, "Request-1" <he...@you.comwrote:
Quote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>
news:gf2t4m$inr$1@registered.motzarella.org...
>
>
>
Quote:
Request-1 wrote:
Quote:
hi folks,
>
Quote:
Quote:
html coder here, new and terrified * of php!!
aaaaaa!
>
Quote:
Quote:
i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
Quote:
Quote:
worked fine.
>
Quote:
Quote:
thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.
>
Quote:
Quote:
i tried escaping the double quotes (my echo used double quotes), but to
no avail.
>
Quote:
Quote:
here's the JS CODE i use in the tail end of my PHP. *"picnumber" is the
variable holding the randomly assigned number that chooses the picture..
>
Quote:
Quote:
any help much appreciated..
>
Quote:
Quote:
++++++++++++++++
>
Quote:
Quote:
{ echo "
>
Quote:
Quote:
* *<script language='JavaScript1.2'>
* * * * <!-- begin
* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
* *// end *-->
</script>
* *"; }
>
Quote:
Quote:
++++++++++++++++++++++++++
>
Quote:
Quote:
thanks
>
Quote:
You have an extra single quote before <img ...
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). *so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
* * * echo "<!-- begin \n";
* *echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
* *echo "// end *-->\n";
* *echo "</script>"; }
>
but no avail. *still no pic shows up.
>
anyway. * i get really confused with all the nested stuff and single-double
quotes. *i may try that "heredoc" thing that Thomas suggested. *I'll need a
couple of beers first. * Friday night on Javascript? *Bad!
Do you have a link to what you're working on?

Also, a note on echoing HTML from PHP: If you need to selectively drop
bits of HTML, this could (just maybe) be a good idea, but usually it's
not. Outputting JavaScript that outputs HTML seems very round-about to
me. Especially because you're adding the image element in such an
obtrusive manner (rather than adding a DOM node and changing its
source programmatically).

Now, on to the functionality itself. As it stands now, you're relying
on JS to provide the randomness. Why do you want to do that if you
have access to PHP? The only reason I've done something like this is
because I was stuck in an HTML-only environment. Actually, I wrote a
script for a coworker today to exactly that because she had ot
implement the same thing in a Dreamweaver template. You can take a
look if you want: http://content.coprinstitute.org/lib...RandomImage.js

The comments are only a tiny bit out of date: I recently extended it
to also affect the image source (it originally was for background
image styles). The cool thing is that you can pass in as many
filenames as you want.

Call the function like this:

randomImage(target image, image folder, method, filename, filename,
filename...);

For example:

randomImage("imageId", "/images", "src", "filename1.jpg",
"filename2.jpg");

would randomly select one of these two images on the page load (if I
made it an onload event).

Thomas

Jerry Stuckle
Guest
 
Posts: n/a
#10: Nov 8 '08

re: nesting JS in echo's


Request-1 wrote:
Quote:
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
>Request-1 wrote:
Quote:
>>hi folks,
>>>
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>>
>>i'm trying to bury a JS script to rotate a photo, in a page i converted
>>from html to php.
>>the conversion went well, it was to use a php session cookie to stop the
>>repeating of an embedded video file on a per session basis;
>>i amended the php code to display a still pic if the session cookie value
>>was nil.
>>>
>>worked fine.
>>>
>>thought I'd try integrating a tested and true JS image random rotator
>>script into the echo command, but the problem was the syntax of the
>>single quotes and double quotes needed in the doc.write and variable
>>sequences in the JS.
>>>
>>i tried escaping the double quotes (my echo used double quotes), but to
>>no avail.
>>>
>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
>>variable holding the randomly assigned number that chooses the picture.
>>>
>>any help much appreciated..
>>>
>>>
>>++++++++++++++++
>>>
>>{ echo "
>>>
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>>
>>++++++++++++++++++++++++++
>>>
>>thanks
>You have an extra single quote before <img ...
>
>
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
>
>
but no avail. still no pic shows up.
>
anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!
>
>
Yes, I'm familiar with concatenating and JS. I should have looked more
closely - I just saw the mismatched quotes and took the first one. Your
formatting and the word wrap makes your code harder to read.

So what do you get for js errors? Have you looked at the generated js code?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Jerry Stuckle
Guest
 
Posts: n/a
#11: Nov 8 '08

re: nesting JS in echo's


Request-1 wrote:
Quote:
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
>Request-1 wrote:
Quote:
>>hi folks,
>>>
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>>
>>i'm trying to bury a JS script to rotate a photo, in a page i converted
>>from html to php.
>>the conversion went well, it was to use a php session cookie to stop the
>>repeating of an embedded video file on a per session basis;
>>i amended the php code to display a still pic if the session cookie value
>>was nil.
>>>
>>worked fine.
>>>
>>thought I'd try integrating a tested and true JS image random rotator
>>script into the echo command, but the problem was the syntax of the
>>single quotes and double quotes needed in the doc.write and variable
>>sequences in the JS.
>>>
>>i tried escaping the double quotes (my echo used double quotes), but to
>>no avail.
>>>
>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
>>variable holding the randomly assigned number that chooses the picture.
>>>
>>any help much appreciated..
>>>
>>>
>>++++++++++++++++
>>>
>>{ echo "
>>>
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>>
>>++++++++++++++++++++++++++
>>>
>>thanks
>You have an extra single quote before <img ...
>
>
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
>
>
but no avail. still no pic shows up.
>
anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!
>
>
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#12: Nov 8 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Request-1 wrote:
Quote:
>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
>>Request-1 wrote:
>>>hi folks,
>>>>
>>>html coder here, new and terrified * of php!!
>>>aaaaaa!
>>>>
>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>converted from html to php.
>>>the conversion went well, it was to use a php session cookie to
>>>stop the repeating of an embedded video file on a per session
>>>basis; i amended the php code to display a still pic if the session
>>>cookie value was nil.
>>>>
>>>worked fine.
>>>>
>>>thought I'd try integrating a tested and true JS image random
>>>rotator script into the echo command, but the problem was the
>>>syntax of the single quotes and double quotes needed in the
>>>doc.write and variable sequences in the JS.
>>>>
>>>i tried escaping the double quotes (my echo used double quotes),
>>>but to no avail.
>>>>
>>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>>the variable holding the randomly assigned number that chooses the
>>>picture.
>>>>
>>>any help much appreciated..
>>>>
>>>>
>>>++++++++++++++++
>>>>
>>>{ echo "
>>>>
>>> <script language='JavaScript1.2'>
>>> <!-- begin
>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>> '.jpg'>\");
>>> // end -->
>>></script>
>>> "; }
>>>>
>>>++++++++++++++++++++++++++
>>>>
>>>thanks
>>You have an extra single quote before <img ...
>>
>>
>>
>Hi Jerry,
>>
>the single quote is actually necessary in JS when you're using
>document.write to add strings in series (is it called "concatenating"
>or something?). so the <img src...statement was broken down into 3
>seperate stings to be re-joined - all within the double-quote nested
>doc.write stmt. my mistake was to leave the image path in single
>quotes; instead I tried "escaped double quotes" to complete the image
>path, like so,
>>
>{ echo "<script language='JavaScript1.2'>\n";
> echo "<!-- begin \n";
> echo "document.write('<img src=\"images/swap/' + picnumber
> +'.jpg\"
>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>Image\">');\n";
> echo "// end -->\n";
> echo "</script>"; }
>>
>>
>but no avail. still no pic shows up.
>>
>anyway. i get really confused with all the nested stuff and
>single-double quotes. i may try that "heredoc" thing that Thomas
>suggested. I'll need a couple of beers first. Friday night on
>Javascript? Bad!
>>
>>
>
BTW - you don't need quotes around numeric values like your width,
height and border. Only non-numeric data.
Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.


Curtis
Guest
 
Posts: n/a
#13: Nov 8 '08

re: nesting JS in echo's


On Sat, 08 Nov 2008 02:47:31 GMT, hello@you.com wrote:
Quote:
>
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
Request-1 wrote:
Quote:
hi folks,
>
html coder here, new and terrified * of php!!
aaaaaa!
>
i'm trying to bury a JS script to rotate a photo, in a page i converted
from html to php.
the conversion went well, it was to use a php session cookie to stop the
repeating of an embedded video file on a per session basis;
i amended the php code to display a still pic if the session cookie value
was nil.
>
worked fine.
>
thought I'd try integrating a tested and true JS image random rotator
script into the echo command, but the problem was the syntax of the
single quotes and double quotes needed in the doc.write and variable
sequences in the JS.
>
i tried escaping the double quotes (my echo used double quotes), but to
no avail.
>
here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
variable holding the randomly assigned number that chooses the picture.
>
any help much appreciated..
>
>
++++++++++++++++
>
{ echo "
>
<script language='JavaScript1.2'>
<!-- begin
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
// end -->
</script>
"; }
>
++++++++++++++++++++++++++
>
thanks
You have an extra single quote before <img ...
>
>
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?).
Actually, you are not concatenating anything with the code Jerry
pointed out:
Quote:
Quote:
Quote:
document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
this results in:

document.write("'<img src='images/swap/'+ picnumber + '.jpg'");

This is a single string of invalid HTML. You should have used double
quotes, not single, while also not using the initial single quote:

document.write("<img src='images/swap/" + picnumber + ".jpg'>");

<ot>
You should also note that "document.write" doesn't function when
XHTML is served as application/xhtml+xml. It would also be much
cleaner if you used the DOM in the first place.
</ot>

[snip]
Quote:
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
Is there any particular reason you have this code in a block, or did
you not post enough code above it?

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
Request-1
Guest
 
Posts: n/a
#14: Nov 8 '08

re: nesting JS in echo's


Quote:
<ot>
You should also note that "document.write" doesn't function when
XHTML is served as application/xhtml+xml. It would also be much
cleaner if you used the DOM in the first place.
</ot>
>
[snip]
Quote:
>>
>{ echo "<script language='JavaScript1.2'>\n";
> echo "<!-- begin \n";
> echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>Image\">');\n";
> echo "// end -->\n";
> echo "</script>"; }
>
Is there any particular reason you have this code in a block, or did
you not post enough code above it?
>
--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
thanks to Curtis & 703 ...

ok, finally got it; the PHP "if" fork I used was fine:

{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber
+'.jpg\" width=\"320\" height=\"240\" border=\"0\"
alt=\"Fitness Training\">');\n";
echo "// end -->\n";
echo "</script>"; }

but I made a mistake in "php-izing" the <headrandomizing JS function. it
was fine to leave it in the orig JS.
Works like a charm now. Thanks to all for your input and finnicky
single-quote double-vision.

my original page that plays the intro video at every load is here:
http://bodymechanicsonline.com/home.htm

my experimental page that uses PHP session cookie to limit the video to 1st
load only, is here:
http://bodymechanicsonline.com/home.php

it's a little nerve-wracking but somewhat gratifying (!) to splice a little
PHP into a mostly-html page, call it by a php extension, and see it render
properly even tho' most of the page is not "echo'd" as per "proper" php.

anyway, i'm happy to live on Html Mountain; my brain flounder$ when it see$
too many dollar $igns ...


Daniel Smedegaard Buus
Guest
 
Posts: n/a
#15: Nov 8 '08

re: nesting JS in echo's


Request-1 wrote:
Quote:
>
>
>
thanks guys but no luck.
i'm swimming in single & double-quote-land.
>
>

I was thinking exactly the same as Thomas on this one. Echoing the stuff out
is only gonna complicate things and slow execution down. No reason you
shouldn't do

<?php
if ($something_or_other) { ?>

<script type="text/javascript>
alert("What's up, baby? <?php echo "I mean, what's up? :)" ?>");
</script>

<?php }
// And on with the show...
?>

Also, make sure you handle your cookies correctly. You can't create a cookie
and read it in the same script run. Also, make sure to specify the domain
and scope (".bodymechanicsonline.com"), or the cookie will exist for
http://bodymechanicsonline.com/ but not
http://www.bodymechanicsonline.com/, and vice versa. The new Firebug has
cookie support, makes it easy to debug.

HTH,
Daniel :)


Norman Peelman
Guest
 
Posts: n/a
#16: Nov 8 '08

re: nesting JS in echo's


Request-1 wrote:
Quote:
"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
>Request-1 wrote:
Quote:
>>hi folks,
>>>
>>html coder here, new and terrified * of php!!
>>aaaaaa!
>>>
>>i'm trying to bury a JS script to rotate a photo, in a page i converted
>>from html to php.
>>the conversion went well, it was to use a php session cookie to stop the
>>repeating of an embedded video file on a per session basis;
>>i amended the php code to display a still pic if the session cookie value
>>was nil.
>>>
>>worked fine.
>>>
>>thought I'd try integrating a tested and true JS image random rotator
>>script into the echo command, but the problem was the syntax of the
>>single quotes and double quotes needed in the doc.write and variable
>>sequences in the JS.
>>>
>>i tried escaping the double quotes (my echo used double quotes), but to
>>no avail.
>>>
>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is the
>>variable holding the randomly assigned number that chooses the picture.
>>>
>>any help much appreciated..
>>>
>>>
>>++++++++++++++++
>>>
>>{ echo "
>>>
>> <script language='JavaScript1.2'>
>> <!-- begin
>> document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
>> // end -->
>></script>
>> "; }
>>>
>>++++++++++++++++++++++++++
>>>
>>thanks
>You have an extra single quote before <img ...
>
>
>
Hi Jerry,
>
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
>
{ echo "<script language='JavaScript1.2'>\n";
echo "<!-- begin \n";
echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
echo "// end -->\n";
echo "</script>"; }
>
>
but no avail. still no pic shows up.
>
anyway. i get really confused with all the nested stuff and single-double
quotes. i may try that "heredoc" thing that Thomas suggested. I'll need a
couple of beers first. Friday night on Javascript? Bad!
>
>
The heredoc is probably the best choice (as i'm not really a big fan
of dropping in and out of <?PHP ?for some reason, readability I
guess.) HEREDOC allows variable expansion...


Take a look at: http://us2.php.net/manual/en/language.types.string.php



--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
703designs
Guest
 
Posts: n/a
#17: Nov 8 '08

re: nesting JS in echo's


On Nov 8, 7:47*am, Norman Peelman <npeel...@cfl.rr.comwrote:
Quote:
Request-1 wrote:
Quote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:gf2t4m$inr$1@registered.motzarella.org...
Quote:
Request-1 wrote:
>hi folks,
>
Quote:
Quote:
>html coder here, new and terrified * of php!!
>aaaaaa!
>
Quote:
Quote:
>i'm trying to bury a JS script to rotate a photo, in a page i converted
>from html to php.
>the conversion went well, it was to use a php session cookie to stop the
>repeating of an embedded video file on a per session basis;
>i amended the php code to display a still pic if the session cookie value
>was nil.
>
Quote:
Quote:
>worked fine.
>
Quote:
Quote:
>thought I'd try integrating a tested and true JS image random rotator
>script into the echo command, but the problem was the syntax of the
>single quotes and double quotes needed in the doc.write and variable
>sequences in the JS.
>
Quote:
Quote:
>i tried escaping the double quotes (my echo used double quotes), but to
>no avail.
>
Quote:
Quote:
>here's the JS CODE i use in the tail end of my PHP. *"picnumber" isthe
>variable holding the randomly assigned number that chooses the picture.
>
Quote:
Quote:
>any help much appreciated..
>
Quote:
Quote:
>++++++++++++++++
>
Quote:
Quote:
>{ echo "
>
Quote:
Quote:
>* *<script language='JavaScript1.2'>
>* * * * <!-- begin
>* * document.write(\"'<img src='images/swap/'+ picnumber + '.jpg'>\");
>* *// end *-->
></script>
>* *"; }
>
Quote:
Quote:
>++++++++++++++++++++++++++
>
Quote:
Quote:
>thanks
You have an extra single quote before <img ...
>
Quote:
Hi Jerry,
>
Quote:
the single quote is actually necessary in JS when you're using
document.write to add strings in series (is it called "concatenating" or
something?). *so the <img src...statement was broken down into 3 seperate
stings to be re-joined - all within the double-quote nested doc.write stmt.
my mistake was to leave the image path in single quotes; instead I tried
"escaped double quotes" to complete the image path, like so,
>
Quote:
{ echo "<script language='JavaScript1.2'>\n";
* * * echo "<!-- begin \n";
* *echo "document.write('<img src=\"images/swap/' + picnumber +'.jpg\"
width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
Image\">');\n";
* *echo "// end *-->\n";
* *echo "</script>"; }
>
Quote:
but no avail. *still no pic shows up.
>
Quote:
anyway. * i get really confused with all the nested stuff and single-double
quotes. *i may try that "heredoc" thing that Thomas suggested. *I'll need a
couple of beers first. * Friday night on Javascript? *Bad!
>
* *The heredoc is probably the best choice (as i'm not really a big fan
of dropping in and out of <?PHP ?for some reason, readability I
guess.) HEREDOC allows variable expansion...
>
Take a look at:http://us2.php.net/manual/en/language.types.string.php
>
--
Norman
Registered Linux user #461062
-Have you been towww.php.netyet?-
And of course, if you're willing to go a slightly expensive route
(performance-wise), you could always just make these script(s) a
separate file and include them where necessary. I think that's the
cleanest solution as long as you include an HTML comment indicating
where the code is coming from (a habit of mine).

Thomas
Jerry Stuckle
Guest
 
Posts: n/a
#18: Nov 9 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Request-1 wrote:
Quote:
>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>news:gf2t4m$inr$1@registered.motzarella.org...
>>>Request-1 wrote:
>>>>hi folks,
>>>>>
>>>>html coder here, new and terrified * of php!!
>>>>aaaaaa!
>>>>>
>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>converted from html to php.
>>>>the conversion went well, it was to use a php session cookie to
>>>>stop the repeating of an embedded video file on a per session
>>>>basis; i amended the php code to display a still pic if the session
>>>>cookie value was nil.
>>>>>
>>>>worked fine.
>>>>>
>>>>thought I'd try integrating a tested and true JS image random
>>>>rotator script into the echo command, but the problem was the
>>>>syntax of the single quotes and double quotes needed in the
>>>>doc.write and variable sequences in the JS.
>>>>>
>>>>i tried escaping the double quotes (my echo used double quotes),
>>>>but to no avail.
>>>>>
>>>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>>>the variable holding the randomly assigned number that chooses the
>>>>picture.
>>>>>
>>>>any help much appreciated..
>>>>>
>>>>>
>>>>++++++++++++++++
>>>>>
>>>>{ echo "
>>>>>
>>>> <script language='JavaScript1.2'>
>>>> <!-- begin
>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>> '.jpg'>\");
>>>> // end -->
>>>></script>
>>>> "; }
>>>>>
>>>>++++++++++++++++++++++++++
>>>>>
>>>>thanks
>>>You have an extra single quote before <img ...
>>>
>>>
>>Hi Jerry,
>>>
>>the single quote is actually necessary in JS when you're using
>>document.write to add strings in series (is it called "concatenating"
>>or something?). so the <img src...statement was broken down into 3
>>seperate stings to be re-joined - all within the double-quote nested
>>doc.write stmt. my mistake was to leave the image path in single
>>quotes; instead I tried "escaped double quotes" to complete the image
>>path, like so,
>>>
>>{ echo "<script language='JavaScript1.2'>\n";
>> echo "<!-- begin \n";
>> echo "document.write('<img src=\"images/swap/' + picnumber
>> +'.jpg\"
>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>Image\">');\n";
>> echo "// end -->\n";
>> echo "</script>"; }
>>>
>>>
>>but no avail. still no pic shows up.
>>>
>>anyway. i get really confused with all the nested stuff and
>>single-double quotes. i may try that "heredoc" thing that Thomas
>>suggested. I'll need a couple of beers first. Friday night on
>>Javascript? Bad!
>>>
>>>
>BTW - you don't need quotes around numeric values like your width,
>height and border. Only non-numeric data.
>
Are you talking about generating strict (X)HTML? Quotes must be on all
element attributes in that case, regardless of attribute value type.
>
>
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.

HTML does NOT require quotes on numeric attributes.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
703designs
Guest
 
Posts: n/a
#19: Nov 9 '08

re: nesting JS in echo's


On Nov 8, 7:21*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Seni Seven wrote:
Quote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>
Quote:
Quote:
Request-1 wrote:
>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>news:gf2t4m$inr$1@registered.motzarella.org...
>>Request-1 wrote:
>>>hi folks,
>
Quote:
Quote:
>>>html coder here, new and terrified * of php!!
>>>aaaaaa!
>
Quote:
Quote:
>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>converted from html to php.
>>>the conversion went well, it was to use a php session cookie to
>>>stop the repeating of an embedded video file on a per session
>>>basis; i amended the php code to display a still pic if the session
>>>cookie value was nil.
>
Quote:
Quote:
>>>worked fine.
>
Quote:
Quote:
>>>thought I'd try integrating a tested and true JS image random
>>>rotator script into the echo command, but the problem was the
>>>syntax of the single quotes and double quotes needed in the
>>>doc.write and variable sequences in the JS.
>
Quote:
Quote:
>>>i tried escaping the double quotes (my echo used double quotes),
>>>but to no avail.
>
Quote:
Quote:
>>>here's the JS CODE i use in the tail end of my PHP. *"picnumber" is
>>>the variable holding the randomly assigned number that chooses the
>>>picture.
>
Quote:
Quote:
>>>any help much appreciated..
>
Quote:
Quote:
>>>++++++++++++++++
>
Quote:
Quote:
>>>{ echo "
>
Quote:
Quote:
>>>* *<script language='JavaScript1.2'>
>>>* * * * <!-- begin
>>>* * document.write(\"'<img src='images/swap/'+ picnumber +
>>>* * '.jpg'>\");
>>>* *// end *-->
>>></script>
>>>* *"; }
>
Quote:
Quote:
>>>++++++++++++++++++++++++++
>
Quote:
Quote:
>>>thanks
>>You have an extra single quote before <img ...
>
Quote:
Quote:
>Hi Jerry,
>
Quote:
Quote:
>the single quote is actually necessary in JS when you're using
>document.write to add strings in series (is it called "concatenating"
>or something?). *so the <img src...statement was broken down into3
>seperate stings to be re-joined - all within the double-quote nested
>doc.write stmt. my mistake was to leave the image path in single
>quotes; instead I tried "escaped double quotes" to complete the image
>path, like so,
>
Quote:
Quote:
>{ echo "<script language='JavaScript1.2'>\n";
>* * * echo "<!-- begin \n";
>* *echo "document.write('<img src=\"images/swap/' + picnumber
>* *+'.jpg\"
>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>Image\">');\n";
>* *echo "// end *-->\n";
>* *echo "</script>"; }
>
Quote:
Quote:
>but no avail. *still no pic shows up.
>
Quote:
Quote:
>anyway. * i get really confused with all the nested stuff and
>single-double quotes. *i may try that "heredoc" thing that Thomas
>suggested. *I'll need a couple of beers first. * Friday night on
>Javascript? *Bad!
>
Quote:
Quote:
BTW - you don't need quotes around numeric values like your width,
height and border. *Only non-numeric data.
>
Quote:
Are you talking about generating strict (X)HTML? *Quotes must be on all
element attributes in that case, regardless of attribute value type.
>
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.
>
HTML does NOT require quotes on numeric attributes.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Haha, where did you get that from? I've been building sites for ages
now with the XHTML doctype (transitional or strict, validates) and
never had any problems. I don't think I've ever had the desire or a
reason to use single quotes in HTML...

Thomas
Jerry Stuckle
Guest
 
Posts: n/a
#20: Nov 9 '08

re: nesting JS in echo's


703designs wrote:
Quote:
On Nov 8, 7:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>Request-1 wrote:
>>>>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>>>news:gf2t4m$inr$1@registered.motzarella.org. ..
>>>>>Request-1 wrote:
>>>>>>hi folks,
>>>>>>html coder here, new and terrified * of php!!
>>>>>>aaaaaa!
>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>converted from html to php.
>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>basis; i amended the php code to display a still pic if the session
>>>>>>cookie value was nil.
>>>>>>worked fine.
>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>rotator script into the echo command, but the problem was the
>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>doc.write and variable sequences in the JS.
>>>>>>i tried escaping the double quotes (my echo used double quotes),
>>>>>>but to no avail.
>>>>>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>>>>>the variable holding the randomly assigned number that chooses the
>>>>>>picture.
>>>>>>any help much appreciated..
>>>>>>++++++++++++++++
>>>>>>{ echo "
>>>>>> <script language='JavaScript1.2'>
>>>>>> <!-- begin
>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>> '.jpg'>\");
>>>>>> // end -->
>>>>>></script>
>>>>>> "; }
>>>>>>++++++++++++++++++++++++++
>>>>>>thanks
>>>>>You have an extra single quote before <img ...
>>>>Hi Jerry,
>>>>the single quote is actually necessary in JS when you're using
>>>>document.write to add strings in series (is it called "concatenating"
>>>>or something?). so the <img src...statement was broken down into 3
>>>>seperate stings to be re-joined - all within the double-quote nested
>>>>doc.write stmt. my mistake was to leave the image path in single
>>>>quotes; instead I tried "escaped double quotes" to complete the image
>>>>path, like so,
>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>> echo "<!-- begin \n";
>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>> +'.jpg\"
>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>Image\">');\n";
>>>> echo "// end -->\n";
>>>> echo "</script>"; }
>>>>but no avail. still no pic shows up.
>>>>anyway. i get really confused with all the nested stuff and
>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>Javascript? Bad!
>>>BTW - you don't need quotes around numeric values like your width,
>>>height and border. Only non-numeric data.
>>Are you talking about generating strict (X)HTML? Quotes must be on all
>>element attributes in that case, regardless of attribute value type.
>1. There is no indication this is XHTML.
>2. You shouldn't use XHTML for web pages - it's not well supported by
>some browser, not the least being IE 6 and 7.
>>
>HTML does NOT require quotes on numeric attributes.
>>
Quote:
Haha, where did you get that from? I've been building sites for ages
now with the XHTML doctype (transitional or strict, validates) and
never had any problems. I don't think I've ever had the desire or a
reason to use single quotes in HTML...
>
Thomas
Try google. It's well documented.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#21: Nov 9 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Seni Seven wrote:
Quote:
>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>
Quote:
>>Request-1 wrote:
>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>news:gf2t4m$inr$1@registered.motzarella.org.. .
>>>>Request-1 wrote:
>>>>>hi folks,
>>>>>>
>>>>>html coder here, new and terrified * of php!!
>>>>>aaaaaa!
>>>>>>
>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>converted from html to php.
>>>>>the conversion went well, it was to use a php session cookie to
>>>>>stop the repeating of an embedded video file on a per session
>>>>>basis; i amended the php code to display a still pic if the session
>>>>>cookie value was nil.
>>>>>>
>>>>>worked fine.
>>>>>>
>>>>>thought I'd try integrating a tested and true JS image random
>>>>>rotator script into the echo command, but the problem was the
>>>>>syntax of the single quotes and double quotes needed in the
>>>>>doc.write and variable sequences in the JS.
>>>>>>
>>>>>i tried escaping the double quotes (my echo used double quotes),
>>>>>but to no avail.
>>>>>>
>>>>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>>>>the variable holding the randomly assigned number that chooses the
>>>>>picture.
>>>>>>
>>>>>any help much appreciated..
>>>>>>
>>>>>>
>>>>>++++++++++++++++
>>>>>>
>>>>>{ echo "
>>>>>>
>>>>> <script language='JavaScript1.2'>
>>>>> <!-- begin
>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>> '.jpg'>\");
>>>>> // end -->
>>>>></script>
>>>>> "; }
>>>>>>
>>>>>++++++++++++++++++++++++++
>>>>>>
>>>>>thanks
>>>>You have an extra single quote before <img ...
>>>>
>>>>
>>>Hi Jerry,
>>>>
>>>the single quote is actually necessary in JS when you're using
>>>document.write to add strings in series (is it called "concatenating"
>>>or something?). so the <img src...statement was broken down into 3
>>>seperate stings to be re-joined - all within the double-quote nested
>>>doc.write stmt. my mistake was to leave the image path in single
>>>quotes; instead I tried "escaped double quotes" to complete the image
>>>path, like so,
>>>>
>>>{ echo "<script language='JavaScript1.2'>\n";
>>> echo "<!-- begin \n";
>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>> +'.jpg\"
>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>Image\">');\n";
>>> echo "// end -->\n";
>>> echo "</script>"; }
>>>>
>>>>
>>>but no avail. still no pic shows up.
>>>>
>>>anyway. i get really confused with all the nested stuff and
>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>suggested. I'll need a couple of beers first. Friday night on
>>>Javascript? Bad!
>>>>
>>>>
>>BTW - you don't need quotes around numeric values like your width,
>>height and border. Only non-numeric data.
>>
>Are you talking about generating strict (X)HTML? Quotes must be on all
>element attributes in that case, regardless of attribute value type.
>>
>>
>
1. There is no indication this is XHTML.
2. You shouldn't use XHTML for web pages - it's not well supported by
some browser, not the least being IE 6 and 7.
Actually, many can and do use XHTML for web pages.

I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.

There are various documents that can be googled that specify solutions wo
using XHTML for broken browsers like Internet Explorer, such as using an
XML stylesheet also to get around problems with showing XHTML in
standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
Quote:
>
HTML does NOT require quotes on numeric attributes.
Actually the HTML 4 recommendation does not assert in any way whatsoever
that quotes can be omitted for attributes that have numeric values. It
does allow for their omission, but recommends they always be used. There
is no indication about whether this recommendation applies to the various
levels of HTML: strict, transitional, frameset.

http://www.w3.org/TR/html4/intro/sgm...tml#attributes

Here is one individual's take on SCRUPULOUSLY quoting all attribute values
in HTML, which MUST be quoted in every case in XHTML:

http://www.cs.tut.fi/~jkorpela/qattr.html

He is or was a regular (long-time) and, I believe, respected contributer
to the HTML usage newsgroups.
Seni Seven
Guest
 
Posts: n/a
#22: Nov 9 '08

re: nesting JS in echo's


Seni Seven <OneWhoLovesYou@humanitarian.cawrote in comp.lang.php:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Request-1 wrote:
>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>news:gf2t4m$inr$1@registered.motzarella.org. ..
>>>>>Request-1 wrote:
>>>>>>hi folks,
>>>>>>>
>>>>>>html coder here, new and terrified * of php!!
>>>>>>aaaaaa!
>>>>>>>
>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>converted from html to php.
>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>session cookie value was nil.
>>>>>>>
>>>>>>worked fine.
>>>>>>>
>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>rotator script into the echo command, but the problem was the
>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>doc.write and variable sequences in the JS.
>>>>>>>
>>>>>>i tried escaping the double quotes (my echo used double quotes),
>>>>>>but to no avail.
>>>>>>>
>>>>>>here's the JS CODE i use in the tail end of my PHP. "picnumber"
>>>>>>is the variable holding the randomly assigned number that
>>>>>>chooses the picture.
>>>>>>>
>>>>>>any help much appreciated..
>>>>>>>
>>>>>>>
>>>>>>++++++++++++++++
>>>>>>>
>>>>>>{ echo "
>>>>>>>
>>>>>> <script language='JavaScript1.2'>
>>>>>> <!-- begin
>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>> '.jpg'>\");
>>>>>> // end -->
>>>>>></script>
>>>>>> "; }
>>>>>>>
>>>>>>++++++++++++++++++++++++++
>>>>>>>
>>>>>>thanks
>>>>>You have an extra single quote before <img ...
>>>>>
>>>>>
>>>>Hi Jerry,
>>>>>
>>>>the single quote is actually necessary in JS when you're using
>>>>document.write to add strings in series (is it called
>>>>"concatenating" or something?). so the <img src...statement was
>>>>broken down into 3 seperate stings to be re-joined - all within
>>>>the double-quote nested doc.write stmt. my mistake was to leave
>>>>the image path in single quotes; instead I tried "escaped double
>>>>quotes" to complete the image path, like so,
>>>>>
>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>> echo "<!-- begin \n";
>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>> +'.jpg\"
>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>Image\">');\n";
>>>> echo "// end -->\n";
>>>> echo "</script>"; }
>>>>>
>>>>>
>>>>but no avail. still no pic shows up.
>>>>>
>>>>anyway. i get really confused with all the nested stuff and
>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>Javascript? Bad!
>>>>>
>>>>>
>>>BTW - you don't need quotes around numeric values like your width,
>>>height and border. Only non-numeric data.
>>>
>>Are you talking about generating strict (X)HTML? Quotes must be on
>>all element attributes in that case, regardless of attribute value
>>type.
>>>
>>>
>>
>1. There is no indication this is XHTML.
>2. You shouldn't use XHTML for web pages - it's not well supported by
>some browser, not the least being IE 6 and 7.
>
Actually, many can and do use XHTML for web pages.
>
I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.
[neglected to give the STRICT XHTML-indicated page]

http://www.w3.org/MarkUp/2004/xhtml-faq
Quote:
>
There are various documents that can be googled that specify solutions
wo using XHTML for broken browsers like Internet Explorer, such as
using an XML stylesheet also to get around problems with showing XHTML
in standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
>
Quote:
>>
>HTML does NOT require quotes on numeric attributes.
>
Actually the HTML 4 recommendation does not assert in any way
whatsoever that quotes can be omitted for attributes that have numeric
values. It does allow for their omission, but recommends they always
be used. There is no indication about whether this recommendation
applies to the various levels of HTML: strict, transitional,
frameset.
>
http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>
Here is one individual's take on SCRUPULOUSLY quoting all attribute
values in HTML, which MUST be quoted in every case in XHTML:
>
http://www.cs.tut.fi/~jkorpela/qattr.html
>
He is or was a regular (long-time) and, I believe, respected
contributer to the HTML usage newsgroups.
>


Jerry Stuckle
Guest
 
Posts: n/a
#23: Nov 9 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Request-1 wrote:
>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>news:gf2t4m$inr$1@registered.motzarella.org. ..
>>>>>Request-1 wrote:
>>>>>>hi folks,
>>>>>>>
>>>>>>html coder here, new and terrified * of php!!
>>>>>>aaaaaa!
>>>>>>>
>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>converted from html to php.
>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>basis; i amended the php code to display a still pic if the session
>>>>>>cookie value was nil.
>>>>>>>
>>>>>>worked fine.
>>>>>>>
>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>rotator script into the echo command, but the problem was the
>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>doc.write and variable sequences in the JS.
>>>>>>>
>>>>>>i tried escaping the double quotes (my echo used double quotes),
>>>>>>but to no avail.
>>>>>>>
>>>>>>here's the JS CODE i use in the tail end of my PHP. "picnumber" is
>>>>>>the variable holding the randomly assigned number that chooses the
>>>>>>picture.
>>>>>>>
>>>>>>any help much appreciated..
>>>>>>>
>>>>>>>
>>>>>>++++++++++++++++
>>>>>>>
>>>>>>{ echo "
>>>>>>>
>>>>>> <script language='JavaScript1.2'>
>>>>>> <!-- begin
>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>> '.jpg'>\");
>>>>>> // end -->
>>>>>></script>
>>>>>> "; }
>>>>>>>
>>>>>>++++++++++++++++++++++++++
>>>>>>>
>>>>>>thanks
>>>>>You have an extra single quote before <img ...
>>>>>
>>>>Hi Jerry,
>>>>>
>>>>the single quote is actually necessary in JS when you're using
>>>>document.write to add strings in series (is it called "concatenating"
>>>>or something?). so the <img src...statement was broken down into 3
>>>>seperate stings to be re-joined - all within the double-quote nested
>>>>doc.write stmt. my mistake was to leave the image path in single
>>>>quotes; instead I tried "escaped double quotes" to complete the image
>>>>path, like so,
>>>>>
>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>> echo "<!-- begin \n";
>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>> +'.jpg\"
>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>Image\">');\n";
>>>> echo "// end -->\n";
>>>> echo "</script>"; }
>>>>>
>>>>>
>>>>but no avail. still no pic shows up.
>>>>>
>>>>anyway. i get really confused with all the nested stuff and
>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>Javascript? Bad!
>>>>>
>>>>>
>>>BTW - you don't need quotes around numeric values like your width,
>>>height and border. Only non-numeric data.
>>Are you talking about generating strict (X)HTML? Quotes must be on all
>>element attributes in that case, regardless of attribute value type.
>>>
>>>
>1. There is no indication this is XHTML.
>2. You shouldn't use XHTML for web pages - it's not well supported by
>some browser, not the least being IE 6 and 7.
>
Actually, many can and do use XHTML for web pages.
>
I looked at this page successfully using IE7. The web document was
written by NONE OTHER THAN BY THE W3 Consortium itself, the standards-
setting (they use the term "recommendations" modestly instead of
"standards") in strict XHTML. Go figure.
>
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
Quote:
There are various documents that can be googled that specify solutions wo
using XHTML for broken browsers like Internet Explorer, such as using an
XML stylesheet also to get around problems with showing XHTML in
standards-violating, never-get-it-right HTTP clients like Internet
Explorer. This is not rocket science.
>
Quote:
>HTML does NOT require quotes on numeric attributes.
>
Actually the HTML 4 recommendation does not assert in any way whatsoever
that quotes can be omitted for attributes that have numeric values. It
does allow for their omission, but recommends they always be used. There
is no indication about whether this recommendation applies to the various
levels of HTML: strict, transitional, frameset.
>
http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
Quote:
Here is one individual's take on SCRUPULOUSLY quoting all attribute values
in HTML, which MUST be quoted in every case in XHTML:
>
http://www.cs.tut.fi/~jkorpela/qattr.html
>
He is or was a regular (long-time) and, I believe, respected contributer
to the HTML usage newsgroups.
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.

Search enough and you can find an opinion you agree with anywhere on the
internet.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#24: Nov 9 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Seni Seven wrote:
Quote:
>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>
Quote:
>>Seni Seven wrote:
>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Request-1 wrote:
>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>news:gf2t4m$inr$1@registered.motzarella.org.. .
>>>>>>Request-1 wrote:
>>>>>>>hi folks,
>>>>>>>>
>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>aaaaaa!
>>>>>>>>
>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>converted from html to php.
>>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>>session cookie value was nil.
>>>>>>>>
>>>>>>>worked fine.
>>>>>>>>
>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>doc.write and variable sequences in the JS.
>>>>>>>>
>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>quotes), but to no avail.
>>>>>>>>
>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>number that chooses the picture.
>>>>>>>>
>>>>>>>any help much appreciated..
>>>>>>>>
>>>>>>>>
>>>>>>>++++++++++++++++
>>>>>>>>
>>>>>>>{ echo "
>>>>>>>>
>>>>>>> <script language='JavaScript1.2'>
>>>>>>> <!-- begin
>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>> '.jpg'>\");
>>>>>>> // end -->
>>>>>>></script>
>>>>>>> "; }
>>>>>>>>
>>>>>>>++++++++++++++++++++++++++
>>>>>>>>
>>>>>>>thanks
>>>>>>You have an extra single quote before <img ...
>>>>>>
>>>>>Hi Jerry,
>>>>>>
>>>>>the single quote is actually necessary in JS when you're using
>>>>>document.write to add strings in series (is it called
>>>>>"concatenating" or something?). so the <img src...statement
>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>within the double-quote nested doc.write stmt. my mistake was to
>>>>>leave the image path in single quotes; instead I tried "escaped
>>>>>double quotes" to complete the image path, like so,
>>>>>>
>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>> echo "<!-- begin \n";
>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>> +'.jpg\"
>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>>Image\">');\n";
>>>>> echo "// end -->\n";
>>>>> echo "</script>"; }
>>>>>>
>>>>>>
>>>>>but no avail. still no pic shows up.
>>>>>>
>>>>>anyway. i get really confused with all the nested stuff and
>>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>>Javascript? Bad!
>>>>>>
>>>>>>
>>>>BTW - you don't need quotes around numeric values like your width,
>>>>height and border. Only non-numeric data.
>>>Are you talking about generating strict (X)HTML? Quotes must be on
>>>all element attributes in that case, regardless of attribute value
>>>type.
>>>>
>>>>
>>1. There is no indication this is XHTML.
>>2. You shouldn't use XHTML for web pages - it's not well supported
>>by some browser, not the least being IE 6 and 7.
>>
>Actually, many can and do use XHTML for web pages.
>>
>I looked at this page successfully using IE7. The web document was
>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>standards- setting (they use the term "recommendations" modestly
>instead of "standards") in strict XHTML. Go figure.
>>
>
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? Where is the need for xhtml?
>
Quote:
>There are various documents that can be googled that specify
>solutions wo using XHTML for broken browsers like Internet Explorer,
>such as using an XML stylesheet also to get around problems with
>showing XHTML in standards-violating, never-get-it-right HTTP clients
>like Internet Explorer. This is not rocket science.
>>
Quote:
>>HTML does NOT require quotes on numeric attributes.
>>
>Actually the HTML 4 recommendation does not assert in any way
>whatsoever that quotes can be omitted for attributes that have
>numeric values. It does allow for their omission, but recommends
>they always be used. There is no indication about whether this
>recommendation applies to the various levels of HTML: strict,
>transitional, frameset.
>>
>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>
>
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
Quote:
>
Quote:
>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>values in HTML, which MUST be quoted in every case in XHTML:
>>
>http://www.cs.tut.fi/~jkorpela/qattr.html
>>
>He is or was a regular (long-time) and, I believe, respected
>contributer to the HTML usage newsgroups.
>
So? That's one person's opinion. Worth no more or less than anyone
else's opinion.
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.

But then you have already established that you are a hair-splitter.

Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
Quote:
Search enough and you can find an opinion you agree with anywhere on
the internet.
Precisely right!

But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, some of
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.

Oh my!

A new word of the day:

http://www.merriam-webster.com/dictionary/consensus
Jerry Stuckle
Guest
 
Posts: n/a
#25: Nov 9 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Request-1 wrote:
>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>news:gf2t4m$inr$1@registered.motzarella.org. ..
>>>>>>>Request-1 wrote:
>>>>>>>>hi folks,
>>>>>>>>>
>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>aaaaaa!
>>>>>>>>>
>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>>converted from html to php.
>>>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>>>session cookie value was nil.
>>>>>>>>>
>>>>>>>>worked fine.
>>>>>>>>>
>>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>>doc.write and variable sequences in the JS.
>>>>>>>>>
>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>quotes), but to no avail.
>>>>>>>>>
>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>number that chooses the picture.
>>>>>>>>>
>>>>>>>>any help much appreciated..
>>>>>>>>>
>>>>>>>>>
>>>>>>>>++++++++++++++++
>>>>>>>>>
>>>>>>>>{ echo "
>>>>>>>>>
>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>> <!-- begin
>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>> '.jpg'>\");
>>>>>>>> // end -->
>>>>>>>></script>
>>>>>>>> "; }
>>>>>>>>>
>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>
>>>>>>>>thanks
>>>>>>>You have an extra single quote before <img ...
>>>>>>Hi Jerry,
>>>>>>>
>>>>>>the single quote is actually necessary in JS when you're using
>>>>>>document.write to add strings in series (is it called
>>>>>>"concatenating" or something?). so the <img src...statement
>>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>>within the double-quote nested doc.write stmt. my mistake was to
>>>>>>leave the image path in single quotes; instead I tried "escaped
>>>>>>double quotes" to complete the image path, like so,
>>>>>>>
>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>> echo "<!-- begin \n";
>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>> +'.jpg\"
>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>>>Image\">');\n";
>>>>>> echo "// end -->\n";
>>>>>> echo "</script>"; }
>>>>>>>
>>>>>>>
>>>>>>but no avail. still no pic shows up.
>>>>>>>
>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>>>Javascript? Bad!
>>>>>>>
>>>>>>>
>>>>>BTW - you don't need quotes around numeric values like your width,
>>>>>height and border. Only non-numeric data.
>>>>Are you talking about generating strict (X)HTML? Quotes must be on
>>>>all element attributes in that case, regardless of attribute value
>>>>type.
>>>>>
>>>>>
>>>1. There is no indication this is XHTML.
>>>2. You shouldn't use XHTML for web pages - it's not well supported
>>>by some browser, not the least being IE 6 and 7.
>>Actually, many can and do use XHTML for web pages.
>>>
>>I looked at this page successfully using IE7. The web document was
>>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>standards- setting (they use the term "recommendations" modestly
>>instead of "standards") in strict XHTML. Go figure.
>>>
>Sure, you CAN make pages which will cater to the different browsers
>idiosyncrasies, but why? Where is the need for xhtml?
>>
Quote:
>>There are various documents that can be googled that specify
>>solutions wo using XHTML for broken browsers like Internet Explorer,
>>such as using an XML stylesheet also to get around problems with
>>showing XHTML in standards-violating, never-get-it-right HTTP clients
>>like Internet Explorer. This is not rocket science.
>>>
>>>HTML does NOT require quotes on numeric attributes.
>>Actually the HTML 4 recommendation does not assert in any way
>>whatsoever that quotes can be omitted for attributes that have
>>numeric values. It does allow for their omission, but recommends
>>they always be used. There is no indication about whether this
>>recommendation applies to the various levels of HTML: strict,
>>transitional, frameset.
>>>
>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>
>Which backs up my claim that HTML does NOT require quotes on numeric
>attributes.
>
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>
Quote:
Quote:
>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>>values in HTML, which MUST be quoted in every case in XHTML:
>>>
>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>
>>He is or was a regular (long-time) and, I believe, respected
>>contributer to the HTML usage newsgroups.
>So? That's one person's opinion. Worth no more or less than anyone
>else's opinion.
>
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.
>
But then you have already established that you are a hair-splitter.
>
Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
>
Quote:
>Search enough and you can find an opinion you agree with anywhere on
>the internet.
>
Precisely right!
>
But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, some of
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.
>
Oh my!
>
A new word of the day:
>
http://www.merriam-webster.com/dictionary/consensus
For starters:

http://en.wikipedia.org/wiki/Internet_Explorer

"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is on
the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."

And tens of thousands of similar pages.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
703designs
Guest
 
Posts: n/a
#26: Nov 10 '08

re: nesting JS in echo's


On Nov 9, 6:44*pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Seni Seven wrote:
Quote:
Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>
Quote:
Quote:
Seni Seven wrote:
>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>
Quote:
Quote:
>>Seni Seven wrote:
>>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>
Quote:
Quote:
>>>>Request-1 wrote:
>>>>>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>>>>>news:gf2t4m$inr$1@registered.motzarella.org. ..
>>>>>>Request-1 wrote:
>>>>>>>hi folks,
>
Quote:
Quote:
>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>aaaaaa!
>
Quote:
Quote:
>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>converted from html to php.
>>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>>session cookie value was nil.
>
Quote:
Quote:
>>>>>>>worked fine.
>
Quote:
Quote:
>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>doc.write and variable sequences in the JS.
>
Quote:
Quote:
>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>quotes), but to no avail.
>
Quote:
Quote:
>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>number that chooses the picture.
>
Quote:
Quote:
>>>>>>>any help much appreciated..
>
Quote:
Quote:
>>>>>>>++++++++++++++++
>
Quote:
Quote:
>>>>>>>{ echo "
>
Quote:
Quote:
>>>>>>>* *<script language='JavaScript1.2'>
>>>>>>>* * * * <!-- begin
>>>>>>>* * document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>* * '.jpg'>\");
>>>>>>>* *// end *-->
>>>>>>></script>
>>>>>>>* *"; }
>
Quote:
Quote:
>>>>>>>++++++++++++++++++++++++++
>
Quote:
Quote:
>>>>>>>thanks
>>>>>>You have an extra single quote before <img ...
>>>>>Hi Jerry,
>
Quote:
Quote:
>>>>>the single quote is actually necessary in JS when you're using
>>>>>document.write to add strings in series (is it called
>>>>>"concatenating" or something?). *so the <img src...statement
>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>within the double-quote nested doc.write stmt. my mistake was to
>>>>>leave the image path in single quotes; instead I tried "escaped
>>>>>double quotes" to complete the image path, like so,
>
Quote:
Quote:
>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>* * * echo "<!-- begin \n";
>>>>>* *echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>* *+'.jpg\"
>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>>Image\">');\n";
>>>>>* *echo "// end *-->\n";
>>>>>* *echo "</script>"; }
>
Quote:
Quote:
>>>>>but no avail. *still no pic shows up.
>
Quote:
Quote:
>>>>>anyway. * i get really confused with all the nested stuff and
>>>>>single-double quotes. *i may try that "heredoc" thing that Thomas
>>>>>suggested. *I'll need a couple of beers first. * Friday nighton
>>>>>Javascript? *Bad!
>
Quote:
Quote:
>>>>BTW - you don't need quotes around numeric values like your width,
>>>>height and border. *Only non-numeric data.
>>>Are you talking about generating strict (X)HTML? *Quotes must be on
>>>all element attributes in that case, regardless of attribute value
>>>type.
>
Quote:
Quote:
>>1. There is no indication this is XHTML.
>>2. You shouldn't use XHTML for web pages - it's not well supported
>>by some browser, not the least being IE 6 and 7.
>Actually, many can and do use XHTML for web pages. *
>
Quote:
Quote:
>I looked at this page successfully using IE7. *The web document was
>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>standards- setting (they use the term "recommendations" modestly
>instead of "standards") in strict XHTML. *Go figure. *
>
Quote:
Quote:
Sure, you CAN make pages which will cater to the different browsers
idiosyncrasies, but why? *Where is the need for xhtml?
>
Quote:
Quote:
>There are various documents that can be googled that specify
>solutions wo using XHTML for broken browsers like Internet Explorer,
>such as using an XML stylesheet also to get around problems with
>showing XHTML in standards-violating, never-get-it-right HTTP clients
>like Internet Explorer. *This is not rocket science.
>
Quote:
Quote:
>>HTML does NOT require quotes on numeric attributes.
>Actually the HTML 4 recommendation does not assert in any way
>whatsoever that quotes can be omitted for attributes that have
>numeric values. *It does allow for their omission, but recommends
>they always be used. *There is no indication about whether this
>recommendation applies to the various levels of HTML: *strict,
>transitional, frameset.
>>
Quote:
Quote:
Which backs up my claim that HTML does NOT require quotes on numeric
attributes.
>
Quote:
If you really want to split hairs, as you apparently want to do, the
loosest usage of HTML doesn't require quotes on any attribute values
except in the very few circumstances that your determined attempts to
confuse the browser do not achieve the rendering you desire.
>
Quote:
Quote:
>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>values in HTML, which MUST be quoted in every case in XHTML:
>>
Quote:
Quote:
>He is or was a regular (long-time) and, I believe, respected
>contributer to the HTML usage newsgroups.
So? *That's one person's opinion. *Worth no more or less than anyone
else's opinion.
>
Quote:
Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
you to quote attribute values----ALL OF THEM.
>
Quote:
But then you have already established that you are a hair-splitter.
>
Quote:
Perhaps you'd like to disparage the "opinions" of the HTML standards
keepers too?
>
Quote:
Quote:
Search enough and you can find an opinion you agree with anywhere on
the internet.
>
Quote:
Precisely right!
>
Quote:
But then I am not so desperate to support my claims on the sole "opinion"
of one kook with a web page against the 99,999 opinions of people who
impress me with reason and logic and a certain level of erudition, someof
whom actually sit on standards-setting committees like the one that
promulgates the HTML specification.
>
Quote:
Oh my!
>
Quote:
A new word of the day: *
>>
For starters:
>
http://en.wikipedia.org/wiki/Internet_Explorer
>
"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is on
the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."
>
And tens of thousands of similar pages.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
You may be technically right, but I think that you're practically
wrong. By that, I mean that I don't think anyone writes HTML
differently from XHTML. So we have the illusion that IE works with
XHTML. I'm not sure what is meant by "compatibility principles"
though.

Thomas
Jerry Stuckle
Guest
 
Posts: n/a
#27: Nov 10 '08

re: nesting JS in echo's


703designs wrote:
Quote:
On Nov 9, 6:44 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>Seni Seven wrote:
>>>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>>>Seni Seven wrote:
>>>>>>Jerry Stuckle <jstuck...@attglobal.netwrote in comp.lang.php:
>>>>>>>Request-1 wrote:
>>>>>>>>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>>>>>>>>news:gf2t4m$inr$1@registered.motzarella.or g...
>>>>>>>>>Request-1 wrote:
>>>>>>>>>>hi folks,
>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>aaaaaa!
>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>>>>converted from html to php.
>>>>>>>>>>the conversion went well, it was to use a php session cookie to
>>>>>>>>>>stop the repeating of an embedded video file on a per session
>>>>>>>>>>basis; i amended the php code to display a still pic if the
>>>>>>>>>>session cookie value was nil.
>>>>>>>>>>worked fine.
>>>>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>>>>doc.write and variable sequences in the JS.
>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>any help much appreciated..
>>>>>>>>>>++++++++++++++++
>>>>>>>>>>{ echo "
>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>> <!-- begin
>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>>>> '.jpg'>\");
>>>>>>>>>> // end -->
>>>>>>>>>></script>
>>>>>>>>>> "; }
>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>thanks
>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>Hi Jerry,
>>>>>>>>the single quote is actually necessary in JS when you're using
>>>>>>>>document.write to add strings in series (is it called
>>>>>>>>"concatenating" or something?). so the <img src...statement
>>>>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>>>>within the double-quote nested doc.write stmt. my mistake was to
>>>>>>>>leave the image path in single quotes; instead I tried "escaped
>>>>>>>>double quotes" to complete the image path, like so,
>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>> echo "<!-- begin \n";
>>>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>>>> +'.jpg\"
>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness Training
>>>>>>>>Image\">');\n";
>>>>>>>> echo "// end -->\n";
>>>>>>>> echo "</script>"; }
>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>>>single-double quotes. i may try that "heredoc" thing that Thomas
>>>>>>>>suggested. I'll need a couple of beers first. Friday night on
>>>>>>>>Javascript? Bad!
>>>>>>>BTW - you don't need quotes around numeric values like your width,
>>>>>>>height and border. Only non-numeric data.
>>>>>>Are you talking about generating strict (X)HTML? Quotes must be on
>>>>>>all element attributes in that case, regardless of attribute value
>>>>>>type.
>>>>>1. There is no indication this is XHTML.
>>>>>2. You shouldn't use XHTML for web pages - it's not well supported
>>>>>by some browser, not the least being IE 6 and 7.
>>>>Actually, many can and do use XHTML for web pages.
>>>>I looked at this page successfully using IE7. The web document was
>>>>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>standards- setting (they use the term "recommendations" modestly
>>>>instead of "standards") in strict XHTML. Go figure.
>>>Sure, you CAN make pages which will cater to the different browsers
>>>idiosyncrasies, but why? Where is the need for xhtml?
>>>>There are various documents that can be googled that specify
>>>>solutions wo using XHTML for broken browsers like Internet Explorer,
>>>>such as using an XML stylesheet also to get around problems with
>>>>showing XHTML in standards-violating, never-get-it-right HTTP clients
>>>>like Internet Explorer. This is not rocket science.
>>>>>HTML does NOT require quotes on numeric attributes.
>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>whatsoever that quotes can be omitted for attributes that have
>>>>numeric values. It does allow for their omission, but recommends
>>>>they always be used. There is no indication about whether this
>>>>recommendation applies to the various levels of HTML: strict,
>>>>transitional, frameset.
>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>Which backs up my claim that HTML does NOT require quotes on numeric
>>>attributes.
>>If you really want to split hairs, as you apparently want to do, the
>>loosest usage of HTML doesn't require quotes on any attribute values
>>except in the very few circumstances that your determined attempts to
>>confuse the browser do not achieve the rendering you desire.
>>>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>>>>values in HTML, which MUST be quoted in every case in XHTML:
>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>He is or was a regular (long-time) and, I believe, respected
>>>>contributer to the HTML usage newsgroups.
>>>So? That's one person's opinion. Worth no more or less than anyone
>>>else's opinion.
>>Actually, the HTML standards keepers RECOMMEND (though they don't REQUIRE)
>>you to quote attribute values----ALL OF THEM.
>>But then you have already established that you are a hair-splitter.
>>Perhaps you'd like to disparage the "opinions" of the HTML standards
>>keepers too?
>>>Search enough and you can find an opinion you agree with anywhere on
>>>the internet.
>>Precisely right!
>>But then I am not so desperate to support my claims on the sole "opinion"
>>of one kook with a web page against the 99,999 opinions of people who
>>impress me with reason and logic and a certain level of erudition, some of
>>whom actually sit on standards-setting committees like the one that
>>promulgates the HTML specification.
>>Oh my!
>>A new word of the day:
>> http://www.merriam-webster.com/dictionary/consensus
>For starters:
>>
>http://en.wikipedia.org/wiki/Internet_Explorer
>>
>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
>and DOM Level 1, with minor implementation gaps. It partially supports
>CSS Level 2 and DOM Level 2, with major implementation gaps and
>conformance issues. Full conformance to the CSS 2.1 specification is on
>the agenda for the final Internet Explorer 8 release.[32] It has no
>support for XHTML, though it can render XHTML documents authored with
>HTML compatibility principles and served with a text/html MIME-type."
>>
>And tens of thousands of similar pages.
>>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attglobal.net
>==================
>
You may be technically right, but I think that you're practically
wrong. By that, I mean that I don't think anyone writes HTML
differently from XHTML. So we have the illusion that IE works with
XHTML. I'm not sure what is meant by "compatibility principles"
though.
>
Thomas
If you're "technically right", then you can't be "practically wrong".
If they're writing XHTML, it's not supported. If they're writing HTML,
they shouldn't be calling it XHTML.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#28: Nov 11 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Seni Seven wrote:
Quote:
>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>
Quote:
>>Seni Seven wrote:
>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Seni Seven wrote:
>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>
>>>>>>Request-1 wrote:
>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>news:gf2t4m$inr$1@registered.motzarella.org ...
>>>>>>>>Request-1 wrote:
>>>>>>>>>hi folks,
>>>>>>>>>>
>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>aaaaaa!
>>>>>>>>>>
>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>>>converted from html to php.
>>>>>>>>>the conversion went well, it was to use a php session cookie
>>>>>>>>>to stop the repeating of an embedded video file on a per
>>>>>>>>>session basis; i amended the php code to display a still pic
>>>>>>>>>if the session cookie value was nil.
>>>>>>>>>>
>>>>>>>>>worked fine.
>>>>>>>>>>
>>>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>>>doc.write and variable sequences in the JS.
>>>>>>>>>>
>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>
>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>number that chooses the picture.
>>>>>>>>>>
>>>>>>>>>any help much appreciated..
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>++++++++++++++++
>>>>>>>>>>
>>>>>>>>>{ echo "
>>>>>>>>>>
>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>> <!-- begin
>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>>> '.jpg'>\");
>>>>>>>>> // end -->
>>>>>>>>></script>
>>>>>>>>> "; }
>>>>>>>>>>
>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>
>>>>>>>>>thanks
>>>>>>>>You have an extra single quote before <img ...
>>>>>>>Hi Jerry,
>>>>>>>>
>>>>>>>the single quote is actually necessary in JS when you're using
>>>>>>>document.write to add strings in series (is it called
>>>>>>>"concatenating" or something?). so the <img src...statement
>>>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>>>within the double-quote nested doc.write stmt. my mistake was
>>>>>>>to leave the image path in single quotes; instead I tried
>>>>>>>"escaped double quotes" to complete the image path, like so,
>>>>>>>>
>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>> echo "<!-- begin \n";
>>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>>> +'.jpg\"
>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>Training Image\">');\n";
>>>>>>> echo "// end -->\n";
>>>>>>> echo "</script>"; }
>>>>>>>>
>>>>>>>>
>>>>>>>but no avail. still no pic shows up.
>>>>>>>>
>>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>>>Thomas suggested. I'll need a couple of beers first. Friday
>>>>>>>night on Javascript? Bad!
>>>>>>>>
>>>>>>>>
>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>width, height and border. Only non-numeric data.
>>>>>Are you talking about generating strict (X)HTML? Quotes must be
>>>>>on all element attributes in that case, regardless of attribute
>>>>>value type.
>>>>>>
>>>>>>
>>>>1. There is no indication this is XHTML.
>>>>2. You shouldn't use XHTML for web pages - it's not well supported
>>>>by some browser, not the least being IE 6 and 7.
>>>Actually, many can and do use XHTML for web pages.
>>>>
>>>I looked at this page successfully using IE7. The web document was
>>>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>standards- setting (they use the term "recommendations" modestly
>>>instead of "standards") in strict XHTML. Go figure.
>>>>
>>Sure, you CAN make pages which will cater to the different browsers
>>idiosyncrasies, but why? Where is the need for xhtml?
>>>
>>>There are various documents that can be googled that specify
>>>solutions wo using XHTML for broken browsers like Internet
>>>Explorer, such as using an XML stylesheet also to get around
>>>problems with showing XHTML in standards-violating,
>>>never-get-it-right HTTP clients like Internet Explorer. This is
>>>not rocket science.
>>>>
>>>>HTML does NOT require quotes on numeric attributes.
>>>Actually the HTML 4 recommendation does not assert in any way
>>>whatsoever that quotes can be omitted for attributes that have
>>>numeric values. It does allow for their omission, but recommends
>>>they always be used. There is no indication about whether this
>>>recommendation applies to the various levels of HTML: strict,
>>>transitional, frameset.
>>>>
>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>
>>Which backs up my claim that HTML does NOT require quotes on numeric
>>attributes.
>>
>If you really want to split hairs, as you apparently want to do, the
>loosest usage of HTML doesn't require quotes on any attribute values
>except in the very few circumstances that your determined attempts to
>confuse the browser do not achieve the rendering you desire.
>>
Quote:
>>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>>>values in HTML, which MUST be quoted in every case in XHTML:
>>>>
>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>
>>>He is or was a regular (long-time) and, I believe, respected
>>>contributer to the HTML usage newsgroups.
>>So? That's one person's opinion. Worth no more or less than anyone
>>else's opinion.
>>
>Actually, the HTML standards keepers RECOMMEND (though they don't
>REQUIRE) you to quote attribute values----ALL OF THEM.
>>
>But then you have already established that you are a hair-splitter.
>>
>Perhaps you'd like to disparage the "opinions" of the HTML standards
>keepers too?
>>
Quote:
>>Search enough and you can find an opinion you agree with anywhere on
>>the internet.
>>
>Precisely right!
>>
>But then I am not so desperate to support my claims on the sole
>"opinion" of one kook with a web page against the 99,999 opinions of
>people who impress me with reason and logic and a certain level of
>erudition, some of whom actually sit on standards-setting committees
>like the one that promulgates the HTML specification.
>>
>Oh my!
>>
>A new word of the day:
>>
> http://www.merriam-webster.com/dictionary/consensus
>
For starters:
>
http://en.wikipedia.org/wiki/Internet_Explorer
>
"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
and DOM Level 1, with minor implementation gaps. It partially supports
CSS Level 2 and DOM Level 2, with major implementation gaps and
conformance issues. Full conformance to the CSS 2.1 specification is
on the agenda for the final Internet Explorer 8 release.[32] It has no
support for XHTML, though it can render XHTML documents authored with
HTML compatibility principles and served with a text/html MIME-type."
>
And tens of thousands of similar pages.
What part of that XHTML page that I gave in the response (inserted here
for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did not conform
to the XHTML specification???

Tricking broken browsers---in HTTP response headers, in meta elements,
etc.----that don't comply with either the HTML or XHTML specification---
notwithstanding your hilarious citation of a Wikipedia article whose
content is known to be notoriously inaccurate---is not the fault of page
developers. Perhaps instead of recommending that page developers shy away
from using XHTML in STARK CONTRAST to the HTML specification writers
URGING you to do so, you should be telling them to include alternately
served documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless they
enable their browser to use scripts.

And in finishing:

Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML specificiation.
To insist on deviating from best practices is altogether foolish.
Jerry Stuckle
Guest
 
Posts: n/a
#29: Nov 11 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Seni Seven wrote:
>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>
>>>>>>>Request-1 wrote:
>>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>>news:gf2t4m$inr$1@registered.motzarella.or g...
>>>>>>>>>Request-1 wrote:
>>>>>>>>>>hi folks,
>>>>>>>>>>>
>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>aaaaaa!
>>>>>>>>>>>
>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page i
>>>>>>>>>>converted from html to php.
>>>>>>>>>>the conversion went well, it was to use a php session cookie
>>>>>>>>>>to stop the repeating of an embedded video file on a per
>>>>>>>>>>session basis; i amended the php code to display a still pic
>>>>>>>>>>if the session cookie value was nil.
>>>>>>>>>>>
>>>>>>>>>>worked fine.
>>>>>>>>>>>
>>>>>>>>>>thought I'd try integrating a tested and true JS image random
>>>>>>>>>>rotator script into the echo command, but the problem was the
>>>>>>>>>>syntax of the single quotes and double quotes needed in the
>>>>>>>>>>doc.write and variable sequences in the JS.
>>>>>>>>>>>
>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>
>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>
>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>
>>>>>>>>>>{ echo "
>>>>>>>>>>>
>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>> <!-- begin
>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>>>> '.jpg'>\");
>>>>>>>>>> // end -->
>>>>>>>>>></script>
>>>>>>>>>> "; }
>>>>>>>>>>>
>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>
>>>>>>>>>>thanks
>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>Hi Jerry,
>>>>>>>>>
>>>>>>>>the single quote is actually necessary in JS when you're using
>>>>>>>>document.write to add strings in series (is it called
>>>>>>>>"concatenating" or something?). so the <img src...statement
>>>>>>>>was broken down into 3 seperate stings to be re-joined - all
>>>>>>>>within the double-quote nested doc.write stmt. my mistake was
>>>>>>>>to leave the image path in single quotes; instead I tried
>>>>>>>>"escaped double quotes" to complete the image path, like so,
>>>>>>>>>
>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>> echo "<!-- begin \n";
>>>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>>>> +'.jpg\"
>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>Training Image\">');\n";
>>>>>>>> echo "// end -->\n";
>>>>>>>> echo "</script>"; }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>
>>>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>>>>Thomas suggested. I'll need a couple of beers first. Friday
>>>>>>>>night on Javascript? Bad!
>>>>>>>>>
>>>>>>>>>
>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>width, height and border. Only non-numeric data.
>>>>>>Are you talking about generating strict (X)HTML? Quotes must be
>>>>>>on all element attributes in that case, regardless of attribute
>>>>>>value type.
>>>>>>>
>>>>>>>
>>>>>1. There is no indication this is XHTML.
>>>>>2. You shouldn't use XHTML for web pages - it's not well supported
>>>>>by some browser, not the least being IE 6 and 7.
>>>>Actually, many can and do use XHTML for web pages.
>>>>>
>>>>I looked at this page successfully using IE7. The web document was
>>>>written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>standards- setting (they use the term "recommendations" modestly
>>>>instead of "standards") in strict XHTML. Go figure.
>>>>>
>>>Sure, you CAN make pages which will cater to the different browsers
>>>idiosyncrasies, but why? Where is the need for xhtml?
>>>>
>>>>There are various documents that can be googled that specify
>>>>solutions wo using XHTML for broken browsers like Internet
>>>>Explorer, such as using an XML stylesheet also to get around
>>>>problems with showing XHTML in standards-violating,
>>>>never-get-it-right HTTP clients like Internet Explorer. This is
>>>>not rocket science.
>>>>>
>>>>>HTML does NOT require quotes on numeric attributes.
>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>whatsoever that quotes can be omitted for attributes that have
>>>>numeric values. It does allow for their omission, but recommends
>>>>they always be used. There is no indication about whether this
>>>>recommendation applies to the various levels of HTML: strict,
>>>>transitional, frameset.
>>>>>
>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>
>>>Which backs up my claim that HTML does NOT require quotes on numeric
>>>attributes.
>>If you really want to split hairs, as you apparently want to do, the
>>loosest usage of HTML doesn't require quotes on any attribute values
>>except in the very few circumstances that your determined attempts to
>>confuse the browser do not achieve the rendering you desire.
>>>
>>>>Here is one individual's take on SCRUPULOUSLY quoting all attribute
>>>>values in HTML, which MUST be quoted in every case in XHTML:
>>>>>
>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>
>>>>He is or was a regular (long-time) and, I believe, respected
>>>>contributer to the HTML usage newsgroups.
>>>So? That's one person's opinion. Worth no more or less than anyone
>>>else's opinion.
>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>
>>But then you have already established that you are a hair-splitter.
>>>
>>Perhaps you'd like to disparage the "opinions" of the HTML standards
>>keepers too?
>>>
>>>Search enough and you can find an opinion you agree with anywhere on
>>>the internet.
>>Precisely right!
>>>
>>But then I am not so desperate to support my claims on the sole
>>"opinion" of one kook with a web page against the 99,999 opinions of
>>people who impress me with reason and logic and a certain level of
>>erudition, some of whom actually sit on standards-setting committees
>>like the one that promulgates the HTML specification.
>>>
>>Oh my!
>>>
>>A new word of the day:
>>>
>> http://www.merriam-webster.com/dictionary/consensus
>For starters:
>>
>http://en.wikipedia.org/wiki/Internet_Explorer
>>
>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML 1.0
>and DOM Level 1, with minor implementation gaps. It partially supports
>CSS Level 2 and DOM Level 2, with major implementation gaps and
>conformance issues. Full conformance to the CSS 2.1 specification is
>on the agenda for the final Internet Explorer 8 release.[32] It has no
>support for XHTML, though it can render XHTML documents authored with
>HTML compatibility principles and served with a text/html MIME-type."
>>
>And tens of thousands of similar pages.
>
What part of that XHTML page that I gave in the response (inserted here
for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did not conform
to the XHTML specification???
>
Tricking broken browsers---in HTTP response headers, in meta elements,
etc.----that don't comply with either the HTML or XHTML specification---
notwithstanding your hilarious citation of a Wikipedia article whose
content is known to be notoriously inaccurate---is not the fault of page
developers. Perhaps instead of recommending that page developers shy away
from using XHTML in STARK CONTRAST to the HTML specification writers
URGING you to do so, you should be telling them to include alternately
served documents with the simple statement urging their readers to stop
using broken browsers. Many developers do JUST that, just as many
developers that serve script-dependent content tell their readers that the
scientific/chemistry calculator they want to use won't work unless they
enable their browser to use scripts.
>
And in finishing:
>
Best practices are that attribute values in HTML---all of them---are
quoted, as RECOMMENDED by those who promulgated the HTML specificiation.
To insist on deviating from best practices is altogether foolish.
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail to
do that, that's your problem.

But you also haven't identified exactly WHAT is inaccurate about this
article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?

And I didn't say whether something was recommended or not. I said that
quotes were not REQUIRED around numeric values. And they are not.

Pages validate quite well with W3C's only HTML validator when numbers
are not in quotes. It doesn't even give a warning.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#30: Nov 11 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Seni Seven wrote:
Quote:
>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>
Quote:
>>Seni Seven wrote:
>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Seni Seven wrote:
>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>
>>>>>>Seni Seven wrote:
>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>>
>>>>>>>>Request-1 wrote:
>>>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>>>news:gf2t4m$inr$1@registered.motzarella.o rg...
>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>hi folks,
>>>>>>>>>>>>
>>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>>aaaaaa!
>>>>>>>>>>>>
>>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page
>>>>>>>>>>>i converted from html to php.
>>>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>>>cookie to stop the repeating of an embedded video file on a
>>>>>>>>>>>per session basis; i amended the php code to display a
>>>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>>>
>>>>>>>>>>>worked fine.
>>>>>>>>>>>>
>>>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>>>the JS.
>>>>>>>>>>>>
>>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>>
>>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>>
>>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>>
>>>>>>>>>>>{ echo "
>>>>>>>>>>>>
>>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>>> <!-- begin
>>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>>>>> '.jpg'>\");
>>>>>>>>>>> // end -->
>>>>>>>>>>></script>
>>>>>>>>>>> "; }
>>>>>>>>>>>>
>>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>>
>>>>>>>>>>>thanks
>>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>>Hi Jerry,
>>>>>>>>>>
>>>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>>>using document.write to add strings in series (is it called
>>>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>>>the image path, like so,
>>>>>>>>>>
>>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>>> echo "<!-- begin \n";
>>>>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>>>>> +'.jpg\"
>>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>>Training Image\">');\n";
>>>>>>>>> echo "// end -->\n";
>>>>>>>>> echo "</script>"; }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>>
>>>>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>>>>>Thomas suggested. I'll need a couple of beers first.
>>>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>>width, height and border. Only non-numeric data.
>>>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>>>be on all element attributes in that case, regardless of
>>>>>>>attribute value type.
>>>>>>>>
>>>>>>>>
>>>>>>1. There is no indication this is XHTML.
>>>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>>>supported by some browser, not the least being IE 6 and 7.
>>>>>Actually, many can and do use XHTML for web pages.
>>>>>>
>>>>>I looked at this page successfully using IE7. The web document
>>>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>>standards- setting (they use the term "recommendations" modestly
>>>>>instead of "standards") in strict XHTML. Go figure.
>>>>>>
>>>>Sure, you CAN make pages which will cater to the different
>>>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>>>
>>>>>There are various documents that can be googled that specify
>>>>>solutions wo using XHTML for broken browsers like Internet
>>>>>Explorer, such as using an XML stylesheet also to get around
>>>>>problems with showing XHTML in standards-violating,
>>>>>never-get-it-right HTTP clients like Internet Explorer. This is
>>>>>not rocket science.
>>>>>>
>>>>>>HTML does NOT require quotes on numeric attributes.
>>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>>whatsoever that quotes can be omitted for attributes that have
>>>>>numeric values. It does allow for their omission, but recommends
>>>>>they always be used. There is no indication about whether this
>>>>>recommendation applies to the various levels of HTML: strict,
>>>>>transitional, frameset.
>>>>>>
>>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>>
>>>>Which backs up my claim that HTML does NOT require quotes on
>>>>numeric attributes.
>>>If you really want to split hairs, as you apparently want to do,
>>>the loosest usage of HTML doesn't require quotes on any attribute
>>>values except in the very few circumstances that your determined
>>>attempts to confuse the browser do not achieve the rendering you
>>>desire.
>>>>
>>>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>>>attribute values in HTML, which MUST be quoted in every case in
>>>>>XHTML:
>>>>>>
>>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>>
>>>>>He is or was a regular (long-time) and, I believe, respected
>>>>>contributer to the HTML usage newsgroups.
>>>>So? That's one person's opinion. Worth no more or less than
>>>>anyone else's opinion.
>>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>>
>>>But then you have already established that you are a hair-splitter.
>>>>
>>>Perhaps you'd like to disparage the "opinions" of the HTML
>>>standards keepers too?
>>>>
>>>>Search enough and you can find an opinion you agree with anywhere
>>>>on the internet.
>>>Precisely right!
>>>>
>>>But then I am not so desperate to support my claims on the sole
>>>"opinion" of one kook with a web page against the 99,999 opinions
>>>of people who impress me with reason and logic and a certain level
>>>of erudition, some of whom actually sit on standards-setting
>>>committees like the one that promulgates the HTML specification.
>>>>
>>>Oh my!
>>>>
>>>A new word of the day:
>>>>
>>> http://www.merriam-webster.com/dictionary/consensus
>>For starters:
>>>
>>http://en.wikipedia.org/wiki/Internet_Explorer
>>>
>>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
>>1.0 and DOM Level 1, with minor implementation gaps. It partially
>>supports CSS Level 2 and DOM Level 2, with major implementation gaps
>>and conformance issues. Full conformance to the CSS 2.1
>>specification is on the agenda for the final Internet Explorer 8
>>release.[32] It has no support for XHTML, though it can render XHTML
>>documents authored with HTML compatibility principles and served
>>with a text/html MIME-type."
>>>
>>And tens of thousands of similar pages.
>>
>What part of that XHTML page that I gave in the response (inserted
>here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
>not conform to the XHTML specification???
>>
>Tricking broken browsers---in HTTP response headers, in meta
>elements, etc.----that don't comply with either the HTML or XHTML
>specification--- notwithstanding your hilarious citation of a
>Wikipedia article whose content is known to be notoriously
>inaccurate---is not the fault of page developers. Perhaps instead of
>recommending that page developers shy away from using XHTML in STARK
>CONTRAST to the HTML specification writers URGING you to do so, you
>should be telling them to include alternately served documents with
>the simple statement urging their readers to stop using broken
>browsers. Many developers do JUST that, just as many developers that
>serve script-dependent content tell their readers that the
>scientific/chemistry calculator they want to use won't work unless
>they enable their browser to use scripts.
>>
>And in finishing:
>>
>Best practices are that attribute values in HTML---all of them---are
>quoted, as RECOMMENDED by those who promulgated the HTML
>specificiation. To insist on deviating from best practices is
>altogether foolish.
>
If you find Wikipedia to be inaccurate, you are free to edit it and
correct the inaccuracies. That's what it's all about. If you fail to
do that, that's your problem.
>
But you also haven't identified exactly WHAT is inaccurate about this
article - only made a generic statement. Specifically WHAT is
inaccurate, and how are you going to correct it?
>
And I didn't say whether something was recommended or not. I said
that quotes were not REQUIRED around numeric values. And they are
not.
>
Pages validate quite well with W3C's only HTML validator when numbers
are not in quotes. It doesn't even give a warning.
Yeah, Transitional HTML is forgiving that way.

Set the validator for Strict HTML, and pretty much all of the attributes
you would want to use with numeric values are disallowed---that is,
generate an error on the validator. You are supposed to be using a
styling convention (CSS).

Set the validator to use the HTML Tidy option to----in its words---CLEAN
UP your HTML, and lo and behold, all your unquoted attribute values---
every one of them---get quoted, and your doctype is set to Transitional to
allow the otherwise disallowed attributes in Strict HTML.

What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?

Jerry Stuckle
Guest
 
Posts: n/a
#31: Nov 11 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Seni Seven wrote:
>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>
>>>>>>>Seni Seven wrote:
>>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>>>
>>>>>>>>>Request-1 wrote:
>>>>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>>>>news:gf2t4m$inr$1@registered.motzarella. org...
>>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>>hi folks,
>>>>>>>>>>>>>
>>>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>>>aaaaaa!
>>>>>>>>>>>>>
>>>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a page
>>>>>>>>>>>>i converted from html to php.
>>>>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>>>>cookie to stop the repeating of an embedded video file on a
>>>>>>>>>>>>per session basis; i amended the php code to display a
>>>>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>>>>
>>>>>>>>>>>>worked fine.
>>>>>>>>>>>>>
>>>>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>>>>the JS.
>>>>>>>>>>>>>
>>>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>>>
>>>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>>>
>>>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>>>
>>>>>>>>>>>>{ echo "
>>>>>>>>>>>>>
>>>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>>>> <!-- begin
>>>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber +
>>>>>>>>>>>> '.jpg'>\");
>>>>>>>>>>>> // end -->
>>>>>>>>>>>></script>
>>>>>>>>>>>> "; }
>>>>>>>>>>>>>
>>>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>>>
>>>>>>>>>>>>thanks
>>>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>>>Hi Jerry,
>>>>>>>>>>>
>>>>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>>>>using document.write to add strings in series (is it called
>>>>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>>>>the image path, like so,
>>>>>>>>>>>
>>>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>>>> echo "<!-- begin \n";
>>>>>>>>>> echo "document.write('<img src=\"images/swap/' + picnumber
>>>>>>>>>> +'.jpg\"
>>>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>>>Training Image\">');\n";
>>>>>>>>>> echo "// end -->\n";
>>>>>>>>>> echo "</script>"; }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>>>
>>>>>>>>>>anyway. i get really confused with all the nested stuff and
>>>>>>>>>>single-double quotes. i may try that "heredoc" thing that
>>>>>>>>>>Thomas suggested. I'll need a couple of beers first.
>>>>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>>>width, height and border. Only non-numeric data.
>>>>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>>>>be on all element attributes in that case, regardless of
>>>>>>>>attribute value type.
>>>>>>>>>
>>>>>>>>>
>>>>>>>1. There is no indication this is XHTML.
>>>>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>>>>supported by some browser, not the least being IE 6 and 7.
>>>>>>Actually, many can and do use XHTML for web pages.
>>>>>>>
>>>>>>I looked at this page successfully using IE7. The web document
>>>>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>>>standards- setting (they use the term "recommendations" modestly
>>>>>>instead of "standards") in strict XHTML. Go figure.
>>>>>>>
>>>>>Sure, you CAN make pages which will cater to the different
>>>>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>>>>
>>>>>>There are various documents that can be googled that specify
>>>>>>solutions wo using XHTML for broken browsers like Internet
>>>>>>Explorer, such as using an XML stylesheet also to get around
>>>>>>problems with showing XHTML in standards-violating,
>>>>>>never-get-it-right HTTP clients like Internet Explorer. This is
>>>>>>not rocket science.
>>>>>>>
>>>>>>>HTML does NOT require quotes on numeric attributes.
>>>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>>>whatsoever that quotes can be omitted for attributes that have
>>>>>>numeric values. It does allow for their omission, but recommends
>>>>>>they always be used. There is no indication about whether this
>>>>>>recommendation applies to the various levels of HTML: strict,
>>>>>>transitional, frameset.
>>>>>>>
>>>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>>>
>>>>>Which backs up my claim that HTML does NOT require quotes on
>>>>>numeric attributes.
>>>>If you really want to split hairs, as you apparently want to do,
>>>>the loosest usage of HTML doesn't require quotes on any attribute
>>>>values except in the very few circumstances that your determined
>>>>attempts to confuse the browser do not achieve the rendering you
>>>>desire.
>>>>>
>>>>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>>>>attribute values in HTML, which MUST be quoted in every case in
>>>>>>XHTML:
>>>>>>>
>>>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>>>
>>>>>>He is or was a regular (long-time) and, I believe, respected
>>>>>>contributer to the HTML usage newsgroups.
>>>>>So? That's one person's opinion. Worth no more or less than
>>>>>anyone else's opinion.
>>>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>>>
>>>>But then you have already established that you are a hair-splitter.
>>>>>
>>>>Perhaps you'd like to disparage the "opinions" of the HTML
>>>>standards keepers too?
>>>>>
>>>>>Search enough and you can find an opinion you agree with anywhere
>>>>>on the internet.
>>>>Precisely right!
>>>>>
>>>>But then I am not so desperate to support my claims on the sole
>>>>"opinion" of one kook with a web page against the 99,999 opinions
>>>>of people who impress me with reason and logic and a certain level
>>>>of erudition, some of whom actually sit on standards-setting
>>>>committees like the one that promulgates the HTML specification.
>>>>>
>>>>Oh my!
>>>>>
>>>>A new word of the day:
>>>>>
>>>> http://www.merriam-webster.com/dictionary/consensus
>>>For starters:
>>>>
>>>http://en.wikipedia.org/wiki/Internet_Explorer
>>>>
>>>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
>>>1.0 and DOM Level 1, with minor implementation gaps. It partially
>>>supports CSS Level 2 and DOM Level 2, with major implementation gaps
>>>and conformance issues. Full conformance to the CSS 2.1
>>>specification is on the agenda for the final Internet Explorer 8
>>>release.[32] It has no support for XHTML, though it can render XHTML
>>>documents authored with HTML compatibility principles and served
>>>with a text/html MIME-type."
>>>>
>>>And tens of thousands of similar pages.
>>What part of that XHTML page that I gave in the response (inserted
>>here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
>>not conform to the XHTML specification???
>>>
>>Tricking broken browsers---in HTTP response headers, in meta
>>elements, etc.----that don't comply with either the HTML or XHTML
>>specification--- notwithstanding your hilarious citation of a
>>Wikipedia article whose content is known to be notoriously
>>inaccurate---is not the fault of page developers. Perhaps instead of
>>recommending that page developers shy away from using XHTML in STARK
>>CONTRAST to the HTML specification writers URGING you to do so, you
>>should be telling them to include alternately served documents with
>>the simple statement urging their readers to stop using broken
>>browsers. Many developers do JUST that, just as many developers that
>>serve script-dependent content tell their readers that the
>>scientific/chemistry calculator they want to use won't work unless
>>they enable their browser to use scripts.
>>>
>>And in finishing:
>>>
>>Best practices are that attribute values in HTML---all of them---are
>>quoted, as RECOMMENDED by those who promulgated the HTML
>>specificiation. To insist on deviating from best practices is
>>altogether foolish.
>If you find Wikipedia to be inaccurate, you are free to edit it and
>correct the inaccuracies. That's what it's all about. If you fail to
>do that, that's your problem.
>>
>But you also haven't identified exactly WHAT is inaccurate about this
>article - only made a generic statement. Specifically WHAT is
>inaccurate, and how are you going to correct it?
>>
>And I didn't say whether something was recommended or not. I said
>that quotes were not REQUIRED around numeric values. And they are
>not.
>>
>Pages validate quite well with W3C's only HTML validator when numbers
>are not in quotes. It doesn't even give a warning.
>
Yeah, Transitional HTML is forgiving that way.
>
Set the validator for Strict HTML, and pretty much all of the attributes
you would want to use with numeric values are disallowed---that is,
generate an error on the validator. You are supposed to be using a
styling convention (CSS).
>
Like "width" and "height" in <imgtags?
Quote:
Set the validator to use the HTML Tidy option to----in its words---CLEAN
UP your HTML, and lo and behold, all your unquoted attribute values---
every one of them---get quoted, and your doctype is set to Transitional to
allow the otherwise disallowed attributes in Strict HTML.
>
What do you think that W3 is saying to the HTML page writer when it
"cleans up" the page this way?
>
I said nothing about transitional HTML. The same is true for strict HTML.

This has NOTHING to do with whether the attributes are allowed or not
(in fact, all of the ones I use ARE valid - because I only write strict
HTML). And CSS is not for everything.

Sure, it the Tidy option adds quotes. But that does not mean they are
required. They are not - as you have said yourself.

As to what it does when it "cleans up the page" - that's its option.
But either way is still valid - as you have said yourself, quotes are a
recommendation - not a requirement. They are only required on
non-numeric values.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Seni Seven
Guest
 
Posts: n/a
#32: Nov 11 '08

re: nesting JS in echo's


Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
Quote:
Seni Seven wrote:
Quote:
>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>
Quote:
>>Seni Seven wrote:
>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>
>>>>Seni Seven wrote:
>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>
>>>>>>Seni Seven wrote:
>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>>
>>>>>>>>Seni Seven wrote:
>>>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in
>>>>>>>>>comp.lang.php:
>>>>>>>>>>
>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>>>>>news:gf2t4m$inr$1@registered.motzarella .org...
>>>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>>>hi folks,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>>>>aaaaaa!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a
>>>>>>>>>>>>>page i converted from html to php.
>>>>>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>>>>>cookie to stop the repeating of an embedded video file on
>>>>>>>>>>>>>a per session basis; i amended the php code to display a
>>>>>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>worked fine.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>>>>>the JS.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>>>>
>>>>>>>>>>>>>{ echo "
>>>>>>>>>>>>>>
>>>>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>>>>> <!-- begin
>>>>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber
>>>>>>>>>>>>> + '.jpg'>\");
>>>>>>>>>>>>> // end -->
>>>>>>>>>>>>></script>
>>>>>>>>>>>>> "; }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>>>>
>>>>>>>>>>>>>thanks
>>>>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>>>>Hi Jerry,
>>>>>>>>>>>>
>>>>>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>>>>>using document.write to add strings in series (is it called
>>>>>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>>>>>the image path, like so,
>>>>>>>>>>>>
>>>>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>>>>> echo "<!-- begin \n";
>>>>>>>>>>> echo "document.write('<img src=\"images/swap/' +
>>>>>>>>>>> picnumber +'.jpg\"
>>>>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>>>>Training Image\">');\n";
>>>>>>>>>>> echo "// end -->\n";
>>>>>>>>>>> echo "</script>"; }
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>>>>
>>>>>>>>>>>anyway. i get really confused with all the nested stuff
>>>>>>>>>>>and single-double quotes. i may try that "heredoc" thing
>>>>>>>>>>>that Thomas suggested. I'll need a couple of beers first.
>>>>>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>>>>width, height and border. Only non-numeric data.
>>>>>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>>>>>be on all element attributes in that case, regardless of
>>>>>>>>>attribute value type.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>1. There is no indication this is XHTML.
>>>>>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>>>>>supported by some browser, not the least being IE 6 and 7.
>>>>>>>Actually, many can and do use XHTML for web pages.
>>>>>>>>
>>>>>>>I looked at this page successfully using IE7. The web document
>>>>>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>>>>standards- setting (they use the term "recommendations"
>>>>>>>modestly instead of "standards") in strict XHTML. Go figure.
>>>>>>>>
>>>>>>Sure, you CAN make pages which will cater to the different
>>>>>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>>>>>
>>>>>>>There are various documents that can be googled that specify
>>>>>>>solutions wo using XHTML for broken browsers like Internet
>>>>>>>Explorer, such as using an XML stylesheet also to get around
>>>>>>>problems with showing XHTML in standards-violating,
>>>>>>>never-get-it-right HTTP clients like Internet Explorer. This
>>>>>>>is not rocket science.
>>>>>>>>
>>>>>>>>HTML does NOT require quotes on numeric attributes.
>>>>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>>>>whatsoever that quotes can be omitted for attributes that have
>>>>>>>numeric values. It does allow for their omission, but
>>>>>>>recommends they always be used. There is no indication about
>>>>>>>whether this recommendation applies to the various levels of
>>>>>>>HTML: strict, transitional, frameset.
>>>>>>>>
>>>>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>>>>
>>>>>>Which backs up my claim that HTML does NOT require quotes on
>>>>>>numeric attributes.
>>>>>If you really want to split hairs, as you apparently want to do,
>>>>>the loosest usage of HTML doesn't require quotes on any attribute
>>>>>values except in the very few circumstances that your determined
>>>>>attempts to confuse the browser do not achieve the rendering you
>>>>>desire.
>>>>>>
>>>>>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>>>>>attribute values in HTML, which MUST be quoted in every case in
>>>>>>>XHTML:
>>>>>>>>
>>>>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>>>>
>>>>>>>He is or was a regular (long-time) and, I believe, respected
>>>>>>>contributer to the HTML usage newsgroups.
>>>>>>So? That's one person's opinion. Worth no more or less than
>>>>>>anyone else's opinion.
>>>>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>>>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>>>>
>>>>>But then you have already established that you are a
>>>>>hair-splitter.
>>>>>>
>>>>>Perhaps you'd like to disparage the "opinions" of the HTML
>>>>>standards keepers too?
>>>>>>
>>>>>>Search enough and you can find an opinion you agree with
>>>>>>anywhere on the internet.
>>>>>Precisely right!
>>>>>>
>>>>>But then I am not so desperate to support my claims on the sole
>>>>>"opinion" of one kook with a web page against the 99,999 opinions
>>>>>of people who impress me with reason and logic and a certain
>>>>>level of erudition, some of whom actually sit on
>>>>>standards-setting committees like the one that promulgates the
>>>>>HTML specification.
>>>>>>
>>>>>Oh my!
>>>>>>
>>>>>A new word of the day:
>>>>>>
>>>>> http://www.merriam-webster.com/dictionary/consensus
>>>>For starters:
>>>>>
>>>>http://en.wikipedia.org/wiki/Internet_Explorer
>>>>>
>>>>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
>>>>1.0 and DOM Level 1, with minor implementation gaps. It partially
>>>>supports CSS Level 2 and DOM Level 2, with major implementation
>>>>gaps and conformance issues. Full conformance to the CSS 2.1
>>>>specification is on the agenda for the final Internet Explorer 8
>>>>release.[32] It has no support for XHTML, though it can render
>>>>XHTML documents authored with HTML compatibility principles and
>>>>served with a text/html MIME-type."
>>>>>
>>>>And tens of thousands of similar pages.
>>>What part of that XHTML page that I gave in the response (inserted
>>>here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
>>>not conform to the XHTML specification???
>>>>
>>>Tricking broken browsers---in HTTP response headers, in meta
>>>elements, etc.----that don't comply with either the HTML or XHTML
>>>specification--- notwithstanding your hilarious citation of a
>>>Wikipedia article whose content is known to be notoriously
>>>inaccurate---is not the fault of page developers. Perhaps instead
>>>of recommending that page developers shy away from using XHTML in
>>>STARK CONTRAST to the HTML specification writers URGING you to do
>>>so, you should be telling them to include alternately served
>>>documents with the simple statement urging their readers to stop
>>>using broken browsers. Many developers do JUST that, just as many
>>>developers that serve script-dependent content tell their readers
>>>that the scientific/chemistry calculator they want to use won't
>>>work unless they enable their browser to use scripts.
>>>>
>>>And in finishing:
>>>>
>>>Best practices are that attribute values in HTML---all of
>>>them---are quoted, as RECOMMENDED by those who promulgated the HTML
>>>specificiation. To insist on deviating from best practices is
>>>altogether foolish.
>>If you find Wikipedia to be inaccurate, you are free to edit it and
>>correct the inaccuracies. That's what it's all about. If you fail
>>to do that, that's your problem.
>>>
>>But you also haven't identified exactly WHAT is inaccurate about
>>this article - only made a generic statement. Specifically WHAT is
>>inaccurate, and how are you going to correct it?
>>>
>>And I didn't say whether something was recommended or not. I said
>>that quotes were not REQUIRED around numeric values. And they are
>>not.
>>>
>>Pages validate quite well with W3C's only HTML validator when
>>numbers are not in quotes. It doesn't even give a warning.
>>
>Yeah, Transitional HTML is forgiving that way.
>>
>Set the validator for Strict HTML, and pretty much all of the
>attributes you would want to use with numeric values are
>disallowed---that is, generate an error on the validator. You are
>supposed to be using a styling convention (CSS).
>>
>
Like "width" and "height" in <imgtags?
>
Quote:
>Set the validator to use the HTML Tidy option to----in its
>words---CLEAN UP your HTML, and lo and behold, all your unquoted
>attribute values--- every one of them---get quoted, and your doctype
>is set to Transitional to allow the otherwise disallowed attributes
>in Strict HTML.
>>
>What do you think that W3 is saying to the HTML page writer when it
>"cleans up" the page this way?
>>
>
I said nothing about transitional HTML. The same is true for strict
HTML.
>
This has NOTHING to do with whether the attributes are allowed or not
(in fact, all of the ones I use ARE valid - because I only write
strict HTML). And CSS is not for everything.
>
Sure, it the Tidy option adds quotes. But that does not mean they are
required. They are not - as you have said yourself.
>
As to what it does when it "cleans up the page" - that's its option.
But either way is still valid - as you have said yourself, quotes are
a recommendation - not a requirement. They are only required on
non-numeric values.
Required on non-numeric values?

The following valid HTML document gives two unquoted values for a paragraph
element and its values are non-numeric.

So much for requiring any compliance to recommendations (standards).


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HTML pages really have should titles</title>
</head>
<body>

<p id=paragraph-1 class=aTypicalParagraph>
This paragraph specifies unquoted values for its attributes.

</body>
</html>



Jerry Stuckle
Guest
 
Posts: n/a
#33: Nov 11 '08

re: nesting JS in echo's


Seni Seven wrote:
Quote:
Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>
Quote:
>Seni Seven wrote:
Quote:
>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>
>>>Seni Seven wrote:
>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>
>>>>>Seni Seven wrote:
>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>
>>>>>>>Seni Seven wrote:
>>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in comp.lang.php:
>>>>>>>>>
>>>>>>>>>Seni Seven wrote:
>>>>>>>>>>Jerry Stuckle <jstucklex@attglobal.netwrote in
>>>>>>>>>>comp.lang.php:
>>>>>>>>>>>
>>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>>"Jerry Stuckle" <jstucklex@attglobal.netwrote in message
>>>>>>>>>>>>news:gf2t4m$inr$1@registered.motzarell a.org...
>>>>>>>>>>>>>Request-1 wrote:
>>>>>>>>>>>>>>hi folks,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>html coder here, new and terrified * of php!!
>>>>>>>>>>>>>>aaaaaa!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>i'm trying to bury a JS script to rotate a photo, in a
>>>>>>>>>>>>>>page i converted from html to php.
>>>>>>>>>>>>>>the conversion went well, it was to use a php session
>>>>>>>>>>>>>>cookie to stop the repeating of an embedded video file on
>>>>>>>>>>>>>>a per session basis; i amended the php code to display a
>>>>>>>>>>>>>>still pic if the session cookie value was nil.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>worked fine.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>thought I'd try integrating a tested and true JS image
>>>>>>>>>>>>>>random rotator script into the echo command, but the
>>>>>>>>>>>>>>problem was the syntax of the single quotes and double
>>>>>>>>>>>>>>quotes needed in the doc.write and variable sequences in
>>>>>>>>>>>>>>the JS.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>i tried escaping the double quotes (my echo used double
>>>>>>>>>>>>>>quotes), but to no avail.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>here's the JS CODE i use in the tail end of my PHP.
>>>>>>>>>>>>>>"picnumber" is the variable holding the randomly assigned
>>>>>>>>>>>>>>number that chooses the picture.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>any help much appreciated..
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>++++++++++++++++
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>{ echo "
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <script language='JavaScript1.2'>
>>>>>>>>>>>>>> <!-- begin
>>>>>>>>>>>>>> document.write(\"'<img src='images/swap/'+ picnumber
>>>>>>>>>>>>>> + '.jpg'>\");
>>>>>>>>>>>>>> // end -->
>>>>>>>>>>>>>></script>
>>>>>>>>>>>>>> "; }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>++++++++++++++++++++++++++
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>thanks
>>>>>>>>>>>>>You have an extra single quote before <img ...
>>>>>>>>>>>>Hi Jerry,
>>>>>>>>>>>>>
>>>>>>>>>>>>the single quote is actually necessary in JS when you're
>>>>>>>>>>>>using document.write to add strings in series (is it called
>>>>>>>>>>>>"concatenating" or something?). so the <img src...>
>>>>>>>>>>>>statement was broken down into 3 seperate stings to be
>>>>>>>>>>>>re-joined - all within the double-quote nested doc.write
>>>>>>>>>>>>stmt. my mistake was to leave the image path in single
>>>>>>>>>>>>quotes; instead I tried "escaped double quotes" to complete
>>>>>>>>>>>>the image path, like so,
>>>>>>>>>>>>>
>>>>>>>>>>>>{ echo "<script language='JavaScript1.2'>\n";
>>>>>>>>>>>> echo "<!-- begin \n";
>>>>>>>>>>>> echo "document.write('<img src=\"images/swap/' +
>>>>>>>>>>>> picnumber +'.jpg\"
>>>>>>>>>>>>width=\"320\" height=\"240\" border=\"0\" alt=\"Fitness
>>>>>>>>>>>>Training Image\">');\n";
>>>>>>>>>>>> echo "// end -->\n";
>>>>>>>>>>>> echo "</script>"; }
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>but no avail. still no pic shows up.
>>>>>>>>>>>>>
>>>>>>>>>>>>anyway. i get really confused with all the nested stuff
>>>>>>>>>>>>and single-double quotes. i may try that "heredoc" thing
>>>>>>>>>>>>that Thomas suggested. I'll need a couple of beers first.
>>>>>>>>>>>>Friday night on Javascript? Bad!
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>BTW - you don't need quotes around numeric values like your
>>>>>>>>>>>width, height and border. Only non-numeric data.
>>>>>>>>>>Are you talking about generating strict (X)HTML? Quotes must
>>>>>>>>>>be on all element attributes in that case, regardless of
>>>>>>>>>>attribute value type.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>1. There is no indication this is XHTML.
>>>>>>>>>2. You shouldn't use XHTML for web pages - it's not well
>>>>>>>>>supported by some browser, not the least being IE 6 and 7.
>>>>>>>>Actually, many can and do use XHTML for web pages.
>>>>>>>>>
>>>>>>>>I looked at this page successfully using IE7. The web document
>>>>>>>>was written by NONE OTHER THAN BY THE W3 Consortium itself, the
>>>>>>>>standards- setting (they use the term "recommendations"
>>>>>>>>modestly instead of "standards") in strict XHTML. Go figure.
>>>>>>>>>
>>>>>>>Sure, you CAN make pages which will cater to the different
>>>>>>>browsers idiosyncrasies, but why? Where is the need for xhtml?
>>>>>>>>
>>>>>>>>There are various documents that can be googled that specify
>>>>>>>>solutions wo using XHTML for broken browsers like Internet
>>>>>>>>Explorer, such as using an XML stylesheet also to get around
>>>>>>>>problems with showing XHTML in standards-violating,
>>>>>>>>never-get-it-right HTTP clients like Internet Explorer. This
>>>>>>>>is not rocket science.
>>>>>>>>>
>>>>>>>>>HTML does NOT require quotes on numeric attributes.
>>>>>>>>Actually the HTML 4 recommendation does not assert in any way
>>>>>>>>whatsoever that quotes can be omitted for attributes that have
>>>>>>>>numeric values. It does allow for their omission, but
>>>>>>>>recommends they always be used. There is no indication about
>>>>>>>>whether this recommendation applies to the various levels of
>>>>>>>>HTML: strict, transitional, frameset.
>>>>>>>>>
>>>>>>>>http://www.w3.org/TR/html4/intro/sgm...tml#attributes
>>>>>>>>>
>>>>>>>Which backs up my claim that HTML does NOT require quotes on
>>>>>>>numeric attributes.
>>>>>>If you really want to split hairs, as you apparently want to do,
>>>>>>the loosest usage of HTML doesn't require quotes on any attribute
>>>>>>values except in the very few circumstances that your determined
>>>>>>attempts to confuse the browser do not achieve the rendering you
>>>>>>desire.
>>>>>>>
>>>>>>>>Here is one individual's take on SCRUPULOUSLY quoting all
>>>>>>>>attribute values in HTML, which MUST be quoted in every case in
>>>>>>>>XHTML:
>>>>>>>>>
>>>>>>>>http://www.cs.tut.fi/~jkorpela/qattr.html
>>>>>>>>>
>>>>>>>>He is or was a regular (long-time) and, I believe, respected
>>>>>>>>contributer to the HTML usage newsgroups.
>>>>>>>So? That's one person's opinion. Worth no more or less than
>>>>>>>anyone else's opinion.
>>>>>>Actually, the HTML standards keepers RECOMMEND (though they don't
>>>>>>REQUIRE) you to quote attribute values----ALL OF THEM.
>>>>>>>
>>>>>>But then you have already established that you are a
>>>>>>hair-splitter.
>>>>>>>
>>>>>>Perhaps you'd like to disparage the "opinions" of the HTML
>>>>>>standards keepers too?
>>>>>>>
>>>>>>>Search enough and you can find an opinion you agree with
>>>>>>>anywhere on the internet.
>>>>>>Precisely right!
>>>>>>>
>>>>>>But then I am not so desperate to support my claims on the sole
>>>>>>"opinion" of one kook with a web page against the 99,999 opinions
>>>>>>of people who impress me with reason and logic and a certain
>>>>>>level of erudition, some of whom actually sit on
>>>>>>standards-setting committees like the one that promulgates the
>>>>>>HTML specification.
>>>>>>>
>>>>>>Oh my!
>>>>>>>
>>>>>>A new word of the day:
>>>>>>>
>>>>>> http://www.merriam-webster.com/dictionary/consensus
>>>>>For starters:
>>>>>>
>>>>>http://en.wikipedia.org/wiki/Internet_Explorer
>>>>>>
>>>>>"Trident layout engine, fully supports HTML 4.01, CSS Level 1, XML
>>>>>1.0 and DOM Level 1, with minor implementation gaps. It partially
>>>>>supports CSS Level 2 and DOM Level 2, with major implementation
>>>>>gaps and conformance issues. Full conformance to the CSS 2.1
>>>>>specification is on the agenda for the final Internet Explorer 8
>>>>>release.[32] It has no support for XHTML, though it can render
>>>>>XHTML documents authored with HTML compatibility principles and
>>>>>served with a text/html MIME-type."
>>>>>>
>>>>>And tens of thousands of similar pages.
>>>>What part of that XHTML page that I gave in the response (inserted
>>>>here for the readers: http://www.w3.org/MarkUp/2004/xhtml-faq) did
>>>>not conform to the XHTML specification???
>>>>>
>>>>Tricking broken browsers---in HTTP response headers, in meta
>>>>elements, etc.----that don't comply with either the HTML or XHTML
>>>>specification--- notwithstanding your hilarious citation of a
>>>>Wikipedia article whose content is known to be notoriously
>>>>inaccurate---is not the fault of page developers. Perhaps instead
>>>>of recommending that page developers shy away from using XHTML in
>>>>STARK CONTRAST to the HTML specification writers URGING you to do
>>>>so, you should be telling them to include alternately served
>>>>documents with the simple statement urging their readers to stop
>>>>using broken browsers. Many developers do JUST that, just as many
>>>>developers that serve script-dependent content tell their readers
>>>>that the scientific/chemistry calculator they want to use won't
>>>>work unless they enable their browser to use scripts.
>>>>>
>>>>And in finishing:
>>>>>
>>>>Best practices are that attribute values in HTML---all of
>>>>them---are quoted, as RECOMMENDED by those who promulgated the HTML
>>>>specificiation. To insist on deviating from best practices is
>>>>altogether foolish.
>>>If you find Wikipedia to be inaccurate, you are free to edit it and
>>>correct the inaccuracies. That's what it's all about. If you fail
>>>to do that, that's your problem.
>>>>
>>>But you also haven't identified exactly WHAT is inaccurate about
>>>this article - only made a generic statement. Specifically WHAT is
>>>inaccurate, and how are you going to correct it?
>>>>
>>>And I didn't say whether something was recommended or not. I said
>>>that quotes were not REQUIRED around numeric values. And they are
>>>not.
>>>>
>>>Pages validate quite well with W3C's only HTML validator when
>>>numbers are not in quotes. It doesn't even give a warning.
>>Yeah, Transitional HTML is forgiving that way.
>>>
>>Set the validator for Strict HTML, and pretty much all of the
>>attributes you would want to use with numeric values are
>>disallowed---that is, generate an error on the validator. You are
>>supposed to be using a styling convention (CSS).
>>>
>Like "width" and "height" in <imgtags?
>>
Quote:
>>Set the validator to use the HTML Tidy option to----in its
>>words---CLEAN UP your HTML, and lo and behold, all your unquoted
>>attribute values--- every one of them---get quoted, and your doctype
>>is set to Transitional to allow the otherwise disallowed attributes
>>in Strict HTML.
>>>
>>What do you think that W3 is saying to the HTML page writer when it
>>"cleans up" the page this way?
>>>
>I said nothing about transitional HTML. The same is true for strict
>HTML.
>>
>This has NOTHING to do with whether the attributes are allowed or not
>(in fact, all of the ones I use ARE valid - because I only write
>strict HTML). And CSS is not for everything.
>>
>Sure, it the Tidy option adds quotes. But that does not mean they are
>required. They are not - as you have said yourself.
>>
>As to what it does when it "cleans up the page" - that's its option.
>But either way is still valid - as you have said yourself, quotes are
>a recommendation - not a requirement. They are only required on
>non-numeric values.
>
Required on non-numeric values?
>
The following valid HTML document gives two unquoted values for a paragraph
element and its values are non-numeric.
>
So much for requiring any compliance to recommendations (standards).
>
>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HTML pages really have should titles</title>
</head>
<body>
>
<p id=paragraph-1 class=aTypicalParagraph>
This paragraph specifies unquoted values for its attributes.
>
</body>
</html>
>
>
>
This is transitional, not strict.

But we have gotten way off of PHP. This is more suitable for alt.html.
I'm not going to carry this on any longer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Closed Thread


Similar PHP bytes