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/";

?>
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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
Link to comment
Share on other sites

$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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.