Jump to content

Anthony

Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Anthony's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=384698:date=Jun 16 2006, 02:29 PM:name=dptr1988)--][div class=\'quotetop\']QUOTE(dptr1988 @ Jun 16 2006, 02:29 PM) [snapback]384698[/snapback][/div][div class=\'quotemain\'][!--quotec--] I don't think I understand what you are trying to do. If I have it right, you have a include file that is always moving around and file1.php and file2.php are staying in the sampe place? Or are file1.php and file2.php moving around? It would help me if you could post the which files are moving, which ones are not. [/quote] The include files are always staying in the same place. There will be a config file, a header file, nav file, footer file, etc. The pages could potentially be contained anywhere inside of the site. Now with HTML its easy, put a "/" before linking to any file and it always goes back to the server root and finds the file itself. With PHP its not so easy....or so I think.
  2. [!--quoteo(post=384693:date=Jun 16 2006, 02:15 PM:name=dptr1988)--][div class=\'quotetop\']QUOTE(dptr1988 @ Jun 16 2006, 02:15 PM) [snapback]384693[/snapback][/div][div class=\'quotemain\'][!--quotec--] If you have access to your 'php.ini' you could try setting the include_path variable If you don't have access to 'php.ini' you could try using the $_SERVER['SCRIPT_FILENAME'] variable to determine the location of the script you are running and then adjust you include path. [/quote] I've been playing around with PATH_TRANSLATED and others but they seem to tell me the where the include file is sitting not really where the file itself is sitting. My system ideally would work like this: 1. A config.php file that sets variables and is included on every page 2. The variables that are set in config.php are then used inside the page that is called to update the includes so t he page can always find the included files no matter where they are saved.
  3. I'm trying to figure how I can make my all my includes always work no matter where I save the file that is calling the include. For example. Let's say I have file1 and it calls file2.php like so: [code]include('file2.php');[/code] Now if I were to save file1.php into another folder the above would no longer work. I tried just adding a "/" in front of file2.php but that just errors out because it then goes back to the root of the PHP include path that is defined in php.ini. In a perfect world, say I moved file1.php two folders deep for some reason. The include would still work because even though I never touched file1.php it would still write out in the code: [code]include('../../'file2.php');[/code] So it seems that I would clearly need some variable that would update itself based on where the file and concatenate it to "file2.php" in this case. I've tried a ton of $_SERVER variables though and have had no luck. I'm starting to get the feeling that I'm making this a lot harder than it actually is. Any help would be greatly appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.