Goldeneye Posted July 30, 2009 Share Posted July 30, 2009 I have a templating system that I'm currently using: (This is the only relevant (to my problem) function) <?php class template { var $page; function page($template){ if(file_exists($template)) $this->page = join('', file($template)); else exit('"'.$template.'" could not be found.'); } } $layout = new template; ?> This is essentially how I'm trying to use it. <?php define('sp', 'http://foobar.com/generic/'); //Path to the PHP-Scripts define('tp', sp.'templates/'); //The Path to the directory that contains the template-directories. $_SESSION['path'] = 'style_42'; //This comes from a database field that the use can change. $layout->page(tp.$_SESSION['path'].'login.html'); ?> I thought this code would work, but when I tried it, I got the "http://foobar.com/generic/templates/style_42/login.html" could not be found (as returned by the $layout->page() function. The path is valid (if you copy/paste it into the address-bar and view it, the HTML-File does show up. The file_exists() function says otherwise, though. Is There a reason or solution for this? Does anyone have any suggestions? A preemptive thanks. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 30, 2009 Share Posted July 30, 2009 There's some stuff in php.ini that controls whether or not PHP will open files given as URLs, so you might look into that. Otherwise full paths work, for example: c:\a\path\to\this\file.txt /home/users/joeboo/myfile.txt Quote Link to comment 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.