Jump to content

Archived

This topic is now archived and is closed to further replies.

Wideawake

HELP how to call root directory from a folder within??

Recommended Posts

Ok so I tried installing a script of a test site. Got everthing working except the .phps which are in a different folder. Ok so my index pulls info like this and it works

<?
include("_header.php");
$title = "mysite ;)";
include ('title.php');
?>

this is in the root folder. but my other pages inside of folders within the root, are set up the same way and dont pull the info like it should. I can place those pages in the root and the work, but within another folder they dont. Im sure its a easy fix, but im a complete n00b and cluess. Any help would be greatly appreciated.
Thx,
Mike

Share this post


Link to post
Share on other sites
example ok.

include="header.php";
include("header.php");
require_once("header.php");
require("include.php");

Share this post


Link to post
Share on other sites
[quote author=redarrow link=topic=101597 .msg402206#msg402206 date=1153693589]
example ok.

include="header.php";
include("header.php");
require_once("header.php ");
require("include.php");

[/quote]

huh? u lost me.... the example I posted works fine in the root, but the .phps in folders within the root it doesn't work. I being a n00b can only guess theres a command to tell it to look in the root or one directory up. but I'm new to al this.

say the example I posted above is my index.php, it works in the root, but if I move to say folder /includes it doesn't pull those like it should. any suggestions. I need help quick ;)

Share this post


Link to post
Share on other sites
You use two dots to move up one directory. eg;

[code=php:0]
include "../_header.php"; // up one.
include "../../_header.php"; up two.
[/code]

Share this post


Link to post
Share on other sites
I knew it was a simple ?, thanks that done it. the only thing I didnt try lol i tried .. and //. Thanks for the reply ;)

Share this post


Link to post
Share on other sites

×

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.