Conditional logic in views

I'm in the process of moving an older CF app into CB. One thing I'm
trying to come up with a solution for is taking a lot of the
conditional logic out of the views.

For Example, there are views where there are several <cfif> statements
that just show different images or different styles based on the
current page.

What I have decided to do is break these into different views, name
them based on the event they will be shown in and then use renderView

So if my current event is "main.index" I will name the menu view
something like "vwMain.index.cfm" and then call #renderView('/shared/
menu/vw' & event.getCurrentEvent())#

The old menu system I have right now looks something like:

<cfif SCRIPT_NAME eq "myscript.cfm">
  <td class="menu_off_usermenu">
  <a href="someotherscript.cfm" class="menubarlink" style="text-
decoration: none;"><img src="/includes/images/layout_edit.png"
border="0" alt=""> New</a>

<cfelseif SCRIPT_NAME contains "myscript2">
<td class="menu_on_usermenu">
  <a class="menubarlinkon" style="text-decoration: none;"><img src="/
includes/images/layout_edit.png" border="0" alt=""> New</a>
  <td class="menu_off_usermenu">
  <font class="link_off"><img src="/includes/images/layout_edit.png"
border="0" alt=""> New List</font>

I just wanted to see if anyone might think there is a better approach.
I'm really trying to make the application easier to make changes and
for some of these views that use this type of conditional logic, this
seemed to make sense.

I welcome any better suggestions.


If you are wanting to maintain easily, you might want to parametrize
the class names and set in the event handler then pass them to the
view. So in your case the conditional statement would move to the
event handler and set the variables to pass to the view.

Also depending on how you have things constructed you may move the
menu conditional to a function within the handler or make it a handler
itself can you call from the main handler. the plus with the second
solution is that you could have a handler that deals with menus and
could be used for a variety of situations independent of a specific