• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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, 03: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
(07-04-2016, 10:07 PM)pdthinh Wrote:
(07-04-2016, 03: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();
CI4 Develop Site - progressing nicely - Thank you Smile
https://johns-jokes.cf/pictures

Reply

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.