|
 |
asptoday_discuss thread: help with array constant
Message #1 by Dan Newman <pc@r...> on Thu, 13 Dec 2001 14:02:33 -0800
|
|
I am new to asp and am wondering how best to accomplish the following:
I want to create an array of page names in 4 different sections of a site.
The array is a constant -- does not ever need to change and is global, the
same for each user.
I was thinking I would create a multi-dimensional array and storing it in
the application object.
Make sense? Should I consider using a dictionary object? Or some other
approach?
THX
Message #2 by "Pat Sullivan" <PSullivan@m...> on Thu, 13 Dec 2001 16:55:07 -0600
|
|
Not sure if its the best way but you could just create the array
manually in the global, then store it to the session variables, or you
could just store a comma separated string as a session variable and then
have a function that splits the string into an array.
I would go with the second option, just seems easiest.
Say you have 3 sites in the "array"
strArray =3D "site1, site2, site3"
Session("strArray") =3D strArray
When you need to use it Use the slpit function to create the array
Function GetSites(site)
dim arrSites 'as array
dim site 'as the site you want, i.e number (1, 2, 3)
arrSites =3D split(Session("strArray"))
'this give you the array with three values:
'site1 =3D arrSites(0)
'site2 =3D arrSites(1)
'site3 =3D arrSites(2)
'notice that array position starts at 0
'but you just want the one, so
'you substract 1 from the passed variable, unless you pass 0 - 2
'to get the proper array value
response.write("<a href=3D" & arrSites(site-1) & ">" &
arrSites(site-1) & "</a>")
End Function
In your page
<%call GetSites(1)%>
Hope that may get you on your way...
Pat
=09
=09
-----Original Message-----
From: Dan Newman [mailto:pc@r...]
Sent: Thursday, December 13, 2001 4:03 PM
To: ASPToday Discuss
Subject: [asptoday_discuss] help with array constant
I am new to asp and am wondering how best to accomplish the following:
I want to create an array of page names in 4 different sections of a
site.
The array is a constant -- does not ever need to change and is global,
the
same for each user.
I was thinking I would create a multi-dimensional array and storing it
in
the application object.
Make sense? Should I consider using a dictionary object? Or some other
approach?
THX
Message #3 by Dan Newman <pc@r...> on Thu, 13 Dec 2001 15:07:01 -0800
|
|
Thanks for the response ...
What I am not clear on is why you wouldn't just create the array as an
application variable -- if it's the same for all users and never changes,
why make it a session? Aren't application variables accessible to all
pages/users?
I am new to asp -- so trying to get the lay of the land.
THX
> Not sure if its the best way but you could just create the array
> manually in the global, then store it to the session variables, or you
> could just store a comma separated string as a session variable and then
> have a function that splits the string into an array.
>
> I would go with the second option, just seems easiest.
>
> Say you have 3 sites in the "array"
> strArray = "site1, site2, site3"
> Session("strArray") = strArray
>
>
> When you need to use it Use the slpit function to create the array
> Function GetSites(site)
> dim arrSites 'as array
> dim site 'as the site you want, i.e number (1, 2, 3)
> arrSites = split(Session("strArray"))
> 'this give you the array with three values:
> 'site1 = arrSites(0)
> 'site2 = arrSites(1)
> 'site3 = arrSites(2)
> 'notice that array position starts at 0
> 'but you just want the one, so
> 'you substract 1 from the passed variable, unless you pass 0 - 2
> 'to get the proper array value
> response.write("<a href=" & arrSites(site-1) & ">" &
> arrSites(site-1) & "</a>")
> End Function
>
> In your page
>
> <%call GetSites(1)%>
>
> Hope that may get you on your way...
>
> Pat
>
>
>
> -----Original Message-----
> From: Dan Newman [mailto:pc@r...]
> Sent: Thursday, December 13, 2001 4:03 PM
> To: ASPToday Discuss
> Subject: [asptoday_discuss] help with array constant
>
>
> I am new to asp and am wondering how best to accomplish the following:
>
> I want to create an array of page names in 4 different sections of a
> site.
>
> The array is a constant -- does not ever need to change and is global,
> the
> same for each user.
>
> I was thinking I would create a multi-dimensional array and storing it
> in
> the application object.
>
> Make sense? Should I consider using a dictionary object? Or some other
> approach?
>
> THX
>
>
>
>
Message #4 by "Pat Sullivan" <PSullivan@m...> on Thu, 13 Dec 2001 17:06:54 -0600
|
|
Oh yeah...that's a better way to do it...sorry about that, I am just too
used to sessions...
Patrick Sullivan
mRex Data Services
120 South 6th Street
Suite 950
Minneapolis, MN 55402
psullivan@m...
-----Original Message-----
From: Dan Newman [mailto:pc@r...]
Sent: Thursday, December 13, 2001 5:07 PM
To: ASPToday Discuss
Subject: [asptoday_discuss] RE: help with array constant
Thanks for the response ...
What I am not clear on is why you wouldn't just create the array as an
application variable -- if it's the same for all users and never
changes,
why make it a session? Aren't application variables accessible to all
pages/users?
I am new to asp -- so trying to get the lay of the land.
THX
> Not sure if its the best way but you could just create the array
> manually in the global, then store it to the session variables, or you
> could just store a comma separated string as a session variable and
then
> have a function that splits the string into an array.
>
> I would go with the second option, just seems easiest.
>
> Say you have 3 sites in the "array"
> strArray =3D "site1, site2, site3"
> Session("strArray") =3D strArray
>
>
> When you need to use it Use the slpit function to create the array
> Function GetSites(site)
> dim arrSites 'as array
> dim site 'as the site you want, i.e number (1, 2, 3)
> arrSites =3D split(Session("strArray"))
> 'this give you the array with three values:
> 'site1 =3D arrSites(0)
> 'site2 =3D arrSites(1)
> 'site3 =3D arrSites(2)
> 'notice that array position starts at 0
> 'but you just want the one, so
> 'you substract 1 from the passed variable, unless you pass 0 - 2
> 'to get the proper array value
> response.write("<a href=3D" & arrSites(site-1) & ">" &
> arrSites(site-1) & "</a>")
> End Function
>
> In your page
>
> <%call GetSites(1)%>
>
> Hope that may get you on your way...
>
> Pat
>
>
>
> -----Original Message-----
> From: Dan Newman [mailto:pc@r...]
> Sent: Thursday, December 13, 2001 4:03 PM
> To: ASPToday Discuss
> Subject: [asptoday_discuss] help with array constant
>
>
> I am new to asp and am wondering how best to accomplish the following:
>
> I want to create an array of page names in 4 different sections of a
> site.
>
> The array is a constant -- does not ever need to change and is global,
> the
> same for each user.
>
> I was thinking I would create a multi-dimensional array and storing it
> in
> the application object.
>
> Make sense? Should I consider using a dictionary object? Or some other
> approach?
>
> THX
>
>
>
>
Message #5 by Dan Newman <pc@r...> on Thu, 13 Dec 2001 15:24:43 -0800
|
|
Cool -- then I'll give this a try unless somebody comes along and shouts
DICTIONARY! :)
----- Original Message -----
From: "Pat Sullivan" <PSullivan@m...>
To: "ASPToday Discuss" <asptoday_discuss@p...>
Sent: Thursday, December 13, 2001 3:06 PM
Subject: [asptoday_discuss] RE: help with array constant
> Oh yeah...that's a better way to do it...sorry about that, I am just too
> used to sessions...
>
> Patrick Sullivan
> mRex Data Services
> 120 South 6th Street
> Suite 950
> Minneapolis, MN 55402
> psullivan@m...
>
>
> -----Original Message-----
> From: Dan Newman [mailto:pc@r...]
> Sent: Thursday, December 13, 2001 5:07 PM
> To: ASPToday Discuss
> Subject: [asptoday_discuss] RE: help with array constant
>
>
> Thanks for the response ...
>
> What I am not clear on is why you wouldn't just create the array as an
> application variable -- if it's the same for all users and never
> changes,
> why make it a session? Aren't application variables accessible to all
> pages/users?
>
> I am new to asp -- so trying to get the lay of the land.
>
> THX
>
>
> > Not sure if its the best way but you could just create the array
> > manually in the global, then store it to the session variables, or you
> > could just store a comma separated string as a session variable and
> then
> > have a function that splits the string into an array.
> >
> > I would go with the second option, just seems easiest.
> >
> > Say you have 3 sites in the "array"
> > strArray = "site1, site2, site3"
> > Session("strArray") = strArray
> >
> >
> > When you need to use it Use the slpit function to create the array
> > Function GetSites(site)
> > dim arrSites 'as array
> > dim site 'as the site you want, i.e number (1, 2, 3)
> > arrSites = split(Session("strArray"))
> > 'this give you the array with three values:
> > 'site1 = arrSites(0)
> > 'site2 = arrSites(1)
> > 'site3 = arrSites(2)
> > 'notice that array position starts at 0
> > 'but you just want the one, so
> > 'you substract 1 from the passed variable, unless you pass 0 - 2
> > 'to get the proper array value
> > response.write("<a href=" & arrSites(site-1) & ">" &
> > arrSites(site-1) & "</a>")
> > End Function
> >
> > In your page
> >
> > <%call GetSites(1)%>
> >
> > Hope that may get you on your way...
> >
> > Pat
> >
> >
> >
> > -----Original Message-----
> > From: Dan Newman [mailto:pc@r...]
> > Sent: Thursday, December 13, 2001 4:03 PM
> > To: ASPToday Discuss
> > Subject: [asptoday_discuss] help with array constant
> >
> >
> > I am new to asp and am wondering how best to accomplish the following:
> >
> > I want to create an array of page names in 4 different sections of a
> > site.
> >
> > The array is a constant -- does not ever need to change and is global,
> > the
> > same for each user.
> >
> > I was thinking I would create a multi-dimensional array and storing it
> > in
> > the application object.
> >
> > Make sense? Should I consider using a dictionary object? Or some other
> > approach?
> >
> > THX
> >
> >
> >
> >
>
>
>
|
|
 |