Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database HTML Templates

Status
Not open for further replies.

brentnewbury

Programmer
May 1, 2001
30
GB
I am trying to make HTML (and some asp embeded with the HTML) templates that can are stored in a database and can be modified or selected and displayed. If any of you have used vBulletin before you will know what I am talking about.

Well here is what I have in my database:

<html>
<head>
<title>Members Login</title>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;centurion.css&quot;>
</head>
<body>
<center>
<form method=&quot;POST&quot; action=&quot;login.asp&quot;>

<table width=100% height=85% cellpadding=0 cellspacing=0 border=0>
<tr>
<td align=&quot;center&quot; valign=&quot;center&quot;>
<table width=50% cellpadding=5 cellspacing=0 border=0>
<tr>
<td height=40 align=&quot;center&quot; colspan=2>
<div class=&quot;error&quot;>
<% If Request.Cookies(&quot;FormError&quot;) <> &quot;&quot; Then %>
<div class=&quot;error&quot;>
<% Request.Cookies(&quot;FormError&quot;) %>
</div>
<% End If
If Request.Cookies(&quot;FormSuccess&quot;) <> &quot;&quot; Then %>
<div class=&quot;success&quot;>
<% Request.Cookies(&quot;FormSuccess&quot;)
End If %>
</div>
</td>
</tr>
<tr>
<td align=&quot;center&quot; valign=&quot;center&quot; colspan=2>
<div class=&quot;text&quot;>
<b>Please enter your username and password</b>
</td>
</tr>
<tr>
<td height=12>
</td>
</tr>
<tr>
<td align=&quot;right&quot; valign=&quot;center&quot;>
<div class=&quot;text&quot;>
Username:
</div>
</td>
<td width=55%>
<input type=&quot;text&quot; name=&quot;UserName&quot; Response.Write(value=&quot; & <% Request.Cookies('UserName') & &quot;) class=&quot;input&quot;>
</td>
</tr>
<tr>
<td align=&quot;right&quot;>
<div class=&quot;text&quot;>
Password:
</div>
</td>
<td>
<input type=&quot;password&quot; name=&quot;UserPassword&quot; class=&quot;input&quot;>
</td>
</tr>
<tr>
<td align=&quot;right&quot; height=10>
</td>
<td>
</td>
</tr>
<tr>
<td width=50% align=&quot;center&quot; colspan=2>
<input type=&quot;submit&quot; width=&quot;50&quot; name=Submit value=&quot;Login&quot; class=&quot;button&quot;>  
<input type=&quot;reset&quot; value=&quot;Reset&quot; class=&quot;button&quot;>
</td>
</tr>
<tr>
<td height=40 align=&quot;center&quot; valign=&quot;bottom&quot; colspan=2>
<div id=&quot;small&quot; class=&quot;text&quot;>
<a href=&quot;signup.asp&quot;>Want to be a member?</a>  |  <a href=&quot;send_password.asp&quot;>Forgot your login details?</a>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width=100% height=35 cellpadding=5 cellspacing=0 border=0>
<tr>
<td align=&quot;center&quot; valign=&quot;center&quot;>
<div class=&quot;navtext&quot;>
</div>
</td>
</tr>
</table>

<!-- #include file=&quot;copyright.asp&quot; -->

</form>
</center>
</body>
</html>




Here is the code that calls it:

'========== Get HTML Template From database ==========
SQLGetTemplate1 = &quot;SELECT * FROM TemplateTable WHERE TemplateID = 1&quot;
Set rsGetTemplate1 = Conn.Execute(SQLGetTemplate1)

'========== Display HTML Page ==========
Response.Write(rsGetTemplate1(&quot;Template&quot;))


The ASP embeded within the HTML is not working, so ASP doesn't realise it is being called.

If your first piece of advice would be to remove the &quot;&quot; chars in the HTML parts of the code and replace the '<%' with '&quot; &' and also '%>' with '& &quot;', then your wrong, I have tried this and it still doesn't work. I have tried many variations but they just don't work.


If any of you could make the embeded ASP work within the HTML then it will be a greate help.

Thank you very much,
Brent Newbury
 
U cannot use ASP code within an Response.Write cuz this code is not interpreted by the server, it is sended to the client as html code...
But u can create an page with that code and then redirect to that page...or just remove the asp part of your page from database and will be all ok... ________
George, M
 
Is there anyway I can achieve this task then... any other suggestions frm anyone. If not, I'm gona start using PHP again cuz you can do it in that.
 
Are u shure if u put any PHP code in an database an then put them to the broeser by ECHO or by PRINT is working, without any interpretations? ________
George, M
 
Yeah I'm cirtain. Hey look at vBulletin! They did it.

I wana do it in ASP
 
Here is what i've seen in another tool MyPhpAdmin, do the same thing, but all the template in the database is interpreted by the php page and inserts in the template what it needs. They read all the template and after that they seek in for the themplate words if is any they place the values and after that they print it out...

In asp it will be possible to...
or u could use the database to store just html part of the template. ________
George, M
 
On ideea coul be that u get the code from Database as u show the code above and then write it to an asp temporarry file and then Response.Redirect or Server.Transfer to that file, u could use Scripting.FileSystemObject to create the file ________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top