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

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=
echo $URL ?>">translate<A> 

Tidy's results, unusable:
<?php $URL
="http://".$HTTP_HOST.$SCRIPT_NAME ?>
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.

the SAME problem with
var='HTTP_HOST'--><!--#echo var='SCRIPT_NAME'-->">translate</A>
var='HTTP_HOST'--&gt;&lt;!--#echo var='SCRIPT_NAME'--&gt;">translate</A> 

Tricks like
\<?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
language, by the help of a free service.

I am using Tidy of 4.Aug. 2000.

      /  /  / 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 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:51 UTC