Entries Tagged as 'VBScript'

Continuing with Virtual Directories Continuing with Virtual Directories Continuing with Virtual Directories

Continuing on from my post yesterday regarding virtual directories, another nifty tip is that when including files in ASP, you can use either a file or virtual include. Here are two examples:

<!-- #include file="mydirectory/somefile.asp" -->
<!-- #include virtual="/mydirectory/somefile.asp" -->

The first include would pull the file "somefile.asp" off of the disk in the mydirectory folder. The second include would first look for a virtual directory called mydirectory. If it finds it, it loads somefile.asp from that virtual directory. If it doesn't find it, it would then load somefile.asp from the physical mydirectory on disk, just like the first include.

That's it for virtual directory fun for now :).

Discovery of the Day Discovery of the Day Discovery of the Day

I'm a big fan of virtual directories. I like sharing assets across sites without having to duplicate a bunch of folders. Angela and I were doing some planning for a site and she asked if you created a Virtual Directory in IIS, what would happen if you also had a physical directory of the same name. Well it turns out that if you have a Virtual Directory defined in IIS, the server will completely ignore the contents of any physical directory in the same location. So if you had this:

assets
wwwroot
|--myassets (virtual directory pointing to assets above root)
|--myassets (physical directory on the disk)

Then all files and folders in the physical myassets folder will be completely ignored.

IISAdmin to the Rescue IISAdmin to the Rescue IISAdmin to the Rescue

I've always gone through the trouble of setting up a separate full-blown Windows 2003 Server here in my office for doing development work. The reason being that I didn't want to test on the production server, deal with FTP lags when uploading constantly changed files, and I like to keep my sites clean. I don't like testing in a base wwwroot directory and either setting up tons of subfolders or constantly clearing the wwwroot directory to get a site in the root.

I mentioned IISAdmin a while back, but never actually got it installed and working. Well I wiped my machine yesterday and got rid of a bad Media Center installation and went back to standard XP. I installed IIS and then installed CF5, CFMX 6.1, and CFMX7. I set up a separate site for each, and I can then use IISAdmin to easily switch sites to test in the right server. Awesome little tool, and the perfect price, free

Basecamp on KISS Basecamp on KISS Basecamp on KISS

Business Week has a great interview with one of the owners of 37Signals on their design philosophy and why it's a good idea to keep things simple.

Transforming XML Server-Side Transforming XML Server-Side Transforming XML Server-Side

Angela and I gave a presentation to the Mid-Michigan CFUG yesterday (well actually Angela gave the presentation, and I just showed some XSL stuff), and I showed everyone how to use the new XSLT visual authoring tools in Dreamweaver 8. They're great and wonderful and everything, but they're really geared towards working with local XML files. The reason I say that, is that Macromedia doesn't offer any solutions for transforming a remote XML file. They allow you to write an XSLT file to transform that remote content, but they don't tell you how to actually pull a little Optimus Prime on it and make that XML human readable.

So, I thought I'd share some code to make this happen. It's ridiculously simply once you see it, but I've run into quite a few people that just haven't been able to put all of the pieces together. So, here's some ColdFusion code to grab MM's DesDev feed and transform it using an XSL file on your own server:

<cfsilent>
  <cfhttp url="http://weblogs.macromedia.com/dev_center/index.rdf" method="get" />
  <cfset xmlObj = XMLParse(cfhttp.FileContent) />
  <cfset xslPath = ExpandPath("mmdesdev.xsl") />
  <cffile action="read" variable="xsl" file="#xslPath#" />
</cfsilent>
<cfoutput>#XMLTransform(xmlObj, xsl)#</cfoutput>

Yep, believe it or not, that's all that it takes. You just read in the XML file from the server somewhere out there in internet land, convert it to an XML Object using XMLParse, and then read the XSL file from the server, and transform it all using the XMLTransform function. Can I say I love ColdFusion? Here's the same work done with ASP:

<% 
Dim xmlDocument, xslDocument 
set xmlDocument = Server.CreateObject("MSXML2.DOMDocument.4.0") 
set xslDocument = Server.CreateObject("MSXML2.DOMDocument.4.0") 

xmlDocument.async = false 
xmlDocument.setProperty "ServerHTTPRequest", true 
xmlDocument.load("http://weblogs.macromedia.com/dev_center/index.rdf") 

xslDocument.async = false 
xslDocument.load(Server.MapPath("mm.xsl")) 

Response.Write xmlDocument.transformNode(xslDocument.documentElement) 
%>
Powered by Mango Blog.