Quick & Dirty Right SideBar ... or Not,
If you have a site that you some pages to have a sidebar and some NOT without having to create 2 similar templates (if you are using DW Template feature), you can easily set a variable in the file to turn the side bar on or off. This method creates a floating right sidebar if the variable is set, but it can be adjusted for a left sidebar as well.
There are two quick and dirty methods of doing this. The first involves a dynamic div creation by setting up the Div id to be evaluated at run time using 2 CSS ids, one for content width accommodating the sidebar and one without:
<div id="<cfoutput>#IIF(useRtSideBar eq true, DE('contentwsidebar'), DE('content'))#</cfoutput>">
Put Content Stuff Here
<div id='sidebar' style="<cfoutput>#IIF(useRtSideBar eq true, DE('display:block'), DE('display:none'))#</cfoutput>">
Put Your SideBar Stuff Here
</div>
</div>
The second is a more basic method that simply shows or hides the sidebar div based on the setting of the variable:
<head>
<cfset useRtSideBar = true>
:
</head>
<body>
<div id='banner'> banner here </div>
<div id='nav'> nav here </div>
<div id='contentwrapper'> Wraps Content and Sidebar
<cfif useRdSideBar>
<div id='rtsidebar> Sidebar </div>
</cfif>
Rest of Content goes here
</div> <!---contentwrapper --->
</body>

There are no comments for this entry.
[Add Comment]