It appears that there are several potential paper types available (let's simplify them into two specific types).
You have a collection of links on a webpage:
The links are as follows:
super professional paper
bloggie type paper
another super duper pro-paper
something real formal
something personal-able and bloggie-ish
For example, if you have index.cfm along with header.cfm
and footer.cfm
included. In index.cfm
, the header will be expecting a url variable: url.professionalPaper
, which can be either 0 or 1 based on the link you create (explained below) - '0' for 'professional', and '1' for 'bloggie'.
<cfinclude template="header.cfm"> in your index.cfm file and
In the header.cfm
, include this:
<cfparam name="url.professionalPaper" default="-1">
If defaulted to '-1', it means to 'expect nothing' is incoming (in your perspective).
Your list of links will be structured like this:
<a href="?professionalPaper=0&paperID=1234">professionalPaper</a><br>
<a href="?professionalPaper=1&paperID=1111">something personalable and bloggie</a>
If you wish to reference the current page, such as index.cfm
, you can do something like this:
<cfif structkeyExists(url,"paperID")>
Hi, you are reading a paper...but which one?
<cfswitch expression="#url.professionalPaper#">
<cfcase value="0">
Yes, we are presenting a pro-paper targeted at professionals!
</cfcase>
<cfcase value="1">
This is a sentimental blog post. I'm feeling emotional.
</cfcase>
<cfdefaultcase>
Wait, what? -1 in url.professionalPaper means you need to choose a paper!
</cfdefaultcase>
</cfswitch>
</cfif>
<br>
Here are some links:<br>
<a href="?professionalPaper=0&paperID=1234">professionalPaper</a><br>
<a href="?professionalPaper=1&paperID=1111">something personal-able and bloggie</a>
This is the fundamental concept...and you can modify it as needed.
If you want to redirect this to a separate page like, for instance: pages.cfm, then update your links accordingly.
<a href="pages.cfm?professionalPaper=0&paperID=1234">professionalPaper</a><br>
<a href="pages.cfm?professionalPaper=1&paperID=1111">something personalable and bloggie</a>
Include the remaining logic in that page instead. This way, you have links in index.cfm and your page logic in pages.cfm
.
Then your defaultcase statement can look like this:
<cfdefaultcase>
Wait, what? -1 in url.professionalPaper means you should return to your index.cfm page containing the links (add link to go back).
</cfdefaultcase>
This is a basic overview but I believe you understand the concept and can expand upon it too :)