David DeLoveh came across an ASP 3.0 developed by some programmers with decent intentions: make the site easier to maintain by separating the VBScript code from the HTML. They figured that things like <%=OrderTotal%> embedded in HTML would confuse web designers who may want to update the site. So, they developed a system that would read files from disk, process them, and write the contents out. They even came up with their own tag system that would be sure not to confuse a designer: instead of the complex <%=OrderTotal%> designers would use @@ORDERTOTAL@@.
It worked out all well and good until people actually used the site. As it turns out, ASP isn't really designed to implement itself. It tends to slow down when reading lots of files from disk, storing the content in variables, doing multiple replacements, and writing out the content ...
Const cstpg_SHOW_DISCOUNT = "e:\content\estore\shopping_cart\show_discount.html" Dim v_Content Dim v_OrderNumber, v_OrderFinal, v_OrderSum, v_OrderInit, v_OrderRec 'ED: Snipped loading from databsae v_Content = CreateObject("Scripting.FileSystemObject").OpenTextFile (cstpg_SHOW_DISCOUNT, 1, False, False).ReadAll v_Content = Replace(v_Content, "@@ORDERFINAL@@", FormatNumber(v_OrderFinal)) v_Content = Replace(v_Content, "@@ORDERSUM@@", FormatNumber(v_OrderSum)) v_Content = Replace(v_Content, "@@ORDERINIT@@", FormatNumber(v_OrderInit)) v_Content = Replace(v_Content, "@@ORDERREC@@", FormatNumber(v_OrderRec)) Response.Write v_Content