Jump to content

Can I change the HTML directory pointer?


MrCat

Recommended Posts

I'm entering my site via a sub folder, e.g. mysite.com/BeginHere (which triggers index.php in the BeginHere folder) and then including my main page which is in the root folder. I change the directory pointer with chdir( '../' ) so now I'm officially back in the root folder.

 

This works fine - but the HTML still points to one directory down. Is there any way I can move this up one level as well?

 

Link to comment
Share on other sites

im not quite sure i follow what you are saying.

 

does beginhere/index.php, have an include folder thats located up one level? or does it redirect instead of include?

 

the html points to one directory down - i have no idea what this means!

Link to comment
Share on other sites

PHP and HTML are independent of each other.

 

PHP is code processed server-side. HTML is markup that is rendered on the client's computer.

 

I think you want something similar to <base /> but for images. I don't think it exists.

 

You COULD automate this with PHP, I suppose.

Link to comment
Share on other sites

To try and clarify what I mean:

 

I don't want my 'secret' site to exist through mysite.com

I also want user accounts that are accessed simply by typing mysite.com/Username

 

The index.php in mysite.com/Username doesn't redirect - it changes the PHP directory pointer up one level and then includes the 'main page' file which is in mysite.com

 

Changing the directory pointer is simply so I don't have to start all subsequent links with ../ to reach files common to all accounts - mysite.com/images etc.

The HTML directory however remains as mysite.com/Username so all links in HTML have to begin with ../

 

 

Link to comment
Share on other sites

Thanks guys - the <base href> tag appears to be the solution I was looking for.

Sorry I missed your suggestion xyph. I'd never heard of it and had to research it.

 

All I was trying to do was to avoid ../ on every link if I enter my site at a level other than the root directory.

 

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.