I'm trying to use Simple HTML DOM Parser to extract some html from page B and insert the html code into the current page. (Please be gentle, I'm a PHP newbie)
Page B html I'm targeting looks like this:
<div id="testdiv">B</div>
I need the same code to be inserted in current page.
My PHP on current page:
<?php
include_once '%resource(simple_html_dom.php)%';
$ret = Array();
$html = file_get_html('b.html');
$ret[] = $html->find('div[id=testdiv]', 0);
$ret->outertext = $ret->makeup() . $ret->innertext . '</div>';
echo $ret;
?>
I've tried to cobble this together, but still no luck. I would expect when viewing the current page to see "B", but I definitely need all the html coding to be there as well ;)
Currently getting an error "Call to a member function makeup() on a non-object"
P.S. Once that's running, I probably need a way to bring in the css and js that's on pg B.
Thanks for the help, Bill
UPDATED Code:
<?php
include_once '%resource(simple_html_dom.php)%';
$html = file_get_html('b.html');
foreach($html->find('div[id=testdiv]') as $ret)
echo $ret;
?>
So now I need to be able to get specif css & js files from page B so whatever content is in the div will render properly. Here's an example Current Page If you look in the header of Page B there will be a typical css and js file called b_files/stacks_page_page1.css & b_files/stacks_page_page1.js
These are the files I need to have referenced in the current page w/ the relative path changed as necessary. I also added a Page C which is in a folder (B is in root w/ current page) so path will be differnt. I guess combining the css files together & js files together would be good so there aren't a bunch of dom calls.
Overall, what's the code to bring those files in?