// Combines the contents of a frame file with the main page code for creating a view.
 
<?
 
// For use with RestServer
 
class FrameView implements RestView {
 
 
    function __construct($page_code,$frame_file='')
 
    {
 
        if(strlen($frame_file) > 0) {
 
            $frame_code = file_get_contents($frame_file);
 
            $this->whole_page = str_replace('%contents%',$page_code,$frame_code);
 
        }else{
 
            $this->whole_page = $page_code;
 
        }
 
    }
 
 
    function show(RestServer $rest)
 
    {
 
        $rest->getResponse()->setResponse($this->whole_page);
 
        return $rest ;
 
    }
 
}
 
?>
 
 
 |