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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

 

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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