Reply to TIDY Functions: Troubles with Get_Attr function

Your name:

Reply:


Posted by Ricardo Junior on 05/12/05 18:11

Hi all,


I'm using the PHP 5.0.4 version with Apache 2 on Windows XP SP2 and
I've turned on the TIDY extension (php_tidy.dll) to parse HTML file
using PHP.

But using the function tidyNode->GET_ATTR() I received the following
error message:

"Fatal error: Call to undefined method tidyNode::get_attr() in
C:\Arquivos de programas\Apache
Group\Apache2\htdocs\teste\html\teste.php on line 22"

The 22 line in my code is the following one:
"$a_href = $child->get_attr (TIDY_ATTR_HREF);"

Below I'm attaching the whole source code of my test:
*************************************************
** teste.php code ****************************
*************************************************
<?
// Specify configuration
$config = array('indent'=> TRUE,
'indent-spaces' => 3,
'indent-cdata' => TRUE,
'output-xhtml' => TRUE,
'wrap' => 80);

// Tidy
$tidy = new tidy;
$tidy->parseFile("client_computer_options.htm", $config);
run_nodes($tidy->root(), 1);


function run_nodes($node, $indent) {

if($node->hasChildren()) {
foreach($node->child as $child) {
switch ($child->name)
{
case "a": {
$a_href = $child->get_attr (TIDY_ATTR_HREF);
$a_title = $child->get_attr (TIDY_ATTR_TITLE);
$a_text = $child->value;

$string = "<b>A -> HREF = </b>".$a_href." <b>| TITLE =
</b>".$a_title." <b>| TEXT = </b>".$a_text;
break;
}
default: {
$string = $child->name;
break;
}
}
echo str_repeat('.', $indent*2) . ($string ? $string :
'"'.$child->value.'"'). "<br>\n";

run_nodes($child, $indent+1);
}
}
}
?>
*************************************************

Could somebody help me on getting this code working? I really don't
know why the "undefined method" error is rising... Should it be a
incomplete tidy functions support at this PHP version?

Many Thanks,
Rick Jr.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация