do a list loop instead. it loops through the list and checks it with the
number u are looking for (line 5). If it matches, it includes the tmeplate
and breaks off the loop. Then on line 11 it checks to see if it has checked
through everything in the list, and if it has and has gotten this far, it
means there was no match, and goes ahead and does whatever
1. <CFSET counter=0>
2. <CFSET lookfor = 4>
3. <CFLOOP index="number" List="#mylist#">
5. <CFIF lookfor = number>
6. <cfinclude template=#page#>
7. <CFBREAK>
8. </CFIF>
10. <CFSET counter=counter+1>
11. <CFIF counter=Listlen(mylist)>
13. <cfoutput>
14. #application.securityerror#
15. </cfoutput>
17. </CFIF>
18. </CFLOOP>
>From: "van Wyk, Carlo" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: Listcontains question
>Date: Wed, 19 Sep 2001 11:27:54 +0200
>
>Hi
>
>I have the following piece of code that checks to see if a user can see a
>specific pageid or not. Unfortunately it is not doing the job as I have a
>list that looks something like this:
>
>4,14,3,2,8,44
>
>If the user is allowed to see page 4, then he would be able to see all
>pages
>that contains a 4, so it does not work correctly.
>
>
><cfif listcontains(newlist, "#pageid#")>
> <cfinclude template=#page#>
> <cfelse>
> <cfoutput>
> #application.securityerror#
> </cfoutput>
></cfif>
>
>Regards
>Carlo
>FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
>Archives: http://www.mail-archive.com/[email protected]/
>Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists