<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Derek Punsalan - 5THIRTYONE &#187; error</title> <atom:link href="http://5thirtyone.com/archives/tag/error/feed" rel="self" type="application/rss+xml" /><link>http://5thirtyone.com</link> <description>A personal site by Derek Punsalan sharing personal interests with technology, WordPress, design, and general geekery.</description> <lastBuildDate>Wed, 10 Mar 2010 06:09:35 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>WordPress 2.3+ official support for custom database error page</title><link>http://5thirtyone.com/archives/879</link> <comments>http://5thirtyone.com/archives/879#comments</comments> <pubDate>Tue, 12 Feb 2008 06:07:09 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[custom]]></category> <category><![CDATA[database]]></category> <category><![CDATA[db-error.php]]></category> <category><![CDATA[error]]></category><guid
isPermaLink="false">http://5thirtyone.com/archives/879</guid> <description><![CDATA[Some time ago a tutorial was posted on 5ThirtyOne which addressed customizing the DB Error page rendered whenever visitors landed on heavily trafficked WordPress site. Since then, the method has been proven &#34;useless&#34;, ushered away by recent updates to the WordPress code base; more specifically with the release of WordPress 2.3.2 (current release is 2.3.3). [...]]]></description> <content:encoded><![CDATA[<p>Some time ago a tutorial was posted on <a
href="http://5thirtyone.com/">5ThirtyOne</a> which addressed <a
href="http://5thirtyone.com/archives/408">customizing the DB Error page</a> rendered whenever visitors landed on heavily trafficked <a
href="http://wordpress.org">WordPress</a> site. Since then, the method has been proven &quot;useless&quot;, ushered away by recent updates to the WordPress code base; more specifically with the <a
href="http://wordpress.org/development/2007/12/wordpress-232/">release of WordPress 2.3.2</a> (<a
href="http://wordpress.org/download/">current release</a> is 2.3.3). Whereas the previous method required manipulating code within a core WordPress file, the new updated method allows for the custom page to be stored externally of the WP root directory. To get started creating your own custom WordPress database error page, follow the two steps below:</p><h3>Create a db-error.php file in /wp-content/</h3><p>First things first. Create an XHTML file called <code>db-error.php</code> and upload it to the WordPress <code>/wp-content/</code> directory.</p><p
align="center"><img
src="http://5thirtyone.com/wp-content/uploads/2008/10/dberrorfile.png" alt="DB Error file in Transmit" /></p><p>Because visitors will see this page when your WordPress driven website is experiencing database connection errors, you will need to make sure the file includes any style attributes inline, or reference an external stylesheet (absolute URL).</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;style type=&quot;text/css&quot;&gt;...your CSS goes here...&lt;/style&gt;</pre></div></div><p
align="center">or</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;link href=&quot;http://url.com/my-stylesheet.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;</pre></div></div><p>For the sake of simplicity, we&#8217;ll create a custom database error page with a single XHTML document including any style attributes inside the <code>&lt;head&gt;</code> tags. The following is the message skeleton originally created and used in the tutorial <a
href="http://5thirtyone.com/archives/408">here</a>.</p><div
class="wp_syntax"><div
class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;title&gt;My server crashed, please call the next of kin&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
body {
font-family: arial, verdana, sans-serif;
font-size: 62.5%;
background: #fff;
color: #333;
text-align: center;
}
a {
text-decoration: none;
outline: none;
}
#error_wrapper {
font-size: 1.3em;
margin: 5em auto 0;
text-align: left;
width: 333px;
}
.content_wrapper {
padding: 1em 0.7em 0;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;error_wrapper&quot;&gt;
&lt;div class=&quot;content_wrapper&quot;&gt;
&lt;p&gt;It looks as though my server has taken an unsupervised leave of absence. I may not know of its whereabouts so would you be so kind as to notify me via &lt;a href=&quot;mailto:admin@domain.com&quot; title=&quot;Send me an email&quot;&gt;email&lt;/a&gt;?&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div><h3>Second step, there is none</h3><p>If you created a standard XHTML document and dropped the code in <code>db-error.php</code> inside the <code>/wp-content</code> directory, there really isn&#8217;t anything else to do other than to ensure that your site visitors never see a WordPress database error page while visiting your site.</p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/1921" rel="bookmark" class="wherego_title">Sample WordPress content for development</a></li><li><a
href="http://5thirtyone.com/archives/408" rel="bookmark" class="wherego_title">Custom WordPress Database Error</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/879/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Custom WordPress Database Error</title><link>http://5thirtyone.com/archives/408</link> <comments>http://5thirtyone.com/archives/408#comments</comments> <pubDate>Sat, 24 Jun 2006 05:07:59 +0000</pubDate> <dc:creator>Derek</dc:creator> <category><![CDATA[Tutorial]]></category> <category><![CDATA[database]]></category> <category><![CDATA[error]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://5thirtyone.com/archives/408</guid> <description><![CDATA[UPDATE 12/31: As of WordPress version 2.3.2, users can now easily replace their Database error using wp-content/db-error.php as their error template.
If you&#8217;re a longtime WordPress user, you&#8217;re probably aware of the Database Error page which rears its not so shiny face whenever your MySQL server decides to take a bathroom break. There&#8217;s no shame in [...]]]></description> <content:encoded><![CDATA[<p><strong>UPDATE 12/31:</strong> As of <a
href="http://wordpress.org/development/2007/12/wordpress-232/">WordPress version 2.3.2</a>, users can now easily replace their Database error using <code>wp-content/db-error.php</code> as their error template.</p><p>If you&#8217;re a longtime WordPress user, you&#8217;re probably aware of the Database Error page which rears its not so shiny face whenever your MySQL server decides to take a bathroom break. There&#8217;s no shame in enjoying the default error page which comes prepackaged with WordPress. It simple, <em>effective</em>, plain, did I say plain yet? Yes it&#8217;s plain.</p><p>After noticing that 5ThirtyOne was dead in the water due to server downtime, I decided the default error page had to go.</p><p
align="center"><a
href="http://www.flickr.com/photos/0401/173620342/" title="Full preview on Flickr" rel="external"><img
src="http://5thirtyone.com/wp-content/uploads/2006/06/dberrorpage.png" alt="custom wordpress error page" /></a></p><p>Fortunately, swapping the default is quite simple and something that I highly recommend to any and all WordPress users. There&#8217;s a certain sense of &#8220;professionalism&#8221; to WordPress sites which customize the smallest details to match their entire site through and through.<span
id="more-408"></span></p><h3>Where is the database error template served?</h3><p>WordPress 2.0+ users can find the necessary lines to edit within <em>&#8216;/wp-includes/wp-db.php&#8217;</em>. Beginning immediately below line 307, paste the following:</p><p><code>/* custom error page hack<br
/> shows a custom error page and emails error instead of<br
/> showing the default wordpress database error page */<br
/> include('wp-content/themes/themename/dbase-error.php');<br
/> $error = ( !$this-&gt;show_errors ) ? '' : $this-&gt;show_errors ;<br
/> mail('admin@domain.com', 'WordPress Error', $error);<br
/> die;<br
/> /* end custom error page hack */</code></p><p>For a hand-holding walk-through of each snippet of code, head on over to <a
href="http://allforces.com/2006/06/18/custom-wordpress-errors/" title="All Forces - WordPress Error page" rel="external">All Forces</a> where Melvin breaks down the little stuff. The most important details should be recognizeable above: a) the path to your custom template titled <strong>dbase-error.php</strong>, and b) the email address that WordPress should notify in case of emergency.</p><h3>A simple template to get you started</h3><p>Once you&#8217;ve made the appropriate edits within <strong>wp-db.php</strong>, you can now move on to creating a suitable error page to match the look and feel of your site. Below I&#8217;ve shared a little sample of code to get you started. Feel free to download a physical copy of <a
href="http://5thirtyone.com/sandbox/wordpress/dbase-error.php.zip" title="Download dbase-error.php.zip">dbase-error.php</a> for upload.</p><p><code>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br
/> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br
/> &lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;<br
/> &lt;title&gt;My server crashed, please call the next of kin&lt;/title&gt;<br
/> &lt;style type=&quot;text/css&quot;&gt;<br
/> body {<br
/> font-family: arial, verdana, sans-serif;<br
/> font-size: 62.5%;<br
/> line-height: 1.7em;<br
/> background: #fff;<br
/> color: #333;<br
/> text-align: center;<br
/> }<br
/> a {<br
/> text-decoration: none;<br
/> outline: none;<br
/> }<br
/> #error_wrapper {<br
/> font-size: 1.3em;<br
/> margin: 2em auto 0;<br
/> text-align: left;<br
/> width: 333px;<br
/> }<br
/> .content_wrapper {<br
/> padding: 1em 0.7em 0;<br
/> }<br
/> &lt;/style&gt;<br
/> &lt;/head&gt;<br
/> &lt;body&gt;<br
/> &lt;div id=&quot;error_wrapper&quot;&gt;<br
/> &lt;div class=&quot;content_wrapper&quot;&gt;<br
/> &lt;p&gt;It looks as though my server has taken an unsupervised leave of absence. I may not know of its whereabouts so would you be so kind as to notify me via &lt;a href=&quot;mailto:admin@domain.com&quot; title=&quot;Send me an email&quot;&gt;email&lt;/a&gt;?&lt;/p&gt;<br
/> &lt;/div&gt;<br
/> &lt;/div&gt;<br
/> &lt;/body&gt;<br
/> &lt;/html&gt;</code></p><p>I&#8217;ve chosen to embed the CSS for the sake of convenience. If your error page begins to get a little disorganized, moving your stylesheet to an external source may be a more suitable route. Make note that all references to files within WordPress must be absolute paths.</p><h3>Show me yours</h3><p>Now that you have a clean canvas to work with, show me what your database error message will be. Being that errors are few and far between, I&#8217;ve pasted mine below:</p><blockquote><p>Unfortunately, it seems that 5ThirtyOne is suffering from a database error which prevents this WordPress driven site from delivering the content which you so desperately seek.</p><p>Rest assured that the lemmings living within the servers are hastily working to restore the MySQL database making everyone &#8211; especially me &#8211; a little less irritated.</p><p>If I broke my own site on accident, I really didn&#8217;t mean to. Change is good though right?</p></blockquote><p>Let&#8217;s try to be original. If there&#8217;s one thing worse than copying someones &#8216;<a
href="http://5thirtyone.com/colophon" title="5ThirtyOne Colophon">About</a>&#8216; page, it&#8217;s copying someones error page. Drop your renditions in the comments.</p><div
id="wherego_related"><h3>Readers Also Read</h3><ul><li><a
href="http://5thirtyone.com/archives/404" rel="bookmark" class="wherego_title">Wufoo does web forms right</a></li><li><a
href="http://5thirtyone.com/archives/1921" rel="bookmark" class="wherego_title">Sample WordPress content for development</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://5thirtyone.com/archives/408/feed</wfw:commentRss> <slash:comments>22</slash:comments> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 10/17 queries in 0.024 seconds using disk

Served from: 5thirtyone.com @ 2010-03-12 03:08:33 -->