[eluser]yuccaplant[/eluser]
Hmm, that's not really what I want. I was asked to built a simple static site, but still I wanted to avoid writing the same code over and over again. Another requirement was that the site content should be easy to update with some basic html.
So I've made basic a static site, something like this:
home/index.html
home/about.html
references/index.html
references/projects/aboko/index.html
...
I want to use CodeIgniter to add a menu, header, automatic breadcrumbs, links to sylesheets, a footer ... to all of these html files. All the html files really provide is the content (<div id="content">this part</div>).
I want to keep them full blown html files so the content providers can simply launch them in any browser to preview (see that links, images, ... are set correctly).
I redirect all request (except thos for images, css-files, ...) to one controller. The request url tells is whitch html file to load, what the breadcrumbs are and which menu-item is selected.
For now I'm using the following to get only the part between the body tags out of the html-files:
Code:
$string = file_get_contents($url);
if (!preg_match("/<body>(.*)<\/body>/s", $string, $match))
{
return "FALSE";
}
return $match[1];
Next I'll have to adjust links to static content so it maps nicely to correct url on the server... . I'll be regular expressions for this, but I don't know what the perfomance penalty will be. Maybe I should build a sort of caching system... .