Server-side includes (IIS 5, classic VBScript)

Server-side includes (IIS 5, classic VBScript)

am 25.10.2005 15:32:59 von MyndPhlyp

I am building up a library of Class'es that represent various columns of
table layouts. One often used column is "name" and each occurrence is
treated identically. (What a concept, eh?)

Part of that library of Class'es includes representations of various tables.
(Just let me know if you see a trend going on here.) These Class'es use the
column Class'es.

What I would like to do, but I have yet to find a way around duplicated
names, is to place all the necessary supporting column Class #include's in
the table's Class so that I need only place the table's Class in the module
utilizing them.

I understand entirely why the "duplicate name" error occurs.

What I am looking for is a way around the conundrum that does not require
duplication of code. Any ideas?

Re: Server-side includes (IIS 5, classic VBScript)

am 25.10.2005 16:52:58 von unknown

I didn't fully follow your explanation here, but try declaring your
variables in a narrower scope in your classes. Don't just dim everything
out in the open. Encapsulate logic into subroutines and functions, and use
local variables within them.

Ray at work

"MyndPhlyp" wrote in message
news:udgveiW2FHA.2444@TK2MSFTNGP10.phx.gbl...
>I am building up a library of Class'es that represent various columns of
> table layouts. One often used column is "name" and each occurrence is
> treated identically. (What a concept, eh?)
>
> Part of that library of Class'es includes representations of various
> tables.
> (Just let me know if you see a trend going on here.) These Class'es use
> the
> column Class'es.
>
> What I would like to do, but I have yet to find a way around duplicated
> names, is to place all the necessary supporting column Class #include's in
> the table's Class so that I need only place the table's Class in the
> module
> utilizing them.
>
> I understand entirely why the "duplicate name" error occurs.
>
> What I am looking for is a way around the conundrum that does not require
> duplication of code. Any ideas?
>
>

Re: Server-side includes (IIS 5, classic VBScript)

am 25.10.2005 17:12:24 von MyndPhlyp

"Ray Costanzo [MVP]" wrote in
message news:OMWNLPX2FHA.2604@TK2MSFTNGP12.phx.gbl...
> I didn't fully follow your explanation here, but try declaring your
> variables in a narrower scope in your classes. Don't just dim everything
> out in the open. Encapsulate logic into subroutines and functions, and
use
> local variables within them.

Thanks Ray, but I'm already doing that.

Just to be a bit more specific about the problem, the "duplicate name"
errors refer to the Class names.

Consider this scenario ...

One record layout describes a Company. The Company record has a column
(Property) called Name among other things.

Another record layout describes a Person. The Person record has columns
(Properties) called FName, MName, and LName.

All 4 name fields are of a Class clName.

The Class library looks something like:

Class clCompany
(uses clName for 1 property)

Class clPerson
(uses clName for 3 properties)

In the ASP using the Company and Person Class'es I am forced to do something
like:

(Main ASP file)
<#include file="clName.asp">
<#include file="clCompany.asp">
<#include file="clPerson.asp">

What I would rather do is pull the column #include out of the main ASP and
instead place it in the Class'es that require it. That would leave me with
something like this:

(Main ASP file)
<#include file="clCompany.asp">
<#include file="clPerson.asp">

(clCompany Class file)
<#include file="clName.asp">

(clPerson Class file)
<#include file="clName.asp">

But that will cause a VBScript error because the Class name in "clName.asp"
is redefined (duplicated).

Is there a way to gracefully get around this?

Re: Server-side includes (IIS 5, classic VBScript)

am 25.10.2005 18:59:00 von Patrice

AFAIK no as includes are processed even before ASP gets in play. I would
just keep the first design.

More specifically my personal preference in ASP was to do something like :
- to have my main file (ASP page)
- this main file includes a "coordination file"
- this "coordination file" includes in turns all other needed files
- eventually I could create another "coordination file" to include less
files if the number is growing and I really use much less than included

Finally it could give something like :
include virtual="/include/all.asp" in my main file

<#include file="clName.asp">
<#include file="clCompany.asp">
<#include file="clPerson.asp">
in "all.asp" for a start...

--
Patrice

"MyndPhlyp" a écrit dans le message de
news:uYqcCaX2FHA.472@TK2MSFTNGP15.phx.gbl...
>
> "Ray Costanzo [MVP]" wrote in
> message news:OMWNLPX2FHA.2604@TK2MSFTNGP12.phx.gbl...
> > I didn't fully follow your explanation here, but try declaring your
> > variables in a narrower scope in your classes. Don't just dim
everything
> > out in the open. Encapsulate logic into subroutines and functions, and
> use
> > local variables within them.
>
> Thanks Ray, but I'm already doing that.
>
> Just to be a bit more specific about the problem, the "duplicate name"
> errors refer to the Class names.
>
> Consider this scenario ...
>
> One record layout describes a Company. The Company record has a column
> (Property) called Name among other things.
>
> Another record layout describes a Person. The Person record has columns
> (Properties) called FName, MName, and LName.
>
> All 4 name fields are of a Class clName.
>
> The Class library looks something like:
>
> Class clCompany
> (uses clName for 1 property)
>
> Class clPerson
> (uses clName for 3 properties)
>
> In the ASP using the Company and Person Class'es I am forced to do
something
> like:
>
> (Main ASP file)
> <#include file="clName.asp">
> <#include file="clCompany.asp">
> <#include file="clPerson.asp">
>
> What I would rather do is pull the column #include out of the main ASP and
> instead place it in the Class'es that require it. That would leave me with
> something like this:
>
> (Main ASP file)
> <#include file="clCompany.asp">
> <#include file="clPerson.asp">
>
> (clCompany Class file)
> <#include file="clName.asp">
>
> (clPerson Class file)
> <#include file="clName.asp">
>
> But that will cause a VBScript error because the Class name in
"clName.asp"
> is redefined (duplicated).
>
> Is there a way to gracefully get around this?
>
>

Re: Server-side includes (IIS 5, classic VBScript)

am 25.10.2005 19:30:48 von MyndPhlyp

"Patrice" wrote in message
news:ezT3nVY2FHA.1188@TK2MSFTNGP12.phx.gbl...
> AFAIK no as includes are processed even before ASP gets in play. I would
> just keep the first design.
>
> More specifically my personal preference in ASP was to do something like :
> - to have my main file (ASP page)
> - this main file includes a "coordination file"
> - this "coordination file" includes in turns all other needed files
> - eventually I could create another "coordination file" to include less
> files if the number is growing and I really use much less than included
>
> Finally it could give something like :
> include virtual="/include/all.asp" in my main file
>
> <#include file="clName.asp">
> <#include file="clCompany.asp">
> <#include file="clPerson.asp">
> in "all.asp" for a start...

I started going down that path - including all the classes in a common ASP
and then including the common ASP into the true ASP - but started
considering the amount of overhead involved in loading up all the extraneous
code.

Google'ing around, this subject seems to be an unresolved problem with
respect to classes and I may have to continue down the original path of
including all the record layout and column definition Class'es in each ASP.

If I could define a Class within a Class it would solve the problem because
I could "temporarily" escape out of the record's Class (%>) to fire off the
#include for the column's generic Class and then unescape back into the
script (<%). That would allow the column Class'es to be unique to the
record's Class.

I guess I am just pushing the envelope a tad bit too far.

Re: Server-side includes (IIS 5, classic VBScript)

am 26.10.2005 10:04:55 von Patrice

Yes includes lacks for example some preprocessing capabilities.

I would just create here an alternate to the "all" file that includes only a
subset of the modules hat is enough for several pages. Also try perhaps to
see if this really causes a problem to see if it's worth...

Another approach could be perhaps to keep a single list (ie. you include all
you need in each page from a "model" list with dependencies comments) and
you just "comment" the parts you don't need...

Solved in ASP.NET ;-)
--
Patrice

"MyndPhlyp" a écrit dans le message de
news:%23CENYnY2FHA.2444@TK2MSFTNGP10.phx.gbl...
>
> "Patrice" wrote in message
> news:ezT3nVY2FHA.1188@TK2MSFTNGP12.phx.gbl...
> > AFAIK no as includes are processed even before ASP gets in play. I would
> > just keep the first design.
> >
> > More specifically my personal preference in ASP was to do something like
:
> > - to have my main file (ASP page)
> > - this main file includes a "coordination file"
> > - this "coordination file" includes in turns all other needed files
> > - eventually I could create another "coordination file" to include less
> > files if the number is growing and I really use much less than included
> >
> > Finally it could give something like :
> > include virtual="/include/all.asp" in my main file
> >
> > <#include file="clName.asp">
> > <#include file="clCompany.asp">
> > <#include file="clPerson.asp">
> > in "all.asp" for a start...
>
> I started going down that path - including all the classes in a common ASP
> and then including the common ASP into the true ASP - but started
> considering the amount of overhead involved in loading up all the
extraneous
> code.
>
> Google'ing around, this subject seems to be an unresolved problem with
> respect to classes and I may have to continue down the original path of
> including all the record layout and column definition Class'es in each
ASP.
>
> If I could define a Class within a Class it would solve the problem
because
> I could "temporarily" escape out of the record's Class (%>) to fire off
the
> #include for the column's generic Class and then unescape back into the
> script (<%). That would allow the column Class'es to be unique to the
> record's Class.
>
> I guess I am just pushing the envelope a tad bit too far.
>
>

Re: Server-side includes (IIS 5, classic VBScript)

am 26.10.2005 11:41:49 von MyndPhlyp

"Patrice" wrote in message
news:uzVa1Pg2FHA.3964@TK2MSFTNGP10.phx.gbl...
> Yes includes lacks for example some preprocessing capabilities.
>
> I would just create here an alternate to the "all" file that includes only
a
> subset of the modules hat is enough for several pages. Also try perhaps to
> see if this really causes a problem to see if it's worth...
>
> Another approach could be perhaps to keep a single list (ie. you include
all
> you need in each page from a "model" list with dependencies comments) and
> you just "comment" the parts you don't need...
>
> Solved in ASP.NET ;-)

Ah, but the rules say we must play the cards we were dealt. ASP.NET violates
the rules in this rather warped game. I have already resigned myself to
listing all the needed Class'es in each main ASP and documented the required
#include's at the beginning of each record layout Class. It simplifies thing
just a bit but still lacks grace.

Another nice approach, if IIS and VBScript were structured just a little
different, would have been to "include" all the Class'es once in something
like a Global.asa (actually, a more suitable library of sorts) and then be
able to utilize those Class'es simply by reference in the rest of the
application. Of course, if that were possible, I would also want my GDE to
be aware of those add-on Class'es and provide me with hints (and error
alerts) as the code gets developed maybe even going as far as something
Borland did with their Java GDE. (It would also provide the comments in the
hint if function-level comments existed.)

The dreaming eventually ends and we return to our regularly scheduled
nightmare.

Thanks for sharing your ideas though. Maybe I will be fortunate enough to
dig into ASP.NET before it becomes obsolete ... or maybe I will just wait it
out until the next new thing.

Re: Server-side includes (IIS 5, classic VBScript)

am 27.10.2005 04:28:37 von Chris Hohmann

"MyndPhlyp" wrote in message
news:udgveiW2FHA.2444@TK2MSFTNGP10.phx.gbl...
>I am building up a library of Class'es that represent various columns of
> table layouts. One often used column is "name" and each occurrence is
> treated identically. (What a concept, eh?)
>
> Part of that library of Class'es includes representations of various
> tables.
> (Just let me know if you see a trend going on here.) These Class'es use
> the
> column Class'es.
>
> What I would like to do, but I have yet to find a way around duplicated
> names, is to place all the necessary supporting column Class #include's in
> the table's Class so that I need only place the table's Class in the
> module
> utilizing them.
>
> I understand entirely why the "duplicate name" error occurs.
>
> What I am looking for is a way around the conundrum that does not require
> duplication of code. Any ideas?
>

You could do it with JScript. Here's a proof of concept that demonstrates
redeclaration of the clName class/object:




Notes:
1. You can still use VBScript for the rest of your programming, only your
classes would need to be written in JScript.
2. JScript also supports a much more robust object implementation which
includes functions-as-values, reflection, prototyping, nesting, etc...


--
May you be touched by His noodly appendage. RAmen.
http://venganza.org

Re: Server-Side Includes

am 17.12.2007 15:24:58 von Dooza

> Something's wrong with this newsgroup. The page which lists all the
> posts says that there are 3 threads in this post & that Bob & Andrews
> have answered my post but I don't find Andrew's response anywhere!!

Using Thunderbird as my newsreader I see a reply from Bob Barrows and
Anthony Jones, but no Andrews.

Steve