mmmbisto Posted March 22, 2009 Share Posted March 22, 2009 I'm a bit stuck, I'm using the Flash Fader plugin, which includes a text file, I was wondering if it was possible to make the if function that I saw in the Wordpress documentation to only include the text file if it's there, otherwise not to include anything? The php on the wordpress site for plugins: <?php if (function_exists('FUNCTION NAME')) { FUNCTION_NAME(); } ?> The php include on the Flash Fader site: <?php include (ABSPATH."wp-content/flashfader/flashfaderhtml.txt"); ?> Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/150560-solved-php-if-function-help/ Share on other sites More sharing options...
Mchl Posted March 22, 2009 Share Posted March 22, 2009 file_exists if is not a function BTW Link to comment https://forums.phpfreaks.com/topic/150560-solved-php-if-function-help/#findComment-790840 Share on other sites More sharing options...
mmmbisto Posted March 22, 2009 Author Share Posted March 22, 2009 It's ok, I have it now. That was just what wordpress documentation showed for plugins. Should be: <?php $myfile = 'wp-content/flashfader/flashfaderhtml.txt'; if(file_exists($myfile)) { include($myfile); } ?> Thanks anyway. Link to comment https://forums.phpfreaks.com/topic/150560-solved-php-if-function-help/#findComment-790843 Share on other sites More sharing options...
redarrow Posted March 22, 2009 Share Posted March 22, 2009 wonder if this will work, as a file with the extenuation of .txt only. wonder if file_exists errors out. <?php $file_name='flashfaderhtml.txt'; $myfile = "wp-content/flashfader/$file_name"; if(file_exists(preg_match_all("/(.?)(\.txt)/",$myfile,$matched))) { include($myfile); } ?> Link to comment https://forums.phpfreaks.com/topic/150560-solved-php-if-function-help/#findComment-790847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.