I have site (www.snowcommunity.com) that I am planning to split into subdomains for various towns like so: wanaka.snowcommunity.com queenstown.snowcommunity.com whistler.snowcommunity.com etc. My host creates a new folder for each subdomain. I want to use the same webpages on each site, including almost all the same graphics. All the contect will be different, specific to that town. Most of the graphics and header/footer/menu files are coming from www.snowcommunity.com. What is the best way to link to them? My best guess (and probably poor appraoch) <? include(/root/somepath/snowcommunity/includes/top.php") ?> <img src="http://snowcommunity.com/images/logo.gif"> Anyone know of any better ideas to link to the root domain from a subdomain?
Absolute and Relative URLs There are two types of paths in HTML, known as relative paths and absolute paths. An absolute path contains the full URL of the item being referenced. A relative path contains directions to the item relative to the HTML page. Relative URLs are preferred for your own pages. If you change domains, and you've used relative URLs for your graphics and web pages, you won't need to edit the links if you do change domains. If your web site grows and grows (as ours did!) you might need to change hundreds of links if you ever move your web site. Let's say that the page you are writing will be uploaded as: www.techarena.in/example/index.htm and a graphic, in another folder, at the URL www.techarena.in/images/fiddle.gif[/url] The path from the HTML page to the graphic: Absolute Path: <IMG SRC="techarena.in/images/fiddle.gif"> Relative Path: <IMG SRC="images/fiddle.gif"> The relative path tells the browser to look in a directory named images for a file named fiddle.gif. If the image was located at the URL: techarena.in/images/music/fiddle.gif The relative path would appear as: <IMG SRC="images/music/fiddle.gif"> Now let's say that the page you are writing will be uploaded as: techarena.in/example/index.htm and the graphic you want to link to is located at: techarena.in/tuba.gif The path from the HTML page to the graphic would look like this: Absolute Path: <IMG SRC="techarena.in/tuba.gif"> Relative Path: <IMG SRC="../tuba.gif"> Above stuff, works similar for sub-domains Hope that helps
I understand the whole difference between absolute and relative paths. The problem is that the subdoamain is set up as a seperate folder (not in the path of www.snowcommunity.com). Ie. the host has a folder called snowcommunity.com and one called wanaka.snowcommunity.com in my root directory. The full path to each is: /hsphere/local/home/ccharp/snowcommunity.com /hsphere/local/home/ccharp/wanaka.snowcommunity.com I think with some fooling around I'll figure out how to link to images and files between the two without resorting to this in the files on wanaka.snowcommunity.com: <? include(/hsphere/local/home/ccharp/snowcommunity.com/includes/top.php") ?> <img src="http://snowcommunity.com/images/logo.gif">
I saw something where you can put like src=".../images/image.gif" I'm sorry for not knowing the details but look into lines of code like that.