2 Replies Latest reply on Mar 13, 2008 2:30 PM by Ofeargall

    Protecting specific content

    Ofeargall Level 1
      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=13 43846&enterthread=y
      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.
        • 1. Re: Protecting specific content
          Level 7
          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.
          • 2. Re: Protecting specific content
            Ofeargall Level 1
            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.