GetDotted Domains

Viewing Thread:
"Problem with site root relative links"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 03/03/08 at 12:32
Regular
Posts: 6
Hi,

I'm probably doing something wrong, but I'm having problems providing links on my pages (and calling PHP includes) when using site root relative links.

For example if I call my css file as follows;

the css fails to open, but I thought specifying the "/" at the front should make it open the css folder from the site root and then the flashgms.css file within that folder.

I can make document relative links work ("../css/flashgms.css", etc), but this becomes a real pain on my site as pages are situated within various folders.

I want to avoid using absolute links as this causes me other problems, like passing variables in my bits of PHP code that I'm using.

Any ideas?
Wed 05/03/08 at 09:40
Regular
Posts: 6
I've sorted my problem. It's not a problem with site root relative links as such. I use a PHP page to call the CSS and calling this PHP page using a site root relative call isn't allowed as Freeola have safe mode switched on. At least I believe this was the cause of my problem.
Learning fast!!
Mon 03/03/08 at 16:37
Regular
"Devil in disguise"
Posts: 3,151
Well whatever you are doing with your PHP it shouldnt have an impact on your html links as they are handled by the browser.
Any chance you can set up a test page demonstrating this css link not working? You're linking to the css file twice at the moment and neither have a leading slash.
Mon 03/03/08 at 16:17
Regular
Posts: 6
Thanks for the tip. I'll have a look at getcwd().
I think some of my problem is because I call other PHP files from within the one I include. Having a search on the web, I think I may be better to use the function command and have all my code in one PHP file.
The site is http://www.flashgms.com/
Mon 03/03/08 at 13:56
Staff Moderator
"Aargh! Broken..."
Posts: 1,408
../pathtomycss/css.css will lead to a location one directory up from where you are now. pathtomycss/css.css will look in a sub directory call pathtomycss within the directory you are currently in.
You absolute link (/pathtomycss/css.css) should work. No .htaccess rules?

If you are using php then you might want to try using the function getcwd() (get current working directory) which will append the absolute path for you.
Mon 03/03/08 at 13:50
Regular
"Devil in disguise"
Posts: 3,151
Lets see the site in question? Your understanding of leading / is correct so something else is going wrong. Not using mod_rewrite or anything are you?
Mon 03/03/08 at 13:43
Regular
Posts: 6
Removing the leading / only works for pages that are in the root folder (ie. htdocs).

As I understood it the leading / should specify the site root?

What I'm trying to avoid is having different links for pages that are in different folders, as it makes the use of templates very difficult.
Mon 03/03/08 at 13:34
Moderator
"Are you sure?"
Posts: 5,000
Hi,
Have you tried taking out the leading / ?









Search Freeola Chat
Mon 03/03/08 at 12:32
Regular
Posts: 6
Hi,

I'm probably doing something wrong, but I'm having problems providing links on my pages (and calling PHP includes) when using site root relative links.

For example if I call my css file as follows;

the css fails to open, but I thought specifying the "/" at the front should make it open the css folder from the site root and then the flashgms.css file within that folder.

I can make document relative links work ("../css/flashgms.css", etc), but this becomes a real pain on my site as pages are situated within various folders.

I want to avoid using absolute links as this causes me other problems, like passing variables in my bits of PHP code that I'm using.

Any ideas?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

10/10
Over the years I've become very jaded after many bad experiences with customer services, you have bucked the trend. Polite and efficient from the Freeola team, well done to all involved.
Wonderful...
... and so easy-to-use even for a technophobe like me. I had my website up in a couple of hours. Thank you.
Vivien

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.