<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Themed Error Pages</title>
	<link>http://hackademix.net/2007/07/31/themed-error-pages/</link>
	<description>Giorgio Maone's answers to the Web, the Universe, and Everything</description>
	<pubDate>Fri, 29 Aug 2008 07:21:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: richard</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-8553</link>
		<dc:creator>richard</dc:creator>
		<pubDate>Mon, 07 Jul 2008 02:06:38 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-8553</guid>
		<description>nice...very new to da whole net thing, me do mostly hardware, custom built. with os and the most common software that is currently used. just got ADSL and paying hefty price to but me try to cheat my sp cause they only allow 4gb...!!!what the @#$#!! 4gbis wat i do in 2 hours.....so i do google search for south african software brains. end no one to date. so me now no sleep and me try to get around this whole new world that is very very faccinating....i just cant close my eyes...and have little help with substance:) but substance make net for exciting...is me mad!!</description>
		<content:encoded><![CDATA[<p>nice&#8230;very new to da whole net thing, me do mostly hardware, custom built. with os and the most common software that is currently used. just got ADSL and paying hefty price to but me try to cheat my sp cause they only allow 4gb&#8230;!!!what the @#$#!! 4gbis wat i do in 2 hours&#8230;..so i do google search for south african software brains. end no one to date. so me now no sleep and me try to get around this whole new world that is very very faccinating&#8230;.i just cant close my eyes&#8230;and have little help with substance:) but substance make net for exciting&#8230;is me mad!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-200</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 16 Aug 2007 10:41:40 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-200</guid>
		<description>Mate,
I thank you! A lot!
Andy</description>
		<content:encoded><![CDATA[<p>Mate,<br />
I thank you! A lot!<br />
Andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-190</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Tue, 14 Aug 2007 16:31:29 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-190</guid>
		<description>Hi Andy,

I guess your problem is best handled using JavaScript client side validation.
My hack intercepts any error message produced by WordPress, included the server side validation for comments.
If you want your error messages to popup &lt;em&gt;before&lt;/em&gt; the data is submitted, you can add a JavaScript &lt;code&gt;onsubmit&lt;/code&gt; event handler to check the fields and &lt;code&gt;alert()&lt;/code&gt; the feedback.
Many themes (e.g. K2) already feature such a goodie out of the box.

Hope it helps.</description>
		<content:encoded><![CDATA[<p>Hi Andy,</p>
<p>I guess your problem is best handled using JavaScript client side validation.<br />
My hack intercepts any error message produced by WordPress, included the server side validation for comments.<br />
If you want your error messages to popup <em>before</em> the data is submitted, you can add a JavaScript <code>onsubmit</code> event handler to check the fields and <code>alert()</code> the feedback.<br />
Many themes (e.g. K2) already feature such a goodie out of the box.</p>
<p>Hope it helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andy</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-187</link>
		<dc:creator>andy</dc:creator>
		<pubDate>Tue, 14 Aug 2007 11:20:18 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-187</guid>
		<description>Hi Giorgio,

So a little off subject.
I have created a popup window to deal with "add comments" on my blog. When the user doesn't include their name or write any comments, i have a custom error page that replaces the content in the popup with a custom message i have written. So the hack you provided really just allows this error page to be called.

My concern is that if there are any other errors encountered this same error window will appear with my custom message, which will probably not relate to the error encountered. Now this can be easily solved by including $message in the body of the page like you recommend. But usually these error messages are pretty cryptic.
Does wordpress have a list of error messages and under what circumstances they are likely to be encountered?

Alternatively, how would you create a small window (like those error messages that the windows environment produces) that would popup to say "please enter name"
Then i wouldn't need to customize an error page specifically for missing data.

cheers
Andy</description>
		<content:encoded><![CDATA[<p>Hi Giorgio,</p>
<p>So a little off subject.<br />
I have created a popup window to deal with &#8220;add comments&#8221; on my blog. When the user doesn&#8217;t include their name or write any comments, i have a custom error page that replaces the content in the popup with a custom message i have written. So the hack you provided really just allows this error page to be called.</p>
<p>My concern is that if there are any other errors encountered this same error window will appear with my custom message, which will probably not relate to the error encountered. Now this can be easily solved by including $message in the body of the page like you recommend. But usually these error messages are pretty cryptic.<br />
Does wordpress have a list of error messages and under what circumstances they are likely to be encountered?</p>
<p>Alternatively, how would you create a small window (like those error messages that the windows environment produces) that would popup to say &#8220;please enter name&#8221;<br />
Then i wouldn&#8217;t need to customize an error page specifically for missing data.</p>
<p>cheers<br />
Andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-125</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Fri, 10 Aug 2007 14:56:20 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-125</guid>
		<description>The &lt;code&gt;wp_die()&lt;/code&gt; function is called by WordPress every time a fatal error happen.
Unluckily, WordPress has a quite broad concept of "fatal", including stuff like comments omitting a mandatory field.
It's not nice giving feedback about ordinary events like that on a naked white page.
Hence the need for themed error pages.</description>
		<content:encoded><![CDATA[<p>The <code>wp_die()</code> function is called by WordPress every time a fatal error happen.<br />
Unluckily, WordPress has a quite broad concept of &#8220;fatal&#8221;, including stuff like comments omitting a mandatory field.<br />
It&#8217;s not nice giving feedback about ordinary events like that on a naked white page.<br />
Hence the need for themed error pages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-124</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Fri, 10 Aug 2007 14:38:46 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-124</guid>
		<description>Thanks Giorgio,
I get it!
So i if i dont include the '&#60;&#45;&#45;ERROR_MESSAGE&#45;&#45;&#62;' in the body of my custom page ( which i haven't) then the string replace is just ignored and the message stored in $message is lost. I am sure this is bad practice though.

So when else is the &lt;code&gt;wp_die()&lt;/code&gt; function be called?

cheers
andy</description>
		<content:encoded><![CDATA[<p>Thanks Giorgio,<br />
I get it!<br />
So i if i dont include the &#8216;&lt;&#45;&#45;ERROR_MESSAGE&#45;&#45;&gt;&#8217; in the body of my custom page ( which i haven&#8217;t) then the string replace is just ignored and the message stored in $message is lost. I am sure this is bad practice though.</p>
<p>So when else is the <code>wp_die()</code> function be called?</p>
<p>cheers<br />
andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-15</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Tue, 07 Aug 2007 17:21:38 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-15</guid>
		<description>Andy, my &lt;code&gt;die(str_replace('&#60;--ERROR_MESSAGE--&#62;', $message, file_get_contents(get_option('siteurl') . '/error')));&lt;/code&gt; statement works this way:
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;file_get_contents(...)&lt;/code&gt; fetches the content of page located at &lt;code&gt;get_option('siteurl') . '/error'&lt;/code&gt; or wherever you replaced '/error' with.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;str_replace(...)&lt;/code&gt; replaces the "&lt;code&gt;&#60;--ERROR_MESSAGE--&#62;&lt;/code&gt;" string you should have put in the body of your custom page with the actual error message (&lt;code&gt;$message&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;die(...)&lt;/code&gt; exits the scripts immediately after printing out the string prepared above.&lt;/li&gt;
&lt;/ol&gt;</description>
		<content:encoded><![CDATA[<p>Andy, my <code>die(str_replace('&lt;--ERROR_MESSAGE--&gt;', $message, file_get_contents(get_option('siteurl') . '/error')));</code> statement works this way:</p>
<ol>
<li><code>file_get_contents(...)</code> fetches the content of page located at <code>get_option('siteurl') . '/error'</code> or wherever you replaced &#8216;/error&#8217; with.</li>
<li><code>str_replace(...)</code> replaces the &#8220;<code>&lt;--ERROR_MESSAGE--&gt;</code>&#8221; string you should have put in the body of your custom page with the actual error message (<code>$message</code>)</li>
<li><code>die(...)</code> exits the scripts immediately after printing out the string prepared above.</li>
</ol>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-14</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Tue, 07 Aug 2007 17:07:10 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-14</guid>
		<description>Thanks Giorgio,

So the problem seemed to be step one. Creating the page in wordpress. Not sure why?

So I ended up creating my own error page in the theme editor, added it to my theme directory, then changed the path from '/error' to '/wp-content/themes/.../error.php' in the functions.php file.
And it worked great!

Not sure what i was doing wrong.

I have another question. What does the first argument refer to in the wp_die function?
in particular this part : &lt;code&gt;die(str_replace('&#60;--ERROR_MESSAGE--&#62;', $message,&lt;/code&gt;

As i don't have the page created as you recommend in step one what does the  now refer to?

cheers</description>
		<content:encoded><![CDATA[<p>Thanks Giorgio,</p>
<p>So the problem seemed to be step one. Creating the page in wordpress. Not sure why?</p>
<p>So I ended up creating my own error page in the theme editor, added it to my theme directory, then changed the path from &#8216;/error&#8217; to &#8216;/wp-content/themes/&#8230;/error.php&#8217; in the functions.php file.<br />
And it worked great!</p>
<p>Not sure what i was doing wrong.</p>
<p>I have another question. What does the first argument refer to in the wp_die function?<br />
in particular this part : <code>die(str_replace('&lt;--ERROR_MESSAGE--&gt;', $message,</code></p>
<p>As i don&#8217;t have the page created as you recommend in step one what does the  now refer to?</p>
<p>cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-12</link>
		<dc:creator>Giorgio</dc:creator>
		<pubDate>Tue, 07 Aug 2007 13:49:27 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-12</guid>
		<description>Hi Andy,
Could you please send me both your &lt;code&gt;page.php&lt;/code&gt; and the &lt;code&gt;wp-includes/functions.php&lt;/code&gt; you modified?
Does this problem happen with other pages as well?

This issue may depend on your url-rewriting options.
If they're not set to display your new made "Error" page  as &lt;code&gt;http://your.home.page&lt;b&gt;/error&lt;/b&gt;&lt;/code&gt;, this trick won't work.
You'll need to adjust the &lt;code&gt;file_get_contents(get_option('siteurl') . '&lt;b&gt;/error&lt;/b&gt;&apos;)&lt;/code&gt; statement to match the correct URL for your "Error" page.
Good luck and let me know.</description>
		<content:encoded><![CDATA[<p>Hi Andy,<br />
Could you please send me both your <code>page.php</code> and the <code>wp-includes/functions.php</code> you modified?<br />
Does this problem happen with other pages as well?</p>
<p>This issue may depend on your url-rewriting options.<br />
If they&#8217;re not set to display your new made &#8220;Error&#8221; page  as <code><a href="http://your.home.page" rel="nofollow">http://your.home.page</a><b>/error</b></code>, this trick won&#8217;t work.<br />
You&#8217;ll need to adjust the <code>file_get_contents(get_option('siteurl') . '<b>/error</b>&apos;)</code> statement to match the correct URL for your &#8220;Error&#8221; page.<br />
Good luck and let me know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hackademix.net/2007/07/31/themed-error-pages/#comment-9</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Tue, 07 Aug 2007 11:37:34 +0000</pubDate>
		<guid>http://hackademix.net/2007/07/31/themed-error-pages/#comment-9</guid>
		<description>Hi,
Can't seem to get this to work. I am using WP 2.2
I followed your instructions but when i type in mydomain.com/blog/error i get the following error 
Parse error: syntax error, unexpected '?' in /home/../public_html/blog/wp-content/themes/bello/page.php on line 16

But i dont see anything in page.php that is erroneous.

What do you think is happening? thanks</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Can&#8217;t seem to get this to work. I am using WP 2.2<br />
I followed your instructions but when i type in mydomain.com/blog/error i get the following error<br />
Parse error: syntax error, unexpected &#8216;?&#8217; in /home/../public_html/blog/wp-content/themes/bello/page.php on line 16</p>
<p>But i dont see anything in page.php that is erroneous.</p>
<p>What do you think is happening? thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
