Note that there are some explanatory texts on larger screens.

plurals
  1. POCFInclude vs Custom Tag vs CFC for Presentation and Security
    primarykey
    data
    text
    <p>I'm just starting out with ColdFusion OOP and I am wanting to make a DIV which shows different links to users depending on what page they are on and what login rights (role) they have. Basically a 'context' menu.</p> <p>Should I put this toolbar/navigation DIV in a .cfm or .cfc file? </p> <p>To reiterate; The cfm or cfc file needs to know what page the user is on and will also check what role they have. Depending on these two pieces of information it will display a set of links to the user. The role information comes from the database and stored in a SESSION variable, and to find out what page they are on I guess it could use <code>#GetFileFromPath(GetBaseTemplatePath())#</code>.</p> <p>My first thought was to have a normal .cfm file, put all the presentation and logic in that file (the HTML and lots of <code>&lt;cfif&gt;</code> statements) to ensure the correct information is displayed in the DIV, and then use <code>&lt;cfinclude&gt;</code> to display it on the page. Then I started thinking maybe I should make a Custom Tag and ask the calling page to pass in the user's credentials and the <code>#GetFileFromPath(GetBaseTemplatePath())#</code> as arguments and then have that Custom Tag return all the presentational data.</p> <p>Finally I guess a CFC could do the above as well, but I'd be breaking the 'rule' of having presentational and logic data in a CFC.</p> <p>Any suggestions on the best practice to achieve what I'm trying to do? It will eventually serve thousands of customers so I need to make sure my solution is easy to scale.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload