php4ever Posted October 22, 2007 Share Posted October 22, 2007 I'm trying to create a simple template version notification snippet and I'm missing something but what I'm not sure; <?php function version_check() { $template_version = '2.5'; if (ini_get("allow_url_fopen") == 1) { $lastest_version = @file_get_contents("http://www.jaredritchey.com/downloads/601.txt"); $check = version_compare($template_version, $lastest_version, ">="); } } echo($latest_version); ?> The idea is to look at a directory and compare versions. If there is a newer one then echo a statement or something. If not echo nothing. Is allow_url_fopen a down graded function or did I just approach this wrong? ~ Jared Quote Link to comment https://forums.phpfreaks.com/topic/74275-allow_url_fopen/ Share on other sites More sharing options...
enoyhs Posted October 22, 2007 Share Posted October 22, 2007 You know that echo statement should be before last brackets and that is function so you need to call it to work? Quote Link to comment https://forums.phpfreaks.com/topic/74275-allow_url_fopen/#findComment-375271 Share on other sites More sharing options...
php4ever Posted October 22, 2007 Author Share Posted October 22, 2007 Thank you sincerely for your reply. I've removed the echo actually but the function call? What again on the syntax to display the results? ~ Jared Quote Link to comment https://forums.phpfreaks.com/topic/74275-allow_url_fopen/#findComment-375550 Share on other sites More sharing options...
enoyhs Posted October 22, 2007 Share Posted October 22, 2007 I quite didn't understand your question... What I mean with function call is you need to call function like this: version_check(); So the full code would be: <?php function version_check() { $template_version = '2.5'; if (ini_get("allow_url_fopen") == 1) { $lastest_version = @file_get_contents("http://www.jaredritchey.com/downloads/601.txt"); $check = version_compare($template_version, $lastest_version, ">="); } echo($latest_version); } ?> version_check(); Quote Link to comment https://forums.phpfreaks.com/topic/74275-allow_url_fopen/#findComment-375558 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.