Are you using fusebox?
If you are you could use the fuseaction to determine if it increments or
vise verca,
e.g.
D:\dir1 [0] fuseaction=thisFuse&counter=#attributes.counter#
D:\dir2 [0] fuseaction=thisOtherFuse&counter=#attributes.counter#
then in your app globals
<CFPARAM NAME="attributes.counter" DEFAULT="0">
<cfwith expression="#attributes.fuseaction#">
<cfcase value="thisFuse"><CFSET
attributes.counter=attributes.counter-1><cfcase>
<cfcase value="thisOtherFuse"><CFSET
attributes.counter=attributes.counter+1><cfcase>
</cfswitch>
if your not using fusebox,
in your application.cfm
<CFPARAM NAME="counter" DEFAULT="0">
<CFIF GetBaseTemplatePath() CONTAINS("dir1")>
<CFSET counter=counter-1>
<CFELSEIF GetBaseTemplatePath() CONTAINS("dir2")>
<CFSET counter=counter+1>
</CFIF>
and then in you links you'll always have to pass via hidden form field,
cookie, or url
<a href="index.cfm?counter=#counter#>link</a>
I think this is along the right path,
J
-----Original Message-----
From: FlashGuy [mailto:[EMAIL PROTECTED]]
Sent: 17 December 2002 12:51
To: CF-Talk
Subject: Re: Incrementing a variable
I'm trying to set a variable based on were I am in my directory structure.
At initial loading of my index.cfm I would set a variable to "0"
WHen I click on a link and "drill-down" into the directory I want that
variable incremented. At the same time if I go backup up in the directorure
structure I want the variable
decremented.
Example:
D:\dir1 [0]
D:\dir2 [0]
Click on D:\dir1
D:\
D:\dir1\test1 [1]
D:\dir1\test2 [1]
Click on D:\dir1\test
D:\
D:\dir1 [1]
D:\dir1\test1 [2]
On Tue, 17 Dec 2002 12:28:55 -0000, Taz wrote:
> That's because on every page request you reset the value to zero
>
> What are you trying to do?
>
> Taz
>
> ----- Original Message -----
> From: "FlashGuy" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, December 17, 2002 12:12 PM
> Subject: Incrementing a variable
>
>
> > Hi,
> >
> > For some reason I can't get my variable to increment when my page is
> reloaded.
> >
> > I have the following in my application.cfm file
> >
> > <cfset child = 0>
> >
> > In my index.cfm file I have the following.
> >
> > <cfset child=child + 1>
> >
> > Everytime I refresh the page manually or by using an <a href within mu
> file to reload mu index.cfm it doesn't increment?
> >
> >
> >
> >
> > ---------------------------------------------------
> > Colonel Nathan R. Jessop
> > Commanding Officer
> > Marine Ground Forces
> > Guatanamo Bay, Cuba
> > ---------------------------------------------------
> >
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm