saifai
08-04-2006, 03:22 AM
I'm getting the following error for a header file in some new software I'm using, which I already know is because of a PHP compatibility problem:
Fatal error: Call to undefined function: file_get_contents()
I was hoping to find a work-around for that. Someone suggested I try using GetContents instead, but I wasn't sure how to make it work.
They had suggested the following code for other software:
function getContents( $filename )
{
if ( function_exists( 'file_get_contents' ) )
{
return file_get_contents( $filename );
}
else
{
$fp = fopen( $filename, 'r' );
if ( !$fp )
{
eZDebug::writeError( 'Could not read contents of ' . $filename, 'eZFile::getContents()' );
return false;
}
return fread( $fp, filesize( $filename ) );
}
}
I'm assuming from that that there is a renaming there somewhere, but I can't quite figure out how to work it with the code that I've currently got:
if(file_exists(_BASEDIR."messages/tinymce.txt")) $tinymcesettings = file_get_contents(_BASEDIR."messages/tinymce.txt");
Is there any possible way to get that to work with the code I'm using? Or is there an easier way (other than upgrading my PHP)?
Fatal error: Call to undefined function: file_get_contents()
I was hoping to find a work-around for that. Someone suggested I try using GetContents instead, but I wasn't sure how to make it work.
They had suggested the following code for other software:
function getContents( $filename )
{
if ( function_exists( 'file_get_contents' ) )
{
return file_get_contents( $filename );
}
else
{
$fp = fopen( $filename, 'r' );
if ( !$fp )
{
eZDebug::writeError( 'Could not read contents of ' . $filename, 'eZFile::getContents()' );
return false;
}
return fread( $fp, filesize( $filename ) );
}
}
I'm assuming from that that there is a renaming there somewhere, but I can't quite figure out how to work it with the code that I've currently got:
if(file_exists(_BASEDIR."messages/tinymce.txt")) $tinymcesettings = file_get_contents(_BASEDIR."messages/tinymce.txt");
Is there any possible way to get that to work with the code I'm using? Or is there an easier way (other than upgrading my PHP)?