Read file outside webapp filesystem

I am thinking to use yii to a site that will be at a sub folder of a portal.

So I need to use the "header" and the "footer" of the parent site,

For testing purposes I use it at site controller but this cause an error.


$a=file_get_contents  ( '/../../../general_header.php')

;

Can I read a file outside of my application or I have to put the header and footer code at my view.

Your code is looking for the general_header.php file relative the the root index.php file. Perhaps you intended it to be relative to the controller file path, in which case you need to use on of the following:




// PHP4, PHP5

$a=file_get_contents (dirname(__FILE__) . '/../../../general_header.php');


// PHP5.3+

$a=file_get_contents ( __DIR__ . '/../../../general_header.php');



Have you considered the use of different layouts as well?