PHP 4.3.0 required for News & other modules using templates?
PHP 4.3.0 required for News & other modules using templates?
I just tracked down a problem where the News module would display its tabs, but none of the tabs contained any content. Turns out this is an issue with the code to support the module_file_tpl resource type calling file_get_contents() which requires PHP >= 4.3.0 (according to according to http://us3.php.net/file_get_contents ). The site was running PHP Version 4.2.3.
If I'm understanding things correctly, I believe that either the system requirements should be changed from specifying PHP 4.1+ to calling for 4.3+ or this bit of code from module_file_template() in lib/content.functions.php should be written differently:
$tpl_source = @file_get_contents(dirname(dirname(__FILE__)) . '/modules/' . $params[0] . '/templates/' . $params[1]);
The @ sign surpresses error reporting, which makes the behavior quite mysterious.
It looks like FCKEditorX and the Theme Manager module call file_get_contents as well.
If I'm understanding things correctly, I believe that either the system requirements should be changed from specifying PHP 4.1+ to calling for 4.3+ or this bit of code from module_file_template() in lib/content.functions.php should be written differently:
$tpl_source = @file_get_contents(dirname(dirname(__FILE__)) . '/modules/' . $params[0] . '/templates/' . $params[1]);
The @ sign surpresses error reporting, which makes the behavior quite mysterious.
It looks like FCKEditorX and the Theme Manager module call file_get_contents as well.
Re: PHP 4.3.0 required for News & other modules using templates?
I've been trying to get help on this problem for a while now and this is the most reliable answer yet. Makes perfect sense and hopefully, like you say, either the sys requirments or code can be changed as I know I'm not the only one with this problem.
Thanks.
Thanks.
Re: PHP 4.3.0 required for News & other modules using templates?
Ok, I found a decent workaround for systems that don't have this function. I'm going to include it in the next release and hopefully 4.2 will be supported again (sorry!).
The code looks like:
and I just tossed it at the bottom of lib/misc.functions.php. If anyone with a 4.2 system wants to test it, that would be great. Thanks!
The code looks like:
Code: Select all
if(!function_exists("file_get_contents"))
{
function file_get_contents($filename)
{
if(($contents = file($filename)))
{
$contents = implode('', $contents);
return $contents;
}
else
return false;
}
}
Re: PHP 4.3.0 required for News & other modules using templates?
You beauty! Its working perfectly for me now (ver 4.2.2).
Was a little worried I'd have to move to another CMS due to time constraints, but you guys have been brilliantly helpful (as usual).
Thanks.
Was a little worried I'd have to move to another CMS due to time constraints, but you guys have been brilliantly helpful (as usual).
Thanks.
Re: PHP 4.3.0 required for News & other modules using templates?
Thank you so much! It worked a charm!
Re: PHP 4.3.0 required for News & other modules using templates?
Is that fix included in the 0.13 release? And do I really need MySQL 4 for it?
Last edited by Alex_Leipzig on Sun Jul 02, 2006 10:21 am, edited 1 time in total.
Re: PHP 4.3.0 required for News & other modules using templates?
Yes, that fix is in 0.13.
Do you mean that mysql 4 is required for 0.13? I haven't tested it on mysql 3 in a long time.... so maybe.
Keep in mind that the pretty url stuff requires php 4.3.3+ (it's in the README file now), so using 4.2.3 is going to be an issue with that.
Do you mean that mysql 4 is required for 0.13? I haven't tested it on mysql 3 in a long time.... so maybe.

Re: PHP 4.3.0 required for News & other modules using templates?
Are pretty url's enabled by default?
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: PHP 4.3.0 required for News & other modules using templates?
In CMSMS 0.13 they are, in CMSMS 1.0-svn they have been turned off by default.alex wrote: Are pretty url's enabled by default?
For how to turn them off see this: http://forum.cmsmadesimple.org/index.ph ... l#msg30261
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
