Scripts Thread, PHP Help - Include in Coding and Web Development; 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 { ...
-
26th November 2008, 10:13 PM #1 PHP Help - Include
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?
-
-
IDG Tech News
-
26th November 2008, 10:23 PM #2 Do you mean just to include that file it mentions; or to output to the screen the whole 'include' bit?
Code:
<?php
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 {
}
?>
-
-
26th November 2008, 10:25 PM #3
- Rep Power
- 11
awww, webman beat me too it *runs off to find brain food*
-
-
26th November 2008, 10:35 PM #4 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.
Last edited by danIT; 26th November 2008 at 10:40 PM.
-
-
26th November 2008, 10:45 PM #5
- Rep Power
- 0
Use file_get_contents() or a similar function instead of include. Print out the contents using the file_get_contents() function; for example:
PHP Code:
print file_get_contents($CFG->httpswwwroot.'/file.php?file=/1/theme/navbar.php');
-
-
26th November 2008, 11:09 PM #6 Bloomin marvelous thanks guys! Works a treat!
-
SHARE:
Similar Threads
-
By mac_shinobi in forum Web Development
Replies: 15
Last Post: 21st October 2008, 09:43 AM
-
By Cravon in forum Coding
Replies: 2
Last Post: 20th November 2007, 06:05 PM
-
By Gatt in forum Web Development
Replies: 1
Last Post: 14th November 2006, 10:01 PM
-
By beeswax in forum Windows
Replies: 33
Last Post: 14th October 2005, 04:51 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules