Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Includes redux & stupid mappath tricks...

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,45759
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Includes redux & stupid mappath tricks...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Includes redux & stupid mappath tricks... - 4/12/2007 11:06:48 AM   
  dannyboi

 

Posts: 2
Score: 0
Joined: 4/12/2007
Status: offline
hey vbs peops --

1st time poster, go gentle on me , im a vbs.com virgin.

I have a bunch of asp pages that all reuse the same class code from an include.  The files are located in various level dirs throughout the site.

mainFile.asp
{#include file="blah/blah/classX.asp"}

anotherFile.asp
{#include file="../../blah/blah/classX.asp"}

OneMoreFile.asp
{#include file="blah/classX.asp"}



I have the class file.

ClassX.asp
yadda, yadda, reuseable code

whenever I attempt to use the funct Mappath(".") from inside ClassX.asp to try to find out where the class file is physically located, it always returns the path to the main calling file, and never the path to the included classX.asp file.

How can I dynamically find the path to an includes file from inside the included code itself?

(I would like to have the class code reuseable across 15-20 different websites all with totally different directory structures and names.  I would prefer to release the code w/o having to hardcode paths into it.  If the class were "self detecting' of it's own dir location, my maintainence chores would be much easier.

Tnx for any hints,tips, or filthy little trix,
Dan

 
 
Post #: 1
 
 RE: Includes redux & stupid mappath tricks... - 4/13/2007 4:47:03 AM   
  dm_4ever


Posts: 2414
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
global.asa perhaps?
http://www.w3schools.com/asp/asp_globalasa.asp

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dannyboi)
 
 
Post #: 2
 
 RE: Includes redux & stupid mappath tricks... - 4/14/2007 1:57:30 AM   
  dannyboi

 

Posts: 2
Score: 0
Joined: 4/12/2007
Status: offline
Thanks for the reply, dm.

I might not have been too clear.  The problem I'm having is that anytime I call Mappath(".") within my class code it returns the location of the calling scripts, and  not the location of the class file itself.  (when the class is called as an include.)

'{sample code from the class}
Private Sub Class_Initialize()
ThisClassPath =  Server.MapPath(".")
End class

'{the var ThisClassPath ends up holding the Path to the calling script, not the class it's called from}

Are you suggesting using the global.asa file as a place to simply hard code the exact path/name to my class file?    I don't see how using global.asa is gonna help make the class code "self aware" of it's own location.   And, I can hard code the location right into the class itself easily enough, but that's exactly what Im trying to avoid doing.  

Hopefully, I'm just totally missing your point.

Thanks again for making a suggestion. Much Appreciated.
Dan

< Message edited by dannyboi -- 4/14/2007 2:04:16 AM >

(in reply to dm_4ever)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Includes redux & stupid mappath tricks... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts