Wednesday, November 7, 2007

CSS Layout

Though I am a developer, programmer I like to design web pages. I like to create web pages which are browser independent, W3C compliant, easy to maintain and simple in design. I like that W3C validators yellow logo on my webpage.
I think its challenging to create a layout that is maintainable and flexible. The old approach of putting all contents in a big page wide table and adjusting TDs, fails to make design flexible.
CSS Layout is a supurb technique which make it possible to create liquid webpage designs. Basically HTML should always deal with WHAT TO DISPLAY? and CSS should deal with HOW TO DISPLAY? But because of some bad practices by some of the software giant companies, these standards were not followed and in order to make webpage development easier, table layouting option was tried alot. But now the webdevelopers have re-realised the need to go back to basics and try CSS layouting.
Actally its very simple and I would like to share a fantastic link here which deals with creating CSS layout from the scratch. Please remember that the technique shared here is not the only way to create CSS layout but its enough to give an idea of how the whole CSS layouting is done.
Please click here to open above mentioned tutorial in a new window.

I hope this helps you in creating fantastic liquid CSS layouts in future.

Tuesday, November 6, 2007

ASP : Easy way to connect to database on every page

This is the simplest way to connect to database on every page in ASP.
An include file should be created having following code :

<script language="VBScript" runat="Server">


' Global variables
dim cn ' Connection Object
dim rs ' RecordSet Object
dim rs1,rs2,rs3


sub openCN

set cn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
set rs1 = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
set rs3 = Server.CreateObject("ADODB.Recordset")


cn.OPEN "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("yourdatabasename.mdb") & ";"

'cn.OPEN "SERVER=ipaddressofyourserver;DRIVER={SQL Server};DATABASE=databasename;UID=username;pwd=password;"

end sub

sub closeCN
'close the connection
cn.Close
set rs = Nothing
set rs1 = Nothing
set rs2 = Nothing
set cn = Nothing
end sub

</script>


Now this include file can be included in each ASP page where database access is required. Don't forget to call openCN subroutine.