Jump to content

[SOLVED] php "if" function help


mmmbisto

Recommended Posts

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

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);

}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.