Link to home
Create AccountLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

stuck @ the links CF

I have the following code and i am stuck at the links Part, Just give me an idea what i am missing

<cfset lstAllLinks = ValueList(ads.label,' | ')>

<p><a href="my.cfm?file=all&c=#replace(lstAllLinks,' ','_','ALL')#">#lstAllLinks#</a>

now it creates the list separated by pipe symbol but links are not made correctly, i know this is i am big something here, just need idea
Avatar of TechHelpr08210
TechHelpr08210
Flag of United States of America image

What is the value of ads.label? I would need to see more code .
Avatar of gdemaria
Yea, we need to see the value of ads.label and see what it looks like after the code... and tell us what you want it to look like (specfically what is wrong?)

As a general guess, since this is going onto a link, you may need to wrap the code in URLencodedFormat so invalid characters don't message up your link

<a href="my.cfm?file=all&c=#URLenclodedFormat(replace(lstAllLinks,' ','_','ALL'))#">#lstAllLinks#</a>
Avatar of Coast Line

ASKER

ads.label comes as like

c=mail_me
c=contact_us

so links are formed as:

<a href="my.cfm?file=all&c=mail_me | contact_us">Mail Me | Contact Us</a>

obvious i want to split the href for the two links differently
It's not obvious.  What do you want the result to look like??

<a href="my.cfm?file=all&c=mail_me | contact_us">Mail Me | Contact Us</a>


or...

<a href="my.cfm?file=all&c=mail_me|contact_us">Mail Me | Contact Us</a>

<a href="my.cfm?file=all&c=#replace(lstAllLinks, ' ', '', 'ALL')#">#lstAllLinks#</a>



or ..

<a href="my.cfm?file=all&c=mail_me">Mail Me</a>
<a href="my.cfm?file=all&c=contact_us">Contact Us</a>
>> <a href="my.cfm?file=all&c=mail_me">Mail Me</a>
<a href="my.cfm?file=all&c=contact_us">Contact Us</a>

like above
SOLUTION
Avatar of TechHelpr08210
TechHelpr08210
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
if "ads" is a query, I don't see the need to create a value list and then loop the list, just loop the query!


<p>
<cfloop query="ads">
   <a href="my.cfm?file=all&c=#replace(ads.label,' ','_','ALL')#">#ads.label#</a>
   <cfif ads.currentRow lt ads.recordCount> | </cfif>
</cfloop>
</p>
but with this

<cfif ads.currentRow lt ads.recordCount> | </cfif>

i am still the the Pipe symbol after thr last record
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Thanks