Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 setting a variable
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 10 November 2001 :  12:19:02  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message

For Each varItem in Application.Contents
if (left(varItem, 5) = "strGC") then
Response.Write varItem & ": " & Application.Contents(varItem) & "<br>"
end if
Next


Ok the above code works. I do not think what I want to do is possible, but I want to just make sure. When I grab varItem it have the same for example strGCImageURL. I want to be able to specify to store the Application.Contents in the variable strGCImageURL so that in the asp code I can call out <img src="<%=strGCImageURL%>blank.gif" border="0">

Can anyone think of a way? If you dont understand let me know and I will give an example.

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive

paco
Junior Member

Spain
187 Posts

Posted - 12 November 2001 :  04:06:51  Show Profile
quote:
If you dont understand let me know and I will give an example.


Please.

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 12 November 2001 :  06:09:39  Show Profile  Visit Gremlin's Homepage
Not quite sure what your trying to do as well.

The code you have there is for displaying a 'filtered' view of the Application Variables. Take a look at config.asp its a good example of Application variable useage in Snitz.

Halo of Xegony
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 12 November 2001 :  11:03:04  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
Ok basically I have a bunch of info stored in variables just like snitz does. When it is time to reload the application variables i dont want to have to type in 100 lines of different variable loading. For example....


strGCName = Application("strGCName")
strGCNameRequired = Application("strGCNameRequired")
strGCEmail = Application("strGCEmail")
strGCEmailRequired = Application("strGCEmailRequired")
strGCDateAdded = Application("strGCDateAdded")
strGCIPAddress = Application("strGCIPAddress")
strGCCity = Application("strGCCity")
strGCCityRequired = Application("strGCCityRequired")
strGCCountry = Application("strGCCountry")
strGCCountryRequired = Application("strGCCountryRequired")
strGCHomePage = Application("strGCHomePage")
strGCHomePageRequired = Application("strGCHomePageRequired")
strGCComments = Application("strGCComments")
strGCCommentsRequired = Application("strGCCommentsRequired")


but thats not the real reason why I want to do it this other way, basically if a new variable gets added, i dont have to replace it and put it also in the this big long lines of code above. The application variables name is the same as the string name I want it to have. So I have a loop which will loop thru and display everything that is in the application variables which is below:


' START TO LOOP THRU THE APPLICATION VARIABLES
For Each varItem in Application.Contents
' FIRST MAKE SURE ITS THE CORRECT VARIABLE
if (left(varItem, 5) = "strGC") then
' THIS IS THE CORRECT VARIABLE SO LETS WRITE IT OUT
' varItem IS THE STRING NAME I WANT TO SET IT TO
' Application.Contents(varItem) IS THE VALUE OF EACH ITEM
' SO strGCAdminUserName = Application("strGCAdminUserName") WOULD BE LIKE
' varItem = Application.Contents(varItem)
Response.Write varItem & ": " & Application.Contents(varItem) & "<br>"
end if
Next


I hope this helps you understand

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive



Edited by - redbrad0 on 12 November 2001 11:06:52
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 12 November 2001 :  19:52:04  Show Profile  Visit Gremlin's Homepage
Don't think you can do it that way, you can however store Arrays in the Application object so perhaps you could find a way to use a two-dimensional array containing say variable name, variable contents instead ?



Halo of Xegony
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07