Mr Initial Man
01-04-2006, 09:12 AM
This is the PHP code I have thus far:
<?php
/*******************************************************
* page for showing markup of refering page
*******************************************************/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Page title</title>
<link type="text/css" rel="stylesheet" href="coding.css">
</head>
<body>
<?php
if(!empty($_SERVER['HTTP_REFERER']))
{
$file = $_SERVER['HTTP_REFERER'];
$text = @file_get_contents($file);
echo "<h1>Markup for $file</h1>\n";
if($text !== FALSE)
{
echo "<code>" . nl2br(htmlentities($text)) . "</code>\n";
}
else
{
echo "<p class='error'>ERROR: Unable to read file $file.</p>\n";
}
}
else
{
echo "<p class='error'>ERROR: No http_referer was received.</p>\n";
}
?>
</body>
</html>
What I would like to know is if there is some php that would highlight element names and attributes in the page, so instead of <html lang="en" dir="ltr"> it would look like <html lang="en" dir="ltr">. Is this possible with PHP?
<?php
/*******************************************************
* page for showing markup of refering page
*******************************************************/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Page title</title>
<link type="text/css" rel="stylesheet" href="coding.css">
</head>
<body>
<?php
if(!empty($_SERVER['HTTP_REFERER']))
{
$file = $_SERVER['HTTP_REFERER'];
$text = @file_get_contents($file);
echo "<h1>Markup for $file</h1>\n";
if($text !== FALSE)
{
echo "<code>" . nl2br(htmlentities($text)) . "</code>\n";
}
else
{
echo "<p class='error'>ERROR: Unable to read file $file.</p>\n";
}
}
else
{
echo "<p class='error'>ERROR: No http_referer was received.</p>\n";
}
?>
</body>
</html>
What I would like to know is if there is some php that would highlight element names and attributes in the page, so instead of <html lang="en" dir="ltr"> it would look like <html lang="en" dir="ltr">. Is this possible with PHP?