10 replies [Last post]
binargs
Offline
Enthusiast
Last seen: 8 years 31 weeks ago
Timezone: GMT-4
Joined: 2005-07-21
Posts: 85
Points: 8

hi all, just from a preference perspective:

let's say
http://url/dir/dir1/dir2/index.html

and in the index.html you need to link a image to
http://url/images/image.png

will you do
1. <img src="../../../images/image.png" alt="" />
2. <img src="/images/image.png" alt="" />
3. something else

we are not talking about absolute url here.

is there a pro or con for 1 or 2? as far i am aware of, there is no different in all versions of apache/iis

thanks. Smile

binargs
Offline
Enthusiast
Last seen: 8 years 31 weeks ago
Timezone: GMT-4
Joined: 2005-07-21
Posts: 85
Points: 8

will you do 1. <img

will you do
1. <img src="../../../images/image.png" alt="" />
2. <img src="/images/image.png" alt="" />
3. something else

sorry for the edit, forgot to put the code tages in the original post. if a mod can help me edit the post i shall be thankful.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 2 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

2. will always find the image

2. will always find the image in the doc root while 1. might fail if you move files around.
You're probably best finding the sever path first using global constants and prepending that to your path to ensure you locate the accurate path to the image directory

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

binargs
Offline
Enthusiast
Last seen: 8 years 31 weeks ago
Timezone: GMT-4
Joined: 2005-07-21
Posts: 85
Points: 8

Hugo wrote: 2. will always

Hugo wrote:

2. will always find the image in the doc root while 1. might fail if you move files around.
You're probably best finding the sever path first using global constants and prepending that to your path to ensure you locate the accurate path to the image directory

Hi, what do you mean by global constants?\
One of the thing i hate about using the methods in 2 is that it never work in a local environment. let's say you are building a website on your computer. using method 2 none of the files or image will show up. Maybe you know another way to get them working offline?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 47 weeks 6 hours ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Off line development

When developing, always do so within a server environment. It is trivial to install Apache, PHP and MySQL on your local machine. Search for WAMP for a Win install. Most, if not all Linux distros pretty well install the combo by default. Macs have it installed by default, but I think you have to explicitly turn it on.

In a server environment, you can develop dynamic sites that use a pre-processing language such as PHP, Python, PERL, &c., and use a database management system like MySQL or PostgreSQL.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 2 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Ah yes as Gary points out do

Ah yes as Gary points out do use a real server environment - an assumption was made that this was the case - on Winblows *spit* (actually I'm starting to think MS isn't that bad with latter OS offerings) it's utterly trivial to install XAMPP (probably better than WAMP) and get a true working environment in minutes also very easy to then further customize that package. On Macs although it does come with the application packages it was the case early on that those were a pain to setup and had issues so best to install MAMPP? the OSX equivalent.

When installed use your local host file to create domain names so you can navigate to true names rather than folder paths e.g. mytestsite.dev

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 48 weeks 6 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Hugo wrote: it's utterly

Hugo wrote:

it's utterly trivial to install XAMPP (probably better than WAMP) and get a true working environment in minutes also very easy to then further customize that package.

XAMPP is the one I use for Win7 64, was straightforward to install, and runs transparently.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 2 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Easy to install as

Easy to install as essentially you don't need to really install it as a service so it's really just a series of packages with configs suited - where necessary - to Win environment and compiled Binaries or those pernicious DLL things, I keep mine un-installed re-config it to hell and run from a partition.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

binargs
Offline
Enthusiast
Last seen: 8 years 31 weeks ago
Timezone: GMT-4
Joined: 2005-07-21
Posts: 85
Points: 8

guys thanks for the input. i

guys thanks for the input. i am just building a web site for my company and don't do web stuff too often. so i guess i will take the easy route for now.

hugo is there a donation link for csscreator?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 2 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

binargs wrote: hugo is there

binargs wrote:

hugo is there a donation link for csscreator?

Not at this present time although Tony may know otherwise. It was discussed some time back but nothing came of it iirc.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

binargs
Offline
Enthusiast
Last seen: 8 years 31 weeks ago
Timezone: GMT-4
Joined: 2005-07-21
Posts: 85
Points: 8

Hugo wrote: binargs wrote:

Hugo wrote:
binargs wrote:

hugo is there a donation link for csscreator?

Not at this present time although Tony may know otherwise. It was discussed some time back but nothing came of it iirc.

ok please send me an email when you do. you guys advised me more than once that I would otherwise have to spend money on consultants.