Well, since it's now playtime over here in Holland I decided to play a
bit.

<!--- This bit just creates the original links that you would normally
have coming from your database --->
<cfsavecontent variable="content">
<cfset cnt = 0>
<cfoutput>
<cfloop list="blah,foo,bar" index="i">
<cfset cnt = cnt + 1>
<a href="index.cfm?fuseaction=#i#.foo.bar&id=#cnt#">#i#</a>
</cfloop>
</cfoutput>
</cfsavecontent>


<cfoutput>
Before:<br>
#content#
<br>
<br>
</cfoutput>

<cfset request.urltoken = "cfid=2&cftoken=234234">

<!--- Add the token to any valid urls --->
<cfset html =
reReplace(content,'(index.cfm?)([^"]*)(")','\1\2&#request.urltoken#"','a
ll')>

<!--- output the result --->
<cfoutput>
After:<br>
#html#
</cfoutput>

Spike

> -----Original Message-----
> From: Dave Phipps [mailto:[EMAIL PROTECTED]] 
> Sent: 14 August 2002 18:10
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Regex and urltoken
> 
> 
> Hi,
> 
> Thanks the code you put in would have been able to append the 
> urltoken to 
> the url if it was only the url that was supplied.  However 
> the urls are 
> within a whole bunch of html text that comes from a database. 
>  So I need to 
> first find all the url's and then append the urltoken.
> 
> Spike, if you get a chance to look at it then that would be 
> great.  I'll 
> also have a look at the regex example in the green forta book 
> and tried to 
> work something out from that.
> 
> Cheers
> 
> Dave
> 
> 
> At 14:17 8/14/2002 +0100, you wrote:
> >the code i posted does this.
> >
> >-----Original Message-----
> >From: Dave Phipps [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, August 14, 2002 2:01 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: [ cf-dev ] Regex and urltoken
> >
> >
> >This is nearly spot on.  Just an aesthetic thing, would it 
> be possible 
> >to get the #request.urltoken# put on the end of the whole url like 
> >this:
> >
> ><a 
> >href="index.cfm?fuseaction=intranet.content&contentid=2&#requ
est.urltok
> >en#">
> >My
> >link</a>
> >
> >At the moment it is doing this:
> >
> ><a 
> >href="index.cfm?CFID=19437&CFTOKEN=77996404&fuseaction=intran
> et.content
> >&cont
> >entid=2">My
> >link</a>
> >
> >Although this perfectly valid it doesn't look as nice as the top url.
> >
> >Any suggestions?
> >
> >What was the tag called in the devex?
> >
> >Cheers
> >
> >Dave
> >
> >At 14:32 8/14/2002 +0200, you wrote:
> > >Assuming you're always using index.cfm you could do something like 
> > >this.
> > >
> > ><cfset newcontent = 
> > 
> >ReplaceNoCase(content,'index.cfm?','index.cfm?#request.urltoken#&','a
> > >ll'
> > >)>
> > >
> > >Spike
> > >
> > > > -----Original Message-----
> > > > From: Dave Phipps [mailto:[EMAIL PROTECTED]]
> > > > Sent: 14 August 2002 14:27
> > > > To: ColdFusion User group
> > > > Subject: [ cf-dev ] Regex and urltoken
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have some text containing the occasional href links that are 
> > > > driven from a db query and I need to be able to append the 
> > > > urltoken to these links on
> > > > the fly.
> > > >
> > > > I was thinking that I could use a regex for this but I 
> can't even 
> > > > begin to think what the regex would look like.
> > > >
> > > > The links coming from the db would look like this:
> > > >
> > > > <a href="index.cfm?fuseaction=intranet.content&contentid=2">My 
> > > > link</a>
> > > >
> > > > and what I want to have it do is this:
> > > >
> > > > <a 
> href="index.cfm?fuseaction=intranet.content&contentid=2&CFID=3
> > >4234234&CFTOKEN=234234234243">My
> > > > link</a>
> > > >
> > > > Is this possible?  the urltoken will be in the form of: 
> > > > #request.urltoken#
> > > >
> > > > Thanks in advance.
> > > >
> > > > Dave
> > > >
> > > >
> > > >
> > > > ============================================
> > > > Phipps CF Development
> > > > Oxford, Oxfordshire.
> > > > Telephone: +44(0)7718 896696
> > > > http://www.phipps-cf.co.uk 
> > > > ============================================
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> [EMAIL PROTECTED] 
> > > > For human help, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: 
> [EMAIL PROTECTED] For 
> > >human help, e-mail: [EMAIL PROTECTED]
> >
> >
> >============================================
> >Phipps CF Development
> >Oxford, Oxfordshire.
> >Telephone: +44(0)7718 896696
> >http://www.phipps-cf.co.uk 
> ============================================
> >
> >
> >--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: 
> [EMAIL PROTECTED] For 
> >human help, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >This email has been scanned for viruses by NetBenefit using Sophos 
> >anti-virus technology
> >
> >
> >
> >This email has been scanned for viruses by NetBenefit using Sophos
> >anti-virus technology
> >
> >
> >
> >--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: 
> [EMAIL PROTECTED] For 
> >human help, e-mail: [EMAIL PROTECTED]
> 
> 
> ============================================
> Phipps CF Development
> Oxford, Oxfordshire.
> Telephone: +44(0)7718 896696
> http://www.phipps-cf.co.uk 
> ============================================
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]


Reply via email to