[thelist] ASP and CASE

Warden, Matt mwarden at mattwarden.com
Tue Aug 7 13:39:11 CDT 2001


On Aug 7, aardvark had something to say about Re: [thelist] ASP and CASE

>> What do others do?  Is it "bad" practice to have smaller more compact
>> files?
>
>depends on the need... for some projects, you want only one script 
>as far as the user is concerned... for others, you want a dozen that 
>all do the same thing...
>
>generally, i'll build a large script and use Subs (instead of Case, no 
>reason why i prefer it, i just do)... those subsd often call includes...

Odd.

Actually, my subs are *in* includes. My pages will look something like
this:


<!--#include file="f_saveproduct.asp"-->
<!--#include file="f_deleteproduct.asp"-->
<!--#include file="f_viewproduct.asp"-->
<!--#include file="f_addproduct.asp"-->
<!--#include file="f_listproducts.asp-->
...

<%
sProductID = request("pid")


select case lcase(trim(request("action")))
	case "view"
		call viewproduct(sProductID)
	case "save"
		call saveproduct(sProductID)
	case "delete"
		...
	case else
		call listproducts()
end select
%>


The nice thing here is that i can easily reuse actions. Like on the
product category page where I need to delete a category. Referencial
Integrity (gee, wish I had an article to reference *cough* rudy
*cough*) forces me to delete the products in that category before
deleting the category itself (one example). This way, i can just include
that f_deleteproduct.asp file and call that to delete every product in
that category.

I'm tempted to mention fusebox.org, but I morally can't until they come
out with their ASP spec...


--
mattwarden
mattwarden.com





More information about the thelist mailing list