sgb_error_documents
Mar 13, 06:12 PM • txp
Update 2005-06-20: Please read this. If you're using sgburlhandler 0.1.8+ you need to use sgberrordocuments 0.1.2.1. Also if you're using a recent revision of TxP (1.0RC3 r253+) you'll need to follow these instructions:
Install sgb_url_handlers 0.1.8.2
Install sgb_error_documents 0.1.2.1
Configure each plugin per normal
Edit sgb_error_documents and copy all the code (you don't need to save after copying)
Return to the plugins page
Edit sgb_url_handler, put a copy of returns at the start of the plugin and paste the code from sgb_error_documents
Return to the plugins page and activate sgb_url_handler. You don't need to activate sgb_error_documents.
The TxP developers saw fit to change the way plugin code is handled by TxP. It's no longer possible to share code between plugins since they are executed in their own space.
Update 2005-06-17: I've updated the features and need to rewrite this page.
This plugin adds error document handling to TxP, it is designed to support a number of different error codes, and provides three different ways for handling each error code. Currently the plugin supports two error codes, 403 Forbidden and 404 Not Found, more can easily be add.
This plugin is designed as a companion to sgb_url_handler but it is open-ended enough to be used by any where.
The plugin can respond to each error code in one of four possible ways, by displaying an article on your site, redirecting to an error page, including an error document or by simply outputting error text. The plugin responds to an error in the order specified above (ID, URL, File and Text). If the ID is not set or is not found, the plugin will try the URL. If the URL is not set the plugin will try the File. If the file is not found, the plugin try the Text. If the Text is not set the plugin will simply output a default error message.
If an error code is plassed to the plugin that is not under stood, the plugin will not do anything.
Configuration
Right now configuration is handled by the array in sgb_error_documents_config. Each error code has three elements: id, url and text.
- id
- The ID element should be an id of an article in your TxP database that explains a particular error code. You could, for example, prepare an Errors section and then populate it with articles for common errors.
- url
- The URL element should be a complete URL to a page explaining a particular error code. If this error is triggered users will be redirected to this page.
- file
- The file element should be a relative (to index.php) path to a file explaining a particular error code. If the file is found it will be included and then the function will exit (terminating the TxP request).
- text
- The text element will be echoed to the browser if this error is triggered. The text will only be formatted by what HTML is included in the text itself. After the text is sent to the browser exit is called, terminating the TxP request.
In all instances (except for URL redirections) the plugin will issue the appropreiate error header.
Download
Changelog
- 0.1.2.2 - Current
- Minor update
- 0.1.2.1
- Updated function calls to reflect changes to sgburlhandler
- 0.1.2
- Added support for 301 redirections.
- 0.1.1
- Released.
To Do List
- Nothing yet.
