Created
February 15, 2012 22:55
-
-
Save chrisdpeters/1839803 to your computer and use it in GitHub Desktop.
404 Error Handling in CFWheels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="render404" hint="Renders a 404 error page."> | |
<cfset renderPage(controller="main", action="error404")> | |
</cffunction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset layout.title = "Page Not Found | ColdFusion on Wheels"> | |
<cfset layout.header1 = "Page Not Found"> | |
<cfset layout.breadcrumbs = ["Page Not Found"]> | |
<!--- 404 error ---> | |
<cfheader statuscode="404" statustext="Not Found"> | |
<cfoutput> | |
<p> | |
We're sorry. We couldn't find the page that you're looking for. It has either been removed, or perhaps | |
you are accessing an inaccurate <abbr title="Uniform Resource Locator">URL</abbr>. | |
</p> | |
<h2><label for="search-query-404">Search</label></h2> | |
#startFormTag(controller="search", id="cse-search-box", method="get")# | |
<div> | |
<input type="hidden" name="cx" value="005724978648843866544:jpej79qhz14" /> | |
<input type="hidden" name="cof" value="FORID:10" /> | |
<input type="hidden" name="ie" value="UTF-8" /> | |
<input id="search-query-404" type="text" name="q" /> | |
<input type="submit" name="sa" value="Search" /> | |
</div> | |
#endFormTag()# | |
<h2>Start from the Home Page</h2> | |
<p><strong>#linkTo(text="ColdFusion on Wheels Home »", route="home")#</strong></p> | |
</cfoutput> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="profile" hint="Displays user profile."> | |
<cfset user = model("customer").findByKey(params.key)> | |
<cfset loggedInUser = getLoggedInCustomer()> | |
<!--- If profile found, show it ---> | |
<cfif IsObject(user)> | |
<cfset sites = user.sites(where="isApproved=1")> | |
<cfset plugins = user.plugins(where="isApproved=1")> | |
<!--- 404 error if not found ---> | |
<cfelse> | |
<cfset render404()> | |
</cfif> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment