W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2001

Re: PHP support question (2)

From: Klaus Johannes Rusch <KlausRusch@atmedia.net>
Date: Sun, 4 Nov 2001 13:27:04 CET
Message-Id: <200111041243.HAA26841@tux.w3.org>
To: html-tidy@w3.org
In <3BE52A23.63C024C8@gmx.net>, Rolf Hemmerling <hemmerling@gmx.net> writes:

> a) Where may I find "phptidy" ?

I am not aware of any PHP beautifier, although there is a good chance someone 
has written one. phptidy was given as an example of an "external" beautifier.
Depending on your PHP style, the C pretty printer cb may work.

> My problem is the re-coding of the PHP braces ">" and "<" into "&gt;"
> and "&lt;"
> <?php echo $URL ?>
> into "&gt;" and "&lt;"
> ,
> when used as part of a URL.

> So how might I code right for Tidy, so that the URL contains the URL of
> the "current document in which this code is found", by the help of PHP
> or SSI/SHTML, WITHOUT Javascript/Java ?
>
> Or is this a "bug" or "missing feature" ?

Since tags and PIs are not valid in attributes, tidy's behavious is correct
(not from a PHP programmer's perspective, of course).

A tidy compatible way that will also survive other editing tools is to change

> <?php $URL ="http://".$HTTP_HOST.$SCRIPT_NAME ?>
> <A href=
> "http://www.tranexp.com:2000/InterTran?type=url&amp;from=eng&amp;to=pob&amp;url=<?php
> echo $URL ?>">translate<A>

to

<?php
  $URL = "http://".$HTTP_HOST.$SCRIPT_NAME;
  echo "<a href=\"http://www.tranexp.com:2000/InterTran?type=url&amp;from=eng&amp;to=pob&amp;url=$URL\">translate<a>";
?>

-- 
Klaus Johannes Rusch
KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/
Received on Sunday, 4 November 2001 07:43:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:46 GMT