Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple CFIF's

Guest
Apr 06, 2008 Apr 06, 2008
Not sure how best to achieve this without adding a further cfquery into the page, which I'd like to avoid doing if possible.

I have a standard login page, which sets some session variables. However some pages can also be viewed without logging in. One of these pages has a 'watch list' feature, and I basically want to control how this is displayed as follows;

- User not logged in : Prompt to login if they want to add to watchlist
- User is logged in, but item is not on watch list : Prompt to add to watchlist
- User is logged in, and already has item on watchlist : Prompt to state item is on watchlist

Functionality is basically very similar to the way 'My Ebay' works.

The watch list is currently being brought in via a header file, with the following query;

<cfquery name="getwatchlist" datasource="#datasource#">
SELECT user_id, merchant_id
FROM cc_watchlists
WHERE user_id=#SESSION.Auth.ID#
</cfquery>

The output as it stands (which doesn't look for the item already being on the watch list) is as follows;

<cfif IsDefined('SESSION.Auth.username')>
Add to watch list
<cfelse>
Please login to add to watch list</a>
</cfif>

My initial thought is that I should be looking to add an 'IN' statement for the query, but that's about as far as I've managed to get (it's been a loooong day!).

Any pointers gratefully received!
TOPICS
Advanced techniques
320
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2008 Apr 06, 2008
LATEST
On the cold fusion side, the cfswitch and cfcase tags might be useful. Useage is described in the cfml reference manual. If you don't have one, the internet does.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources