Forum Moderators: coopster
I am getting tired of integrating opensource projects into existing CMS and custom websites.
Is there a way to load then entire page created by phpBB, osCommerce, or whatever into a string.
I could then parse the entire HTML string to add correct head elements to my template head, body, footer, etc...
example:
class HTMLwrapper{
var $loadFile;
function loadHTML($loadFile){
//get the contents of the opensource file being requested and return in a string
}
fuction getHead(){
//return the head of the loaded opensource file
}
function getStyles(){
//return the style sheets of the loaded opensouce file
}
etc....
}
Get the idea? Then I can use URL rewriting to always point files to my template page and load the data to the body of my pages. I know this will not resolve left hand navigation and such for each opensource. But a start is all I am looking for right now.
Thanks in advance.
PS. the issue I am having is really with phpBB3. cant figure out how it is displaying the pages content and keeping all the vars correctly. not sure how it is displaying things...ill keep searching though.
Is there a way to load then entire page created by phpBB, osCommerce, or whatever into a string.
Yes. There are a few different ways you can perform such tasks. One is to start output buffering and flush the buffer after getting it's contents into a string variable. Another is to read the file from a URL into a string using a function such as file_get_contents [php.net]. Note that if the URL is on the same server you may have issues if you have a firewall in place. Many firewalls will not route the request back to the server so you might end up adding an entry to your /etc/hosts file.
1) I want to get the HTML that is sent to the browser in a string( with all PHP evaluated).
2) Evaluate it.
3) Then send it to the browser.