RE: [PHP] First of my Quark/php generated Questions
| From: | Ford, Mike | Date: | Tue, 28 Jul 2009 16:32:20 +0000 |
| Subject: | RE: [PHP] First of my Quark/php generated Questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295945@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Miller, Terion [mailto:tmiller@springfi.gannett.com]
> Sent: 28 July 2009 17:06
>
> Okay I have to echo onto my reverse pub page this chunk of code that
> is for
> generating the page in Quark, it has to echo as is...but I'm getting
> errors--I've tried in brackets, in paraenthesis, double quotes,
> single
> quotes etc:
>
> echo "<v6.52><e0>
> @Normal=<Ps100t-2h100z9.4k0b0cMf"Helvetica">
> @.LIST
> Bold=<Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-BlackCondensed">
> @.BODY=[S"",
> ".BODY"]<*J*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,7,0,10,0,0,G,"U.S.
> English")Ps100t-2h100z9.4k0b0cKf"PoynterOSTextTwoNL-Roman">
> @Normal=[S".BODY
> ",".BODY","Normal"]<>
> @.GLANCE Hed
>
> 100K=[S"",""]<*L*h"Headline"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,10,0,g,"U
> .S.
> English")Ps100t-4h100z16k0b0cKf"InterstateNL-BlackCondensed">
> @.GLANCE Text
> normal=[S"",".GLANCE Text
> normal"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,5.25,0,10,0,0,G,"U.S.
> English")Ps100t-2h110.001z9.4k0b0cKf"InterstateNL-LightCondensed">
> @.LIST
> Subtopic
>
> label=[S"",""]<*C*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,10,4,2,g,"U
> .S.
> English")PKs100t-3h100z8.7k0b0cKf"InterstateNL-BlackCondensed">
> @.LIST Body
> no indents=[S"",".LIST Body no
> indents"]<*L*h"Standard"*kn0*kt0*ra0*rb0*d0*p(0,0,0,+0,0,3,g,"U.S.
> English")Ps100t-4h110.001z8.7k0b0cKf"InterstateNL-LightCondensed">"
> ;
The problem here is you have a string to output with lots of double quotes embedded in it, and you
have also tried to quote it with double quotes. There are several things you could do:
(i) Insert a backslash in front of every double quote; I don't recommend this, as you're
bound to miss one and it's very ugly to read.
(ii) Enclose it in single quotes instead; this is good as it prevents nearly all
interpolation/escaping, but it has the disadvantage that you then have to backslash any single
quotes.
(iii) Use a Heredoc http://php.net/heredoc; this avoids the
need to backslash internal double quotes, but might be a problem if your text ever contains $ signs
as it does variable interpolation.
(iv) If you are on PHP 5.3, use a Nowdoc http://php.net/nowdoc.
Whatever option you choose, you will always have to backslash-escape any backslashes; on a quick
scan, I can't see any in that text block, but it's best to be aware ;)
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm