Jump to content

include file in a different folder


MasterACE14

Recommended Posts

hey,

 

I just want to include a file. I'm just not sure how you include it when it's in another folder to where the file calling it is.

 

folder structure:

Main Directory -> css -files to include-

                      -> lib -including the files in css folder above-

 

and my code for files within the 'lib' folder:

<?php
$style = $_SERVER['DOCUMENT_ROOT']."/css/".$style.".css";

 

any help is appreciated.

 

Regards, ACE

Link to comment
https://forums.phpfreaks.com/topic/147142-include-file-in-a-different-folder/
Share on other sites

hmm, doesn't seem to be changing anything.

<?php
// function inside my class
public function Style($style="default")
{
	$style = "../css/".$style.".css";
	if(is_file($style)) 
	{
		echo "<style><!--";
		include($style);
		echo "--></style>";
	}
}

$client = new Client();
$client->Style();

// in the CSS file included it changes background and text color of a table

// a HTML table is here but without any of the CSS changes ???

 

any ideas?

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.