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

PHP support question (2)

From: Rolf Hemmerling <hemmerling@gmx.net>
Date: Sun, 04 Nov 2001 12:44:35 +0100
Message-ID: <3BE52A23.63C024C8@gmx.net>
To: html-tidy@w3.org
Hello !

Klaus Johannes Rusch        <KlausRusch@atmedia.net> wrote:
> Tidy does handle PHP code references between <?php ... ?> as well as the
> <script> ... </script> format.

> Probably better handled by HTML/XML aware beautifiers, so if your code includes
> <? ?> PHP fragments you could run phptidy and it would pretty-print the PHP 
> code and not touch anything else.
a) Where may I find "phptidy" ?

b)
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.

Original, working PHP3 code
<?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> 

Tidy's results, unusable:
<?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=&lt;?php
echo $URL ?&gt;">translate</A>
, as the usual PHP servers (Apache..) donīt recognize the PHP code in
the URL
string. Of course the PHP code must be processed when loading the web
page, and not when executing the link!

In opposite, the coding of & into &amp; does not harm.

c)
the SAME problem with
<A
href="http://www.tranexp.com:2000/InterTran?type=url&amp;from=eng&amp;to=pob&amp;url=<!--#echo
var='HTTP_HOST'--><!--#echo var='SCRIPT_NAME'-->">translate</A>
and
 <A
href="http://www.tranexp.com:2000/InterTran?type=url&amp;from=eng&amp;to=pob&amp;url=&lt;!--#echo
var='HTTP_HOST'--&gt;&lt;!--#echo var='SCRIPT_NAME'--&gt;">translate</A> 
:-(

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

do not work, as the \> is no valid escape code for Tidy ?

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" ?

Btw, the code enables translation of the current WEB document into a
foreign
language, by the help of a free service.

I am using Tidy of 4.Aug. 2000.

Tia
Sincerely
Rolf
 
-- 
      /  /  / Alone on the data highway...
    /     /   like on an allee in Hannover-Herrenhausen
  /  /  /     The Hemmerling (R) WEB site - Rolf Hemmerling, Germany
/     /       http://www.hemmerling.com/
Received on Sunday, 4 November 2001 06:44:33 GMT

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