Site icon Nick Bradbury

Understanding TopStyle’s Preview Mappings

“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\
Map To: http://localhost/

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.

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.

Exit mobile version