Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-02-25 16:51:27
- MikeTheVike
- Member
- Registered: 2008-06-17
- Posts: 47
How do I make custom 404 page?
I’m using textpattern as a cms, and have all my pages set up as “Sections”. Then I have separate “Pages” set up as templates for each “Section”. I use the “one article set to Sticky method” for displaying content on each page. I’m trying to create a 404 page. I saw there was a error_default “Page” by default. If I take one of my other “Page” templates and copy and paste it into the error_default “Page”, it doesn’t work correctly when viewing on the site. No css stylign is applied, and it displays ALL my sticky articles…Any idea what I’m doing wrong?
The site is here…http://www.welovebigal.com
You can see if you type in http://www.welovebigal.com/woops or something that the error page is all messed up. If I use the default error_default page that comes with textpattern, it works fine… Thanks!
Offline
#2 2009-02-25 18:21:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I make custom 404 page?
The error page uses the default CSS, so you have to add n="bigal"
to the txp:css tag on that page.
What I usually do is copy the contents of my regular page over to the error_default page, and remove all article, if_section etcetera tags. I put <txp:site_name />: <txp:error_status />
back into the head title
tags, and in the content area I put something like this:
<h2><txp:error_status /></h2>
<p><txp:error_message /></p>
That should work. If you want a custom error message, you can create an error_404 page with this content, and replace <txp:error_message />
with your own text.
You can do the same with an error_503 page (in case you are using rvm_maintenance). Keep in mind that the names of the error pages have to be exactly error_404 and error_503. Txp will look for them, and if such a page doesn’t exist, it will use error_default.
Offline
#3 2009-02-25 19:33:49
- MikeTheVike
- Member
- Registered: 2008-06-17
- Posts: 47
Re: How do I make custom 404 page?
Thanks, that worked great!
Els wrote:
The error page uses the default CSS, so you have to add
n="bigal"
to the txp:css tag on that page.
What I usually do is copy the contents of my regular page over to the error_default page, and remove all article, if_section etcetera tags. I put<txp:site_name />: <txp:error_status />
back into the headtitle
tags, and in the content area I put something like this:
<h2><txp:error_status /></h2>
<p><txp:error_message /></p>
That should work. If you want a custom error message, you can create an error_404 page with this content, and replace <txp:error_message />
with your own text.
You can do the same with an error_503 page (in case you are using rvm_maintenance). Keep in mind that the names of the error pages have to be exactly error_404 and error_503. Txp will look for them, and if such a page doesn’t exist, it will use error_default.
Offline
Re: How do I make custom 404 page?
I ran into this today. The theme had a single header that every template uses but uses style rather than default for the css stylesheet. I came up with:
<txp:if_status status="200">
<txp:css format="link" />
<txp:else />
<txp:css format="link" name="style" />
</txp:if_status>
It solved the problem for me. The advantage here is that should a section be set to use a custom style this shouldn’t interfere.
Offline
Pages: 1