[thelist] Response.Write versus varHTML = varHTML & "..."

Howard Cheng howcheng at ix.netcom.com
Fri Jan 11 11:38:40 CST 2002


I'll have to concur with Joshua Olson in that it's usually easier to do all 
your queries and server-side calculations before you output the HTML, 
storing any results of said calculations into variables and just printing 
those variables at the end. Or at least as much as possible at any rate. 
Certainly sometimes you need dynamic branching in your HTML, but you can 
always have the values ready ahead of time and do function calls with those 
values.

So something like:

[%
' Query code here

Var1 = RS("field")

Sub MySub(Var1)
         Select Case Var1
                 Case "blah"
                         ' code
                 Case "yada"
                         ' code
                 Case Else
                         ' code
         End Select
End Sub

%]
[html]
[body]
[% MySub(Var1) %]
[/body]
[/html]

Make sense?

At 11:52 PM 1/10/2002 -0800, Anthony Baratta wrote:
>e.g. You want to toss a Message to the user near the top of the page of 
>how many rows returned. But the row counter and HTML created from the DB 
>data are now being calculated and outputted "after" that area of the page 
>has already been sent off to the browser. It forces you to go to the DB 
>more often than you were previously planning and break up functions that 
>IMvHO should be related blocks of code since they share the same source of 
>data or related logic. Granted, based upon the speed increase this extra 
>trip does not subtract from the performance greatly - but it feels so unclean.


::::::::::::::::::::::
Howard Cheng
howcheng at ix.netcom.com
AIM: bennyphoebe
ICQ: 47319315





More information about the thelist mailing list