Sign in to follow this  
Followers 0
Bigmac

html src varibles

6 posts in this topic

#page source

VARlocation = "c:/html/sc/site/"

<TITLE>My Home Page</TITLE>

<img src= VARlocation & "/pictures/abc.jpg">

<a href= VARlocation & "/someother/location.html">

<body>

stuff here

</body>

If you look at that improper syntax maybe you will see what im trying to do... im going to script a small website, at the top of each source file i would like to be able to change a varible to a new source location... any tips???

0

Share this post


Link to post
Share on other sites

You will need to do this with some sort of scripting language; you can use client-side scripting (i.e. JavaScript, JScript) or server-side scripting (ASP, PHP) for that kind of effect.

0

Share this post


Link to post
Share on other sites

The correct way to do this would be with a scripting language, but if all you need to do is to set the base location (though note that you do not want the local (C:\) location but the external location) and can only use HTML, you can do that using the base tag

Edited by n3xg3n
0

Share this post


Link to post
Share on other sites

The correct way to do this would be with a scripting language, but if all you need to do is to set the base location (though note that you do not want the local (C:\) location but the external location) and can only use HTML, you can do that using the base tag

this is just what i was looking for :D ... if i was to move these source files back and fourth from different servers and locations i would only need to change the base address

0

Share this post


Link to post
Share on other sites

There's an easy solution here: relative paths. You don't want to full path, you just want the path from the current directory. So if your HTML file is in C:\web and your images in C:\web\images, the path you need is simply "images/image.jpeg". No need to use an absolute path. In fact, absolute paths will just make life much, much harder on you if you ever have to move things around.

0

Share this post


Link to post
Share on other sites

The correct way to do this would be with a scripting language, but if all you need to do is to set the base location (though note that you do not want the local (C:\) location but the external location) and can only use HTML, you can do that using the base tag

this is just what i was looking for :D ... if i was to move these source files back and fourth from different servers and locations i would only need to change the base address

Ohm is right: that's what relative paths are for. No need for even a base tag.

Edited by Seal
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0