Jump to content

Recommended Posts

Posted

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?

Posted

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 {

}
?>

Posted (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 by danIT
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...