<?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>altrugon.com &#187; PHP</title>
	<atom:link href="http://www.altrugon.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.altrugon.com</link>
	<description>El blog de altrugon</description>
	<lastBuildDate>Fri, 10 Dec 2010 22:15:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP short-hand IF/Else statement</title>
		<link>http://www.altrugon.com/php/php-short-hand-ifelse-statement-php-abreviacion-del-condicional-ifelse/</link>
		<comments>http://www.altrugon.com/php/php-short-hand-ifelse-statement-php-abreviacion-del-condicional-ifelse/#comments</comments>
		<pubDate>Tue, 12 May 2009 16:30:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[condicional if corto]]></category>
		<category><![CDATA[short if statement]]></category>

		<guid isPermaLink="false">http://www.altrugon.com/?p=299</guid>
		<description><![CDATA[Let&#8217;s keep it simple: Regular way: if (statement) { $variable = "return this if true"; } else { $variable = "return this if false"; } Short way: $variable = (statement) ? "return if true" : "return if false"; And this is how it works: statement ? if-true : if-false]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s keep it simple:</p>
<p><strong>Regular way:</strong></p>
<pre>
<code>if (statement) {
  $variable = "return this if true";
}
else {
  $variable = "return this if false";
}
</code></pre>
<p><strong>Short way:</strong></p>
<pre><code>$variable = (statement) ? "return if true" : "return if false";</code></pre>
<p>And this is how it works: <strong>statement ? if-true : if-false</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.altrugon.com/php/php-short-hand-ifelse-statement-php-abreviacion-del-condicional-ifelse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache &#8211; display server errors on screen</title>
		<link>http://www.altrugon.com/php/apache-display-server-errors-on-screen/</link>
		<comments>http://www.altrugon.com/php/apache-display-server-errors-on-screen/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 00:16:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.altrugon.com/wpblog/2008/02/18/apache-display-server-errors-on-screen.html/en/</guid>
		<description><![CDATA[Let&#8217;s say that you are developing in PHP and something goes wrong and you end with a blank page instead of the expecting php page&#8230; great! what happened, where is the error? Well, now you have to open the error log and check for the last lines to have a clue of where did you [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say that you are developing in PHP and something goes wrong and you end with a blank page instead of the expecting php page&#8230; great! what happened, where is the error?</p>
<p><span id="more-37"></span></p>
<p>Well, now you have to open the error log and check for the last lines to have a clue of where did you place your fat finger. Wouldn&#8217;t be nice if that error was display on your screen, of course it would.</p>
<p>Here is the piece of code that you need to add to your httpd.conf file:</p>
<pre><code>&lt;IfModule mod_php5.c&gt;
# ...
php_value display_errors on
# ...
&lt;/IfModule&gt;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.altrugon.com/php/apache-display-server-errors-on-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the top parent page in WordPress</title>
		<link>http://www.altrugon.com/php/get-the-top-parent-page-in-wordpress/</link>
		<comments>http://www.altrugon.com/php/get-the-top-parent-page-in-wordpress/#comments</comments>
		<pubDate>Wed, 21 Mar 2007 04:38:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.altrugon.com/wpblog/2007/03/20/get-the-top-parent-page-in-wordpress.html</guid>
		<description><![CDATA[A couple of days ago I found myself with the issue of getting the top parent of any page (that one which doesn&#8217;t have any father), so after look in WordPress documentation I found a nice function called get_page_hierarchy() and also no documentation about it. Without documentation about the function it was going to be [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I found myself with the issue of getting the top parent of any page (that one which doesn&#8217;t have any father), so after look in WordPress documentation I found a nice function called <strong>get_page_hierarchy()</strong> and also no documentation about it. <span id="more-27"></span>Without documentation about the function it was going to be a little bit tricky to know wheter or not this was what I was looking for, so I decided create my own function to receive the <em>post_name</em> of the top parent page. As soon I started I realized that my knowledges about recursivity were a little bit rusty, but I got it &#8230; <img src='http://www.altrugon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is the code:</p>
<pre><code>&lt;?php
//return the name of the top parent page base on a page_id
function getTopParentPostName($myid){
	$mypage = get_page($myid);

	if ($mypage-&gt;post_parent == 0){
		return $mypage-&gt;post_name;
	}
	else{
		return getTopParentPostName($mypage-&gt;post_parent);
	}

}?&gt;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.altrugon.com/php/get-the-top-parent-page-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

