Hi,
I would like to make a database driven stylesheet incl. maintenance option
and I have a problem. The maintenance option works perfect. But the stylesheet
means SQL statement gives me some headaches.
The database contains a table named "tbl_colors". The layout of the table
"tbl_colors" see below.
tbl_colors
ColID ¦ CSSName ¦ ColCode ¦ Description
-----------------------------------------
1 ¦ SideNav ¦ 967E85 ¦ Navi left (nl)
2 ¦ TopNav ¦ B5A6AB ¦ Navi top (nt)
3 ¦ Head1 ¦ CCCC9A ¦ Header (h1)
etc. ¦ etc. ¦ etc. | etc.
The stylesheet is setup as follows:
+ ---- start style.inc --- +
[tt]
<%
'Dimension variables
Dim adoCon 'Database Connection Variable
Dim rsCode 'Holds the recordset
Dim strCon 'Holds the db driver, path and name of db
Dim strSQL 'Holds the SQL query for the database
dim strSideNav 'Font color SideNav
dim strTopNav 'Font color TopNav
dim strHead1 'Font color Header
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Connection String
strCon = "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("database/layout.mdb")
'Set an active connection to the Connection object
adoCon.Open strCon
'Intialise the ADO recordset object
Set rsCode = Server.CreateObject("ADODB.Recordset")
'SQL statement to get datas from the database
strSQL = "SELECT * FROM tbl_colors"
'Query the database
rsCode.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsCode.EOF Then
'Read in details from the recordset
strHead1 = rsCode("Head1")
strSideNav = rsCode("SideNav")
strTopNav = rsCode("TopNav")
End If
%>
<style>
h1 { color: #<% = strHead1 %>; }
a:hover.nl { color: #<% = strSideNav %>; }
a:hover.nt { color: #<% = strTopNav %>; }
</style>
%>
[/tt]
+ ---- end style.inc --- +
My problem:
How do I get the values of the column *ColCode" into the file style.inc. The only thing I get are values from column "CSSName". :-(( What do i have to do?
Thanks in advance for any solutions or alternative suggestions.
rgds Lupo
WEB Designer & WEB Developer (as per my working contract)
and
I would like to make a database driven stylesheet incl. maintenance option
and I have a problem. The maintenance option works perfect. But the stylesheet
means SQL statement gives me some headaches.
The database contains a table named "tbl_colors". The layout of the table
"tbl_colors" see below.
tbl_colors
ColID ¦ CSSName ¦ ColCode ¦ Description
-----------------------------------------
1 ¦ SideNav ¦ 967E85 ¦ Navi left (nl)
2 ¦ TopNav ¦ B5A6AB ¦ Navi top (nt)
3 ¦ Head1 ¦ CCCC9A ¦ Header (h1)
etc. ¦ etc. ¦ etc. | etc.
The stylesheet is setup as follows:
+ ---- start style.inc --- +
[tt]
<%
'Dimension variables
Dim adoCon 'Database Connection Variable
Dim rsCode 'Holds the recordset
Dim strCon 'Holds the db driver, path and name of db
Dim strSQL 'Holds the SQL query for the database
dim strSideNav 'Font color SideNav
dim strTopNav 'Font color TopNav
dim strHead1 'Font color Header
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Connection String
strCon = "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("database/layout.mdb")
'Set an active connection to the Connection object
adoCon.Open strCon
'Intialise the ADO recordset object
Set rsCode = Server.CreateObject("ADODB.Recordset")
'SQL statement to get datas from the database
strSQL = "SELECT * FROM tbl_colors"
'Query the database
rsCode.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsCode.EOF Then
'Read in details from the recordset
strHead1 = rsCode("Head1")
strSideNav = rsCode("SideNav")
strTopNav = rsCode("TopNav")
End If
%>
<style>
h1 { color: #<% = strHead1 %>; }
a:hover.nl { color: #<% = strSideNav %>; }
a:hover.nt { color: #<% = strTopNav %>; }
</style>
%>
[/tt]
+ ---- end style.inc --- +
My problem:
How do I get the values of the column *ColCode" into the file style.inc. The only thing I get are values from column "CSSName". :-(( What do i have to do?
Thanks in advance for any solutions or alternative suggestions.
rgds Lupo
WEB Designer & WEB Developer (as per my working contract)
![[wink] [wink] [wink]](/data/assets/smilies/wink.gif)
