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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP in CSS 1

Status
Not open for further replies.

GoPo

Technical User
Dec 9, 2003
11
0
0
BE

Does anyone know how I can get db information in a CSS sheet ?


Thanks
 
Hi GoPo, not sure if you can do this... i've never heard of it.
Depending on what you wish to acheive then perhaps you could have several stylesheets and incude them dynaically according to data pulled from the database?

If you do find a way to do this please post.

Thanks

Pete
 
I think GoPo is trying to pull data from a database into a CSS formatted page. Right?


logo.gif width='75' height='15'

bath.gif
 
I want to put db information into a CSS style sheet(.css) and then I'm going to format a page.
 
Well you would have to save it as an .asp page and then include it into the main page
<%
connStr=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & server.mappath(&quot;database.mdb&quot;) & &quot;;Jet OLEDB:Database Password=&quot;
set rs=server.createobject(&quot;adodb.recordset&quot;)
rs.open &quot;select * from cssstylestable&quot;,connStr
%>

<style type=text/css>
a.nav {color : <%=rs(&quot;anavfield&quot;)%>;font-family: <%=rs(&quot;fontfield&quot;)%>}
</style>
<%
rs.close
set rs=nothing
%>

and so on for all the styles...


 
I agree with GaryC123. It's just text, and text is data, so assuming you have some means of saving the formatting settings to the database (like a user customization screen of some kind) you just load those things dynamically into a embedded stylesheet.
 
You don't need to embed your CSS in the HTML, I have written an app where I use the tag
Code:
<LINK REL=&quot;stylesheet&quot; TYPE=&quot;text/css&quot; HREF=&quot;../style/style.asp&quot; />
to include a dynamically created stylesheet...

This is not a bug - it's an undocumented feature...
;-)
 
I'm using
<!--#INCLUDE file=&quot;../script/CSS.inc&quot; -->

as my style sheet and it works :D

Thanks evryone for your help.
Pieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top