Jump to content

Referencing a parent directory name ---- NEED HELP!!


kevinn

Recommended Posts

The following is a settings.php file that controls which images go where on an index page and in a gallery page.  I would like to have the word "bunnies" be a string or function that references the parent directory at that location rather than be a specified name.  That way when I create a new directory full of dogs, or cats or people, I don't have to come into this file to change it.  How can I reference that portion of the directory path?

$sitetitle = "Bunnies Sept 2006";

$directory = "/home/localsite/public_html/membersarea/2/abc/bunnies/gallery1/photos/thumbs/Set1/";

$urltothumb = "http://www.localsite.com/membersarea/2/abc/bunnies/gallery1/photos/thumbs/Set1/";

$urltosmall = "http://www.localsite.com/membersarea/2/abc/bunnies/gallery1/photos/small/Set1/";

$urltomedium = "http://www.localsite.com/membersarea/2/abc/bunnies/gallery1/photos/medium/Set1/";

$urltolarge = "http://www.localsite.com/membersarea/2/abc/bunnies/gallery1/photos/large/Set1/";

?>
yeah.. I know about the ../ part

I need /dogs or /bunnies to be a function that references a parent directory name... so technically the membersarea/2/abc/xxxxxx/gallery1  xxxxxxx will change and the file needs to know what that name is.  I want it to reference a directory name that is 2 parent steps up.  I tried

$directory = "/home/localsite/public_html/membersarea/2/abc/" + ../../ + "photos/thumbs/Set1" but that doesn't do anything

Also tried

$directory = "/home/localsite/public_html/membersarea/2/abc/" + ../../ + getcwd + "photos/thumbs/Set1" but that doesn't do anything

does that help explain it a little better?
if i knew what the $sitetitle function is... probably not... it'd take alot of code for a function to automatically switch from full path to relative path with 100% accuracy... twood be quicker to just change it manually from your database... i'm sure i could make one to switch from full to relative path... but tha'd prolly take a while lol
$sitetitle is at the top of the code I listed at the very beginning.  I agree it would be easy to just change it, but then again programming is so I can be lazy right? LOL

perhaps a change directory function (using a relative path.... I always go up two directories from this location... I would rather go up two directories than define a root folder and go from there... the path from the root may have an extra level at times) then a getcwd following that?

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.