Welcome Guest, Not a member yet? Register   Sign In
Check if file exists?
#1

[eluser]Unknown[/eluser]
Hi forum.

I have added the following lines in my config file for ease of acces:

Code:
$config['css'] = $config['base_url'].'assets/css/';
$config['js'] = $config['base_url'].'assets/js/';
$config['images'] = $config['base_url'].'assets/images/';

I have a "master-layout" where I include the header, footer and main content. To include only the necessary .css code I'm trying this:

Code:
$css_path = assets('css').$pagetitle.'/'.$pagetitle.'.css';
if(file_exists($css_path)) { echo '<link rel="stylesheet" href="'.$css_path.'" type="text/css" media="screen, projection" />'; }

But the "file_exists" function can't find the specified path (and I have checked it.)

In another thread, "fopen" was used, but if I use it and the file does not exist I get a php-error.

Can someone please clearify why the "file_exists"-function won't work?

Kind regards.




Theme © iAndrew 2016 - Forum software by © MyBB