Output Just a block
Permalink
I'm trying to output just an autonav block to a page with as little header as possible so I can curl this into another web page (in another web app). Anyone have any Ideas on how to get this input? I'm using the curl web page function to grab the code:
function get_web_page( $url ) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options );
Viewing 15 lines of 25 lines. View entire code block.
I would suggest using a tools file rather than a page and putting a hard coded autonav block output in the tools file.
I created a navigation single page (in both the single pages and theme) stripped the excess out of the theme so the page was
Then in my file using this I used:
Now I have 3 dynamically created nav lists working on the non c5 side of my site! Woo Hoo!
Then in my file using this I used:
function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); return $data; } $html = file_get_contents_curl("http://example.com/navigation"); //parsing begins here: $doc = new DOMDocument(); @$doc->loadHTML($html);
Viewing 15 lines of 27 lines. View entire code block.
Now I have 3 dynamically created nav lists working on the non c5 side of my site! Woo Hoo!