HTML Templates with Substitutable Areas - PHP
According your comment you don't want to use a template engine, but are actually creating a new one. At some point you will need loops or ifs and it starts becoming ugly.

PHP is already a template engine. Actually it was designed for exactly this purpose. There is a braceless/echoless syntax for all control structures.

Your template/view:

&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;?=$page_title?&gt;&lt;/title&gt;
    ...
&lt;/head&gt;
&lt;body&gt;
    &lt;section id='wrapper'&gt;
        &lt;section id='content'&gt;
            &lt;h1&gt;&lt;?=$page_title?&gt;&lt;/h1&gt;
            &lt;?=$content?&gt;
        &lt;/section&gt;
     ...
&lt;/body&gt;
&lt;/html&gt;


Your controller:

private function generatePageSource($page_title)
{
    $page_title=pdisplay($page_title));
    $content = $this-&gt;pagecontent_content;

    ob_start();
    $template=REGISTRY_CODE_PATH . "views/templates/" .
        $this-&gt;template_dir . "/main.html";
    include $template;
    $this-&gt;page_content=ob_get_clean();
}


Of course you could wrap this in a View class to DRY.