Subdirectories

  • Thread starter Luigi Donatello Asero
  • Start date
R

Roy Schestowitz

Luigi said:
Hello,


I am using subsubdirectories in order to oversee my files
for example here.

https://www.scaiecat-spa-gigi.com/sv/italien-valle-daosta/boende-i-bionaz.php

Could you mention the main advantages and disadvantages with using
subsubdirectories?

A common mistake in file management is to avoid nested directories. I see
many Windows users who keep a flat and highly-unmanageable "My Documents"
directory. As far as the Web is concerned, exactly the same principles
apply. It is easy to procrastinate at the start and become reliant on a
flat structure. However, what happens when your site expands to comprise
10,000 files? Can you ever get directory listing in a reasonable time? Can
you ever find, by filename, the objects you worked with years ago?

The only disadvantage I can think of is the inflexibility in moving pages,
but even /this/ can be avoided. I see that you use relative paths as in
'../../index.htm'. You will be better off with just '/index.htm', trust me.

Roy
 
L

Luigi Donatello Asero

Roy Schestowitz said:
https://www.scaiecat-spa-gigi.com/sv/italien-valle-daosta/boende-i-bionaz.php

A common mistake in file management is to avoid nested directories. I see
many Windows users who keep a flat and highly-unmanageable "My Documents"
directory. As far as the Web is concerned, exactly the same principles
apply. It is easy to procrastinate at the start and become reliant on a
flat structure. However, what happens when your site expands to comprise
10,000 files?

At the beginning the site was not large you know..
it was easier for me to use simple paths for the files
now I am thinking about using subsubdirectories because it has got larger
and larger...

Can you ever get directory listing in a reasonable time? Can
you ever find, by filename, the objects you worked with years ago?

So far, mostly yes, but the site is going to be larger and larger...
The only disadvantage I can think of is the inflexibility in moving pages,
but even /this/ can be avoided. I see that you use relative paths as in
'../../index.htm'. You will be better off with just '/index.htm', trust
me.

How does a file jump from a subsubdirectory to the directory if I do not use
.../../ ?
 
R

Roy Schestowitz

Luigi said:
At the beginning the site was not large you know..
it was easier for me to use simple paths for the files
now I am thinking about using subsubdirectories because it has got larger
and larger...

Can you ever get directory listing in a reasonable time? Can

So far, mostly yes, but the site is going to be larger and larger...

Learn from the mistakes I made and always use a hierarchy deeper than what
you think is needed. If you add directories called "May" and "June", put
them under a directory such as "2000". It will potentially save you
'migration' work later.
me.

How does a file jump from a subsubdirectory to the directory if I do not
use ../../ ?

I guess it depends on the relationship between the files and some people
will disagree with me, but...

'/index.htm' will always work provided that index remains immovable.
'../../index.htm' will break is the page under question descends into a
deeper level. These dependencies are hard to detect, too (unless your site
is being crawled and errors are triggered).

Roy
 
T

Toby Inkster

Luigi said:
How does a file jump from a subsubdirectory to the directory if I do
not use ../../ ?

Start the path with a slash "/" and it jumps right back to the root. :)
 
L

Luigi Donatello Asero

Roy Schestowitz said:
Luigi Donatello Asero wrote:


[cut]
How does a file jump from a subsubdirectory to the directory if I do not
use ../../ ?

I guess it depends on the relationship between the files and some people
will disagree with me, but...

'/index.htm' will always work provided that index remains immovable.
'../../index.htm' will break is the page under question descends into a
deeper level. These dependencies are hard to detect, too (unless your site
is being crawled and errors are triggered).

Roy


To put it in different terms,

I have for example a file
valle-daosta.php
which has the location

https://www.scaiecat-spa-gigi.com/sv/italien-valle-daosta/valle-daosta.php
that means that it has been collocated in the subsubdirectory
"italien-valle-daosta" which is within the
subdirectory "sv" which lies in the directory www.
Let´s say, now that I want to link that file to another one called
"benvenuti.php"
having the
following location

https://www.scaiecat-spa-gigi.com/it/benvenuti.html
The file "benvenuti lies in a subdirectory which is not the same
subdirectory where the subsubdirectory "valle-daosta" lies.
Then I would
write
<a href="../../it/benvenuti.html">Italiano</a>
on the file valle-daosta.php to link it to
https://www.scaiecat-spa-gigi.com/it/benvenuti.html

How would you do?
 
R

Roy Schestowitz

Luigi Donatello Asero wrote:

[snip]
I have for example a file
valle-daosta.php
which has the location

https://www.scaiecat-spa-gigi.com/sv/italien-valle-daosta/valle-daosta.php
that means that it has been collocated in the subsubdirectory
"italien-valle-daosta" which is within the
subdirectory "sv" which lies in the directory www.

www is probably just a pointer to public_html, but let's not be pedantic.
Let´s say, now that I want to link that file to another one called
"benvenuti.php"
having the
following location

https://www.scaiecat-spa-gigi.com/it/benvenuti.html

Do you mean https://www.scaiecat-spa-gigi.com/it/benvenuti.php ? I am not
making a correction, I am asking...
The file "benvenuti lies in a subdirectory which is not the same
subdirectory where the subsubdirectory "valle-daosta" lies.
Then I would
write
<a href="../../it/benvenuti.html">Italiano</a>
on the file valle-daosta.php to link it to
https://www.scaiecat-spa-gigi.com/it/benvenuti.html

How would you do?

It depends on how your site is expected to develop. If you expect to graft
your entire site into a deeper level and have another site live to its
side, stick to what you have. I should mention that subsites and
re-directions mean that it's unlikely to ever be necessary.

I prefer (and also consider to be more suitable):

<a href="/it/benvenuti.html">Italiano</a>
 
L

Luigi Donatello Asero

Roy Schestowitz said:
Luigi Donatello Asero wrote:

[snip]
I have for example a file
valle-daosta.php
which has the location

https://www.scaiecat-spa-gigi.com/sv/italien-valle-daosta/valle-daosta.php
that means that it has been collocated in the subsubdirectory
"italien-valle-daosta" which is within the
subdirectory "sv" which lies in the directory www.

www is probably just a pointer to public_html, but let's not be pedantic.
Let´s say, now that I want to link that file to another one called
"benvenuti.php"
having the
following location

https://www.scaiecat-spa-gigi.com/it/benvenuti.html

Do you mean https://www.scaiecat-spa-gigi.com/it/benvenuti.php ? I am not
making a correction, I am asking...


The beginning of the example was wrong.
the file in question should be
"benvenuti.html"
It depends on how your site is expected to develop. If you expect to graft
your entire site into a deeper level and have another site live to its
side, stick to what you have. I should mention that subsites

What do you mean by "subsites"?
I do not know yet whether I shall do it. I am starting with
subsubdirectiories for the parts which have not been developed yet
(and they are many!!)
For example I started a subsubdirectory for Valle D´Aosta within the
subdirectory "sv".
I would like to have similare subsubdirectories for Valle D´Aosta in all the
subdirectories
("sv" is a subdirectory for the language, Swedish in this case)
But I do not know whether I shall do it for the regions which I have already
included within "sv" for example "Toscana".




and
re-directions mean that it's unlikely to ever be necessary.

I prefer (and also consider to be more suitable):

<a href="/it/benvenuti.html">Italiano</a>


"it" is short for "Italian"
and "benvenuti" means "welcome".
That page is supposed to be a kind of introduction explaining what the
website is about. It is not supposed to be a subsubsubdirectory.
There will be another page afterwards which I might call something like
https://www.scaiecat-spa-gigi.com/en/italien-valle-daosta/valle-daosta.php
which gives information in english about the region Valle D´Aosta and then I
can connect this page to the version in Swedish (sv).
 
R

Roy Schestowitz

Luigi said:
The beginning of the example was wrong.
the file in question should be
"benvenuti.html"


Okay. If you had used PHP to generate pages on the fly, my advice would
possibly be different.

What do you mean by "subsites"?


Forget about it. It was hypothetically speaking.

I do not know yet whether I shall do it. I am starting with
subsubdirectiories for the parts which have not been developed yet
(and they are many!!)
For example I started a subsubdirectory for Valle D´Aosta within the
subdirectory "sv".
I would like to have similare subsubdirectories for Valle D´Aosta in all
the subdirectories
("sv" is a subdirectory for the language, Swedish in this case)
But I do not know whether I shall do it for the regions which I have
already included within "sv" for example "Toscana".


Let me give you an example which suggests that you should write paths in the
way that I recommended. Let us say that you tend to cut-and-paste pages in
order to quickly generate new ones -- that is to say, you re-use previous
code. What if you (one day) had 4 different pages under Valle D´Aosta? Let
us say, to focus on different regions. If you put these under a lower
level, e.g.

https://www.scaiecat-spa-gigi.com/it/Toscana/local_cafe/index.html

You then have to change every '../..' to '../../..'. If you have many such
links (or images), then it's a tedious task with unreliable outcomes (i.e.
difficult to test).
 
R

Roy Schestowitz

Luigi said:
The beginning of the example was wrong.
the file in question should be
"benvenuti.html"


Okay. If you had used PHP to generate pages on the fly, my advice would
possibly be different.

What do you mean by "subsites"?


Forget about it. It was hypothetically speaking.

I do not know yet whether I shall do it. I am starting with
subsubdirectiories for the parts which have not been developed yet
(and they are many!!)
For example I started a subsubdirectory for Valle D´Aosta within the
subdirectory "sv".
I would like to have similare subsubdirectories for Valle D´Aosta in all
the subdirectories
("sv" is a subdirectory for the language, Swedish in this case)
But I do not know whether I shall do it for the regions which I have
already included within "sv" for example "Toscana".


Let me give you an example which suggests that you should write paths in the
way that I recommended. Let us say that you tend to cut-and-paste pages in
order to quickly generate new ones -- that is to say, you re-use previous
code. What if you (one day) had 4 different pages under Valle D´Aosta? Let
us say, to focus on different regions. If you put these under a lower
level, e.g.

https://www.scaiecat-spa-gigi.com/it/Toscana/local_cafe/index.html

You then have to change every '../..' to '../../..'. If you have many such
links (or images), then it's a tedious task with unreliable outcome (i.e.
difficult to test).
 
L

Luigi Donatello Asero

Roy Schestowitz said:
Let me give you an example which suggests that you should write paths in the
way that I recommended. Let us say that you tend to cut-and-paste pages in
order to quickly generate new ones -- that is to say, you re-use previous
code. What if you (one day) had 4 different pages under Valle D´Aosta? Let
us say, to focus on different regions. If you put these under a lower
level, e.g.

https://www.scaiecat-spa-gigi.com/it/Toscana/local_cafe/index.html

You then have to change every '../..' to '../../..'. If you have many such
links (or images), then it's a tedious task with unreliable outcome (i.e.
difficult to test).


While using my method I have to change them ( I did it a few hours ago!)
but, unfortunately I still do not understand properly how your method
would work...


--
Luigi ( un italiano che vive in Svezia)

https://www.scaiecat-spa-gigi.com/sv/boende-i-italien.php








I
 
L

Lauri Raittila

'/index.htm' will always work provided that index remains immovable.

But will break when changing it to index.php. Just "/" is better. Also
because it will result same URL as main page...
 
R

Roy Schestowitz

Lauri said:
But will break when changing it to index.php. Just "/" is better. Also
because it will result same URL as main page...

Good point. You were being quite strict with my suggestion. I think it was
simpler to convince someone to change "../../index.htm" to "/index.htm"
than to suggest something 'odd' like "/". But you're right nonetheless.

Roy
 
L

Luigi Donatello Asero

Roy Schestowitz said:
Good point. You were being quite strict with my suggestion. I think it was
simpler to convince someone to change "../../index.htm" to "/index.htm"
than to suggest something 'odd' like "/". But you're right nonetheless.

Roy

I do not understand yet how you want to link a page which is located in a
subsubdirectory to the first page by writing
"/index.htm" or "/"
Do you want the index to be at a level which is as deep as the
subsubdirectories themselves?
 
R

Roy Schestowitz

Luigi said:
I do not understand yet how you want to link a page which is located in a
subsubdirectory to the first page by writing
"/index.htm" or "/"
Do you want the index to be at a level which is as deep as the
subsubdirectories themselves?

No, I think there's a misconception here.

If I were in http://mysite.com/my_dir/my_dir2

"./" would refer to:

http://mysite.com/my_dir/my_dir2

Whereas "/" would refer to:

http://mysite.com/

....and that's precisely what you want...

Roy
 
L

Luigi Donatello Asero

Roy Schestowitz said:
Luigi Donatello Asero wrote:



No, I think there's a misconception here.

If I were in http://mysite.com/my_dir/my_dir2

"./" would refer to:

http://mysite.com/my_dir/my_dir2

Whereas "/" would refer to:

http://mysite.com/

...and that's precisely what you want...

Roy


Yes, it is but there is still something which I do not understand.
I tested both ways
1)
http://www.scaiecat-spa-gigi.com/sv/boendeiitalien.html
<li><a class="navigator1" href="../index.html" >Home</a></li>
2) http://www.scaiecat-spa-gigi.com/sv/boende-i-italien.html
<li><a class="navigator1" href="/index.html" >Home</a></li>

Now, if I move my mouse on the link "home" on the top on the left of the
pages
I read on both
http://www.scaiecat-spa-gigi.com/index.html
and if I click on both I enter the same page.
Why?
 
S

Steve Pugh

Luigi Donatello Asero said:
Yes, it is but there is still something which I do not understand.
I tested both ways
1)
http://www.scaiecat-spa-gigi.com/sv/boendeiitalien.html
<li><a class="navigator1" href="../index.html" >Home</a></li>
2) http://www.scaiecat-spa-gigi.com/sv/boende-i-italien.html
<li><a class="navigator1" href="/index.html" >Home</a></li>

Now, if I move my mouse on the link "home" on the top on the left of the
pages
I read on both
http://www.scaiecat-spa-gigi.com/index.html
and if I click on both I enter the same page.
Why?

Because both URLs point to the same resource

"../index.html" means go up one level and go to index.html,
so starting from
http://www.scaiecat-spa-gigi.com/sv/boendeiitalien.html
up one level takes us to
http://www.scaiecat-spa-gigi.com/
and then we add index.html on the end to reach
http://www.scaiecat-spa-gigi.com/index.html

"/index.html" means start from the root and go to index.html,
so starting from
http://www.scaiecat-spa-gigi.com/sv/boende-i-italien.html
going to the root takes us to
http://www.scaiecat-spa-gigi.com/
and then we add index.html on the end to reach
http://www.scaiecat-spa-gigi.com/index.html

The same.

Steve
 
T

Toby Inkster

Steve said:
Because both URLs point to the same resource

It is amazing the number of people that don't seem to "get" URLs --
especially relative URLs with lots of back references.

"http://example.org/a/b/c/d/foo.html" references "../e/f/../g/bar.html"
which results in "http://example.org/a/b/c/e/g/bar.html".

This seems so obvious to me, but to some people (who often seem quite
knowledgable from their posts on other topics) it seems to be a real
problem.

Perhaps this is because I grew up around the command line?

It would be good if there were a really comprehensive tutorial on URLs
to which we could refer people. Anyone know of any? Or am I going to have
to write one?
 
L

Luigi Donatello Asero

Toby Inkster said:
It is amazing the number of people that don't seem to "get" URLs --
especially relative URLs with lots of back references.

"http://example.org/a/b/c/d/foo.html" references "../e/f/../g/bar.html"
which results in "http://example.org/a/b/c/e/g/bar.html".


Are b a´s subdirectory , c b´s, d c´s, e d´s, e d´s, f
e´s, g f´s?
This seems so obvious to me, but to some people (who often seem quite
knowledgable from their posts on other topics) it seems to be a real
problem.

Perhaps this is because I grew up around the command line?

It would be good if there were a really comprehensive tutorial on URLs
to which we could refer people. Anyone know of any? Or am I going to have
to write one?

Well, actually, I do not know any specifical tutorial about that.
So, I think it could be a good idea if you wrote one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,167
Latest member
SusanaSwan
Top