Problem with script counter.php

Yes, paths can be confusing. (non-technical explanation to follow)

The are file system paths eg. “C:/folder/folder/file”
And HTTP paths eg. “http://somesite/index.html

They look similar, and things get more confusing when you consider that
URIs (resource Indentifiers) look like URLs (resource Locators) but don’t need to be “real”
Some times Case matters, some times not.
Some OS use forward slash /, some backward \, sometimes either will work.

Anyway, a typical live site structure is like

/ your host account folder
. . . / “private” folder accesible to code only, not browsers
. . . / public “root” folder
. . . . . index.html
. . . . . htaccess
. . . . . robots.txt
. . . . . favicon.ico etc. etc.
. . . . . / css folder
. . . . . . . sitestyle.css
. . . . . / javascript folder
. . . . . . . sitescript.js
. . . . . / image folder
. . . . . . . logo.jpg
. . . . . / sub folder
. . . . . . . / sub sub folder etc. etc.

The easiest thing to do is to have every file that needs each other in the same folder.
But this can quickly make a folder have so many files it makes things harder instead of easier.
And if, say, “logo.jpg”, “sitestyle.css” and “sitescript.js” were to be used in sub folders and sub sub folders, there would be multiple copies of those files. If a change to a file was made, changing them all could be a problem. Even if not a problem, it gets old fast, believe me.

Organizing things helps, and how it’s done can be different, so basically it’s do it the way it needs to be done if you must, else the way that works best for you.

Absolute paths eg. “http://somesite.com/images/logo.jpg” always work but can get rather long.
“root” paths work OK and are often the preferred way eg “/images/logo.jpg”
Relative paths work, but require an understanding of where things are in relation to each other eg.
from root folder “css/sitestyle.css”,
from sub folder “…/css/sitestyle.css”,
from sub sub folder"…/…/css/sitestyle.css"

2 Likes