AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=168&pId=-1
Using a Script Library
page
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 7965/ 14

Using a Script Library

Use a Script Library

 

Published 1/25/01

Why?

If you have something that you do often, on many pages (like open a database connection, display changing content on your pages etc.) then you should use a script library.

Eg. Let us say that your using the XML News thing from this article and you want to show this on a few pages. Ok, you'll use an include wherever you want to use it. Lets say that you also have a DB connection that you use frequently and you've added some tweaks to the XML News code so you can change what it displays. Now you may want to consider a script library.

How?

It's very simple, just create an ASP/ASP.NET page with a bunch of methods, like -

<%
Sub writemessage(message as String)
Response.Write(message & " Printed by your Script Library."
End Sub

Sub openDB()
'Open DB
End Sub

Sub QueryDB(qstring as String)
'Check for Connection
'Run Query
End Sub
%>

Then all you have to do is include it at the top of your ASP/ASP.NET file.

<!-- #include file="/scriptlib.asp" -->

 


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 5:35:21 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search