dirname( __FILE__) makes my head hurt. explain how this works please?

Joined
12 Feb 2006
Posts
17,313
Location
Surrey
i've always used include '/p/price-list.php'; etc to include a file but realise the issues this has with being relative to which file calls the include.

i'm reading up and dirname( __FILE__) is better practice but i just can't get my head round it.

so lt's say i'm the file

website.com/admin/index.php

and i've included the file

admin/content/quotes/sort/sort_quote.php

and within that file i'm trying to include a file

admin/p/price-list.php


i can include the first sort_quote.php file, but not the second price-list.php file. everything i try fails.

what should i put?

what is weird is that using xampp and working locally this works. it was only until i uploaded to the server that trying to include the files using my older method failed, and using dirname( __FILE__) never works locally or server

help me ocuk. you're my only hope
 
Back
Top Bottom