#26 Extracting all html node content + "Title" attributes values.

v1.0_(example)
open
nobody
None
1
2013-12-08
2013-12-08
pixeline
No

I'm trying to export an html file's textual content to send to a translator.

SHD works great, but i can't seem to get it to output the title attribute. It seems the callback does not work: if i echo anything inside, nothing is printed out.

Here is what i have so far:

require_once 'simple_html_dom.php';
$html = new simple_html_dom();
$html->set_callback('my_callback');

$html->load_file('_applications/user/user.view.php');

// Write a function with parameter "$element"
function my_callback($element) {
        if ($element->title)
                $element->outertext .= "\ntitle= ".$element->title;
} 

echo $html->plaintext;
$html->clear(); 
unset($html);

Discussion


Log in to post a comment.