ASP Nuke
>
Member Login
Username
Password

Don't have an account yet, register now it's free!
I forgot my password


Article Search

Message Forums
ASP Nuke  (221/420)
ASP Development  (12/22)
SQL Server Development  (5/12)

Suggestion Box

Have a suggestion on how we can improve this application?

Please send us your suggestions, we would love to hear what you have to say!


Help ASP Nuke

Help support "ASP Nuke" and free software by donating now


Task List

ASP Nuke Tasks:


Site Library

Orvado Technologies

Introduction

The site library contains all of the common functions that are used on all of the pages on the site. These "global" functions may be used on any page on the site. All pages must include the site library using a call to:

<!-- #include virtual="/lib/site_lib.asp" -->

This library will include the database library for you (ado_lib.asp) In most cases, this will be the only file you will include containing strictly code.

steForm (function)

Retrieve the value of a querystring or form variable. The querystring is checked first, and if a value is found there, it is returned. Otherwise, the form collection is checked for the value. This is equivalent to:

If Request.QueryString(sName) <> "" Then
sValue = Request.QueryString(sName)
Else
sValue = Request.Form(sName)
End If

Parameters

sName
Name of the form variable to retrieve

Returns

String containing the value of the querystring or form variable.

steNForm (function)

Retrieve the value of a querystring or form variable and convert it to an integer value. If a numeric value cannot be deciphered from the form data, a value of 0 (zero) is returned.

Parameters

sName
Name of the form variable to retrieve

Returns

Integer parsed from the value of the querystring or form variable.

steEncForm (function)

Retrieve the value of a querystring or form variable and perform an HTML encoding on it. HTML encoding is used to escape special HTML characters such as "less than" (<) and "greater than" (>) so that text can be shown on a web page properly.

Parameters

sName
Name of the form variable to retrieve

Returns

HTML-encoded string from the value of the querystring or form variable.

steRecordValue (function)

Retrieve a value from the recordset object if the recordset is not empty and the field exists, otherwise, grab the form or querystring value.

This function (and steRecordEncValue) are extremely useful for building web forms. It allows you to pull a value from a recordset and display it on the page. This function is used extensively on the ASP Nuke site.

Parameters

rs
ADODB.Recordset object containing the field
sField
Name of the field which holds the value

Returns

A field value from the ADODB.Recordset parameter or the querystring/form collection.

steNRecordValue (function)

Retrieve a value from the database and convert it to an integer. This method is rarely (if ever) used because most fields that are required to be an integer will be defined as such in the database schema.

This may be used to eliminate null values from a field since it will convert null values to the integer value 0 (zero.)

Parameters

rs
ADODB.Recordset object containing the field
sField
Name of the field which holds the value

Returns

A field value from the ADODB.Recordset parameter or the querystring/form collection converted to an integer.

steRecordEncValue (function)

Retrieve a value from the database with HTML-encoding for placement within a form element such as a TEXT or TEXTAREA input element. If the field value is null, this function will convert the value to the empty string.

Parameters

rs
ADODB.Recordset object containing the field to encode
sField
Name of the field that we want to retrieve

Returns

HTML-encoded field value from the ADODB.Recordset object or the querystring/form collection.

steDateValue (function)

Returns a formatted date value from the database using the vbGeneralDate format. If a valid date is not found (like when the value is null,) the function will return a value of n/a. This allows you to do a safe date format

Parameters

rs
ADODB.Recordset object containing the date field
sField
Name of the database field containing the date to format

Returns

Formatted date value from the ADODB.Recordset object or n/a if the value is NULL.

steStripHTML

Strip out all HTML from the content parameter (passed by reference) and strip out any unnecessary whitespace. This does an "intelligent" stripping of the HTML tags defined by the HTML 4.0 specification.

For certain block-level elements like HTML comments and SCRIPT blocks, all enclosed content will be stripped as well. Other block level elements like TABLE will try to preserve any content between the open and close tags.

This will strip the leading and trailing whitespace and also replace more than two repeated blank lines (containing only whitespace and a carriage return) with two line breaks.

Uses the Regular Expression object provided in IIS 5.0 for efficiencies sake.

Parameters

sContent (ByRef)
Text to be stripped of HTML and whitespace

Returns

String containing the cleaned content.

Summary

The goal with the site_lib.asp library is to define only the most generic functions that are used throughout the site for basic functionality. It also includes all other common include files (currently only ado_lib.asp) that are needed.

Make sure all of your main scripts (everything except module code) always include site_lib. Try to avoid using Request.Form and Request.QueryString for anything except basic text values.

Last Updated: Sep 29, 2003

FAQ

Web Links
Download
Sponsors

Poll

What's Your Favorite Browser?

Mozilla Firefox
Internet Explorer
Netscape
Safari
Opera
Other

View Results . Archive


Other Languages

Join the language translation project  to translate ASP Nuke into other languages


Hit Counter
Total page views since
Sept 19, 2003

695229

Valid CSS!
Valid HTML 4.01!

   Damn the torpedoes! Full speed ahead! -- David G. Farragut   
© 2002 Orvado Technologies, All Rights Reserved - Site Map - CSS - HTML - 15.6250 msec