A question to the html wizards

ShyGuy68

The Dane with a cane
Joined
Mar 12, 2000
Posts
24,524
I'm hoping this it possible

Is it possible in some way to insert the name of a folder the html file is in, into the html file?

Say if you have a folder named "shyguy", then have it so that it says in the index.html file: This is the shyguy folder?
 
So you want a link to a folder, instead of a specific file, on your index page?

Or you want a page that goes to the folder's contents, e.g. www.shy.com/shyguy/ ?

I'm not understanding what you're trying to do. Maybe you can clarify and/or someone else will get it.
 
Ok trying once more, hoping it'll be more clear

I would like the webpage (in this case the index.html) to display the name of the folger that the page is in

Say if the webpage is in the 123 folder at www.shyguy.com (www.shyguy.com/123) then it should say on the webpage "this file is in the 123 folder".

I hope it made more sense?
 
Is it possible in some way to insert the name of a folder the html file is in, into the html file?

In Windows and most UNIX derivatives, you can use "relative paths" which define "." as the current directory/folder and ".." as the Parent directory/folder.

It might be possible to specify a relative path to display and have it display the full unqualfied path. IOW, code "This is the" . "folder" and have it display as "This is the C:/website/Shyguy folder."

That is pretty much operating system specific, and you may need to assign the relative folder "." to a variable and then display it using the variable.
 
Is it possible in some way to insert the name of a folder the html file is in, into the html file?

Say if you have a folder named "shyguy", then have it so that it says in the index.html file: This is the shyguy folder?

I'm assuming from your phrasing you don't want simply a link, but the actual directory name to be automatically put in the HTML file.

The answer is no. Simple HTML can't do that. HTML is simply a markup language passing layout and structure information of the contents.

That doesn't mean it can't be done though. You can either use something as simple as a tag that gets replaced by your editor on saving, or PHP/ASP/server-side-includes to insert it when the page is served from the browser, or Java Script[*] to add it when the page is actually rendered in the browser.

The choice depends on (a) what you mean by the containing folder (the directory structure shown in the URL of the browser need not map directly onto the directory structure of the file system, and (b) what you're most comfortable with.


[*] Java Script is one word, but the forum won't let me enter it.
 
Back
Top