danIT Posted November 26, 2008 Posted November 26, 2008 I have the following script: <?php if (file_exists($CFG->dataroot.'/1/theme/navbar.php')) if (empty($CFG->slasharguments)) { ?> <?php print $CFG->httpswwwroot.'/file.php?file=/1/theme/navbar.php' ?> <?php } else { ?> <?php print $CFG->httpswwwroot.'/file.php/1/theme/navbar.php' ?> <?php } else { }?> This looks for the file navbar.php and if it exists it outputs: http://localhost/184/file.php/1/theme/navbar.php But i need it to output like this: <?php include("http://localhost/184/file.php/1/theme/navbar.php"); ?> Can anyone help?
webman Posted November 26, 2008 Posted November 26, 2008 Do you mean just to include that file it mentions; or to output to the screen the whole 'include' bit? if (file_exists($CFG->dataroot.'/1/theme/navbar.php')) if (empty($CFG->slasharguments)) { include($CFG->httpswwwroot.'/file.php?file=/1/theme/navbar.php'); } else { include($CFG->httpswwwroot.'/file.php/1/theme/navbar.php'); } else { } ?>
Lithium Posted November 26, 2008 Posted November 26, 2008 awww, webman beat me too it *runs off to find brain food*
danIT Posted November 26, 2008 Author Posted November 26, 2008 (edited) Sorry i want to include the file, i dont want to display that line. Navbar.php contains the links that should appear in my navbar. So the html shows the contents of the navbar.php file. Edited November 26, 2008 by danIT
DarkLight Posted November 26, 2008 Posted November 26, 2008 Use file_get_contents() or a similar function instead of include. Print out the contents using the file_get_contents() function; for example: print file_get_contents($CFG->httpswwwroot.'/file.php?file=/1/theme/navbar.php');
danIT Posted November 26, 2008 Author Posted November 26, 2008 Bloomin marvelous thanks guys! Works a treat!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now