template e replace

  • Creatore Discussione Creatore Discussione lab82
  • Data di inizio Data di inizio

lab82

Nuovo Utente
5 Mag 2007
2
0
0
Ciao, mi potete aiutarmi ad creare una classe per staccare il codice da html.

Il codice e questo:
<%
Class Template

Function GetFileHTML(pFile)
Dim fileObj
Set fileObj = CreateObject("Scripting.FileSystemObject")
fileObj.OpenTextFile(Server.MapPath(pFile))
End Function

function replace_tag(tags)
tags = Replace( tag, "<$" & key & "$>", tags )
End function
End class
%>
ed si usa cosi:
<!-- #include virtual ="/include/template.asp" -->
<%
Dim page : Set page = new Template
page.GetFileHTML("prova.html")
test = "ciao sono test"
page.replace_tag(tags)
%>

ed il file html(prova.html) e cosi:
<html>
<body>
<h2><$test$></h2>
</body>
</html>

Vorrei farlo in un array però non so come si usa.

mi potete aiutarmi?

Però a me non mi funziona .. non da nessun errore ma non stampa nulla come mai?

grazie.
 

Discussioni simili