Have you been bothered by mixing your asp code with html tag, some times it just causes big mess, preparedHTML separates concerns about program code from concerns about the way a page looks:
1) HTML should not clutter up program code 2) Program code should not clutter up HTML 3) No-one should have to work through somebody else
| Here is the segment of the ASP code: <% dim html function readHTML(fileName) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile( filename) html1 = f.ReadAll f.Close readHTML=html1 end function
sub placeHolder(name,value) replaceString="<!--placeholder:"&name&"-->" post1=inStr(html,replaceString) if post1>0 then html=replace(html,replaceString,value) end if end sub
testpage=Server.MapPath("mypage.htm") html=readHTML(testpage) call placeHolder("myname","jeremy") %>
readHTML function just creates a file system object and returns all the content. placeHolder is used to replace the string with actually value on your static HTML page, your static HTML page (mypage.htm) should include code like this:
<a href='<!--placeholder:mylink-->'>Go.. </a>
mylink is variable you want to be replaced. |
|