I learned a way to write code for the menus by using database instead of using cfswich. Now the course website is completely database-driven. I used the CMS approach to redesign the links in each menu. Here is the entire code for the content page that corresponce to the menu items:
<cfquery name=”qGetURL” datasource=”DSN0111″>
SELECT *
FROM tblMenu
WHERE 0=0 AND
<cfif isDefined(“URL.projectid”)>
menuID = #URL.projectid#;
<cfelseif isDefined(“URL.pageid”)>
menuID = #URL.pageid#;
<cfelse>
menuID = 18;
</cfif>
</cfquery><cfoutput>
<cfset filePath = ExpandPath(“#qGetURL.linkLoc#”)>
<cfif fileExists(filePath)>
<cfinclude template=”../#qGetURL.linkLoc#”>
<cfelse>
<div id=”noVal”>Not Found</div>
<cfinclude template=”index.cfm”>
</cfif>
</cfoutput>
As you can see from the above code, the file location and the file names are stored in the database instead of the page content. This way, I can create web pages inside site directories and then include it to the website through database without change the above code.
I also plan to create a ColdFusion web application that can directly update the database without launch MS Access. Right now I’m using CFEclipse to write the ColdFusion code on my Fedora system and virtualized Windows XP through VirtualBox to modify and viewing the database. My goal for this web application is to allow me to modify or view the database with less or no MS Access usage.
For those who don’t know, my ColdFusion course is Microsoft Access based, not MySQL based. I successfully installed ColdFusion 9 on my Fedora system, but I failed to install MS Access driver onto the system. That’s why I plan to create this application in the next few weeks.






