Print Page | Close Window

mode or case or text

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=8491
Printed Date: 01 April 2026 at 7:19am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: mode or case or text
Posted By: aero
Subject: mode or case or text
Date Posted: 01 January 2004 at 8:23pm

Hi

I want 2 make a newsscript where the newsmaker.asp, newslist.asp, newsupdate.asp, newsdelete.asp is on one single site.

I dont know how i shut make it but knows that the links can be showet as this:

http://www.xxxxxxx.dk/test.asp?mode=opret - DOMANE/test.asp?mode=newsmaker
http://www.xxxxxxxx.dk/test.asp?mode=newslist - DOMANE/test.asp?mode=newslist  
and so on.

and If i just will see a single record then the link can look like this:

http://www.xxxxxxxx.dk/test.asp?mode=singlenews&UID=3 - DOMANE/test.asp?mode=singlenews&UID=3

but how do I make the code !?? can it be make like this:

MY HTML,HEAD AND SOME BODY CODE......Then the TD where the things shut be showet.
<%
dim mode
mode = request.querystring("mode")
if len(mode)=0 then
  mode=newslist
else
  mode=cint(mode)
end if
if mode=newslist then
%>

MY NEWSLIST CODE AND SQL

<%
end if
if mode=newsmaker then
%>

MY NEWSMAKER CODE AND SQL AND SAVE CODE FOR THE RECORDES

<%
end if
if mode=singlenews then
%>

MY SINGLENEWS CODE THAT SHOW A SINGLE RECORDS FROM THE DB.

<%
end if
%>

MY /BODY AND /HTML CODE FOR THE END OF MY SITE.

 

is it so or what !??  can someone help me and maybe show me a code for it or an usefull toturials for it !??

sorry my english and HAPPY NEWYEAR !!




Replies:
Posted By: michael
Date Posted: 01 January 2004 at 8:40pm
Not sure why you would wanna do it like that but i would use Case statements like

<%
Select case Request.QueryString("mode")
 CASE "newsmaker"
        'yourcodehere
 CASE "newslist"
        'newslist code here
......
  CASE Else
       'There is no querystring or unrecognized so do what you gotta do
END SELECT
%>

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: aero
Date Posted: 01 January 2004 at 9:03pm

why are U not sure why I would do it like that !???

 



Posted By: TYSON
Date Posted: 01 January 2004 at 11:06pm
Case satements are so much cleaner and easier to manage than a huge IF ..Then block of code.

-------------
http://www.fuo-motorsports.com/ - http://www.fuo-motorsports.com/


Posted By: dpyers
Date Posted: 02 January 2004 at 12:00am

Originally posted by TYSON TYSON wrote:

Case satements are so much cleaner and easier to manage than a huge IF ..Then block of code.

run faster too



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: aero
Date Posted: 02 January 2004 at 12:26am
Thanks !!


Posted By: michael
Date Posted: 02 January 2004 at 9:57am
Originally posted by aero aero wrote:

why are U not sure why I would do it like that !???

 

The reason I am saying that is that I see so many people trying to cramp a whole project into one page, thus it usually being failry unnecessary.



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net