[thelist] Quoted attibute values

martin.p.burns at uk.pwcglobal.com martin.p.burns at uk.pwcglobal.com
Tue Jan 16 05:25:31 CST 2001


Memo from Martin P Burns of PricewaterhouseCoopers

-------------------- Start of message text --------------------

<tip type="easier quoting">
In Perl, you can use any char for your quote/string delimiter (of the Perl
statement),
thereby keeping out of the way of your HTML quotes (so you don't need
so escape them).

All you do is define your delimiter with
q (for single quotes) or
qq (for double)
followed by the char you want to use.

So in this example, I use a bar as the delimiter in place of a double quote:
$html .= qq|-&gt; <a href="$crumbs_path[$i]" class="crumb">$crumbs[$i]</a> |;
which is the equivalent of
$html .= "&gt; <a href=\"$crumbs_path[$i]\" class=\"crumb\">$crumbs[$i]</a> ";
</tip>

Cheers
Martin





Please respond to thelist at lists.evolt.org
To:   thelist at lists.evolt.org
cc:


Subject:  RE: [thelist] Quoted attibute values




I know the specs say either, but everyone (?) uses double quotes, and
when I'm echo'ing html tags from PHP, it's a darn sight easier to use
single quotes than escaped double ones:

a) echo "<img src='blob.jpg'>"; // better?
b) echo "<img src=\"blob.jpg\">"; // worse?


--------------------- End of message text --------------------

The principal place of business of PricewaterhouseCoopers and its associate
partnerships is 1 Embankment Place, London WC2N 6NN where lists of the
partners' names are available for inspection. All partners in the associate
partnerships are authorised to conduct business as agents of, and all
contracts for services to clients are with, PricewaterhouseCoopers. The UK
firm of PricewaterhouseCoopers is authorised by the Institute of Chartered
Accountants in England and Wales to carry on investment business.
PricewaterhouseCoopers is a member of the world-wide
PricewaterhouseCoopers organisation.
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material.  Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited.   If you received this in error, please
contact the sender and delete the material from any computer.






More information about the thelist mailing list