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

Protecting specific content

Explorer ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

The site I'm building will be hooked up to an SQL database with say, 100 articles. When a paid subscriber logs in they will have access to all of the available content. No problem there. I looked at this thread:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1343846&ente...
and it explains well how to protect the content. The difference is that I want non-paid subscribers to see the entire list of links. The first four are free and will show up in black while the other 196 are premium content and those links will show up in gray. If a user clicks the gray link they will obviously be routed to a "pay here" kind of page.
Can I use the cfif to alter the color of the hyperlinks if the user is NOT logged in? Maybe a CSS rule on the page itself? Any ideas would be greatly appreciated.
TOPICS
Advanced techniques

Views

199

Translate

Translate

Report

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 ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

Ofeargall wrote:
> Can I use the cfif to alter the color of the hyperlinks if the user is NOT
> logged in? Maybe a CSS rule on the page itself? Any ideas would be greatly
> appreciated.

Yup and yup and the iif() function and several other possible ways. You
are thinking down the right path and just do whatever works for your
requirements.

If you feel like thinking it out a little farther you may want to
consider a custom tag, user defined function or even utility ColdFusion
component to build each link. Probably by passing in the link and at
least a flag of something like 'free' or 'paid'. The link would then do
the logic to determine how to build the link and return the completed
HTML anchor tag. This would allow you to encapsulate the code in a
single place for future editing and enhancement rather then repeating it
200 times down the page and then having to make 200 code changes if you
decide to do something differently down the road.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 13, 2008 Mar 13, 2008

Copy link to clipboard

Copied

LATEST
Glory!
I was hoping you would say something about utilizing a component/application file. I would really rather use that route than anything. I'm new to components so it may take some fleshing out here on the forums once I get my trajectory set.

Thanks for the help.

Votes

Translate

Translate

Report

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
Documentation