kevinn Posted January 10, 2007 Share Posted January 10, 2007 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/";?> Quote Link to comment Share on other sites More sharing options...
taith Posted January 10, 2007 Share Posted January 10, 2007 ./ <-- current directory../ <-- parent directory Quote Link to comment Share on other sites More sharing options...
psychohagis Posted January 10, 2007 Share Posted January 10, 2007 im not quite sure what ur asking above, but to access your root folder you have to put [b]../ [/b] at the begginingso if you had a folder one down from your root called dogs, then u'd put [b]../dogs/[/b] Quote Link to comment Share on other sites More sharing options...
kevinn Posted January 10, 2007 Author Share Posted January 10, 2007 yeah.. I know about the ../ partI 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 anythingAlso tried $directory = "/home/localsite/public_html/membersarea/2/abc/" + ../../ + getcwd + "photos/thumbs/Set1" but that doesn't do anythingdoes that help explain it a little better? Quote Link to comment Share on other sites More sharing options...
taith Posted January 10, 2007 Share Posted January 10, 2007 $directory = "../../photos/thumbs/Set1/";../ and ./ are for relative path, not full Quote Link to comment Share on other sites More sharing options...
kevinn Posted January 10, 2007 Author Share Posted January 10, 2007 My bad.... I should have realized that.... such a simple fix.Ok.. second question. Any way to have the $sitetitle function recognize that directory name so I don't have to go in and change it? Quote Link to comment Share on other sites More sharing options...
taith Posted January 10, 2007 Share Posted January 10, 2007 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 Quote Link to comment Share on other sites More sharing options...
kevinn Posted January 10, 2007 Author Share Posted January 10, 2007 $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? LOLperhaps 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.