Jump to content

[SOLVED] How to reference to a file "up one level" in "includes()" function???


Recommended Posts

 

Hey guys, I was wondering if someone could advise me, here is my situation:

 

First Question:

I have my main web folder, and then 10 folders. Then in each of these 10 folders, I have 10 more folders. Ex

 

Domain.com/F8/F1

Domain.com/F8/F2

 

So, I will have many pages, and they will all have similar layout. I want to do this with php include() function, the problem is that I don't know how to "reference Up a level", like say "footer.php" was located in:

 

Domain.com/includes/footer.php

 

How would i refer to that from say Domain.com/F8/F2/index.html

Would it just be absolute path? Or is there a better way?

 

Second Question:

 

How can i pass the current path to a function? Like i mean, I want to have each file from each of those folders call a function like so:

In file- Domain.com/F2/F3/index.html

Call Function- Function(F2,F3);

How can i "send" the data of the current folder in a function?

This way I could have really efficient pages, because they would be generated from a database and just one easy-to-edit file.

 

Or again, is there a better way?

 

Thanks for any insight!!

 

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.