"Mappings" are one of TopStyle's most powerful features, but they're apparently also one of the most confusing. So what are mappings all about?
In a nutshell, mappings enable TopStyle to preview files containing server-side code (PHP, ASP, etc.). Server-side code must be processed by a web server such as IIS or Apache, so TopStyle uses a mapping to pass the current file through your local web server in order to preview it.
Perhaps the biggest stumbling block with mappings is the fact that they only work with a local web server (ie: http://localhost/). Since TopStyle's preview displays the file you're currently editing, mapping to an external web server won't work.
So, a mapping consists of a local directory name and its corresponding URL as seen by your local web server. Normally, "Map From" should contain the name of your local web server's home directory (a.k.a. "Document Root"), and "Map To" should contain http://localhost/. For example, if you're using Microsoft IIS, in most cases your mapping should be something like this:
Map From: C:\InetPub\wwwroot\Once this is configured, whenever you edit a file in c:\InetPub\wwwroot\, TopStyle will preview it using http://localhost/. Put simply, TopStyle replaces "c:\InetPub\wwwroot\" with "http://localhost/" in order to preview your file.
Map To: http://localhost/
If you're using TopStyle and are having a tough time with mappings, please take a few minutes to read the "Understanding Mappings" section in TopStyle's help file.
I'd like to add that you can use mappings for non-localhost servers as well.
I have several web servers on my network and I edit files directly on the server using TopStyle. I usually use UNC paths, but you could map a drive instead.
To set up a mapping for this environment:
Map From: \\servername\sharename\
Map To: http:servername
There are more chances for "gotchas" when working in this manner including network speed issues. If opening or saving files is sluggish, you should consider working with local files and copying changes up to your server instead.
Another option if you're working with remote servers (like an ISP) is to use an application such as WebDrive - http:www.webdrive.com - which allows you to map a drive letter to an FTP server. This gives you "local" file system access to your website and allows you to access files on your site from within TopStyle.
I haven't used WebDrive myself, but they provide a free trial if it's something you're interested in.
Posted by: Jack Brewster | Wednesday, April 28, 2004 at 12:37 PM
Nick, server mappings have certainly confused a lot of people over the years, in HomeSite as well as in TS. It's certainly been a FAQ in the HS-ASP discussions.
You say: "Perhaps the biggest stumbling block with mappings is the fact that they only work with a local web server (ie: http://localhost/). Since TopStyle's preview displays the file you're currently editing, mapping to an external web server won't work."
I understand this, but have been asked before, would it be feasible to get server mappings working with remote ftp editing? Then you are editing a file on the server, and viewing it at it's destination?
One other thing to note: 'local' has a little reach... if you have a drive mapping to where the files are stored, then you should be able to server-map to a url that is on another machine... right? (haven't tried it yet myself.) Some of the file access utils that let a server show up as a network drive might let you get away with this, even on a server that only accepts ftp... ?
Posted by: Jeff Wilkinson | Wednesday, April 28, 2004 at 04:04 PM
Figures... Jack Brewster posted the definitive details of what I was talking about... and somehow I missed it as I was posting... I *did* read the comments first, I swear! ;-) Thanks Jack. Good to have some of those details documented.
Posted by: Jeff Wilkinson | Wednesday, April 28, 2004 at 04:08 PM
This is one of the most indispensable features of Homesite as well. I often preview through a local server as well as through mapped network drives on a different server.
It still amazes me how so many otherwise great tools can't manage this simple-- and indispensable!-- feat...
Posted by: Chris L | Thursday, April 29, 2004 at 09:47 PM
I need this feature as well. Currently, the only way I can see results of my css changes is installing Mozilla Firefox with the "Edit CSS" sidebar. It works great, but now I have to use two tools simultaneously to get the job done.
Posted by: Divamissx | Sunday, May 02, 2004 at 11:48 AM