Welcome Guest, Not a member yet? Register   Sign In
how to reference file one folder up and down?
#1
Music 

I am trying to reference a file one folder up and then down a few folders:

   

PHP Code:
include "../common/KoolControls/KoolGrid/koolgrid.php"

But this does not work, when the 'include' is in the file views/actors (see above)

Can anyone enlight me?

Thanks in advance.
Reply
#2

(07-04-2016, 02:47 PM)mrad Wrote: I am trying to reference a file one folder up and then down a few folders:



PHP Code:
include "../common/KoolControls/KoolGrid/koolgrid.php"

But this does not work, when the 'include' is in the file views/actors (see above)

Can anyone enlight me?

Thanks in advance.

Try this
PHP Code:
$path rtrim(__DIR__'/') . '/';
$path .= "../common/KoolControls/KoolGrid/koolgrid.php";
include 
$path
Reply
#3

(This post was last modified: 07-04-2016, 09:56 PM by John_Betong.)

(07-04-2016, 09:07 PM)pdthinh Wrote:
(07-04-2016, 02:47 PM)mrad Wrote: I am trying to reference a file one folder up and then down a few folders:



PHP Code:
include "../common/KoolControls/KoolGrid/koolgrid.php"

But this does not work, when the 'include' is in the file views/actors (see above)

Can anyone enlight me?

Thanks in advance.

Try this
PHP Code:
$path rtrim(__DIR__'/') . '/';
$path .= "../common/KoolControls/KoolGrid/koolgrid.php";
include 
$path

Paths are not easy Sad

If the included path does not work I usually echo getcwd(); and adjust the requested relative path.

Once working remove the echo getcwd();
Reply
#4

PHP Code:
$this->load->view('common/KoolControls/KoolGrid/koolgrid'); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB