Jump to content


Photo

Access a parent directory


  • Please log in to reply
1 reply to this topic

#1 otuatail

otuatail
  • Members
  • PipPipPip
  • Advanced Member
  • 960 posts

Posted 23 July 2006 - 07:37 AM

I have some pages in a sub directory but I still want to acces a configuration in the parent directory. I also want to re-direct to a page in the parent. I thought    /..  but this is all the way back to the root. Yhis is a bit of the code.

include ("functions.inc");  //      /.functions.inc

if(.....)
{
header('Location: access.php');  //    /.access.php
exit;
}

Desmond.


#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 July 2006 - 09:04 AM

Let's say you got a folder called "outside" that has in it a file called "outside_file.php" and has a folder in it called "inside". "inside" folder has a file called "some_file.php", and in it you want to include "outside_file.php". You'll do this:

<?php
include("../outside_file.php");
?>

It's "../" which means parnet directory.

Orio.
Think you're smarty?

(Gone until 20 to November)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users