Jump to content

require_once ("\\onelevelabovefromcurrentdirectory\style.css\");


sayedsohail

Recommended Posts

You use ".." to go up a directory tree. For example if your current directory is  "/this/is/a/test" to get to a file in the directory "a", you would use "../yat.xyz". So in your case, you would write:

<?php
require_once('../style.css');
?>

 

Ken

is there a way i could create header.php and include all the my subdirectories and than just refer in my all my webpages

 

how do i include different paths in my header.php, please help.

 

 

require_once(header.php) will automatically include those paths of my directories.

you mean to say, if i want to include ten different paths

 

than i have to type ten different path in my header.php file.

 

include_path=".;c:\php\config\config.php"

include_path=".;c:\php\style\stylesheet.css"

include_path=".;c:\php\function\functions.js" and so on.

 

 

 

 

you mean to say, if i want to include ten different paths

 

than i have to type ten different path in my header.php file.

 

include_path=".;c:\php\config\config.php"

include_path=".;c:\php\style\stylesheet.css"

include_path=".;c:\php\function\functions.js" and so on.

 

 

I don't know where you got that from but a path refers to a directory, not a file.

 

You would use something like....

 

<?php

  set_include_path(
    get_include_path().
    PATH_SEPERATOR.'c:\php\config'.
    PATH_SEPERATOR.'c:\php\style'.
    PATH_SEPERATOR.'c:\php\function'
  );

?>

 

And yes, of course you need to add each directory you'll need.

The best way I've found is to use a single INCLUDES directory, or single STYLES directory (whatever) then define a constant global variable to handle it.

 

<?php

define(DOC_INCLUDES, $_SERVER['DOCUMENT_ROOT'] . "/includes");

require_once(DOC_INCLUDES . "/database.inc");

?>

Archived

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

×
×
  • 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.