<?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>coffeecoders.de &#187; php</title>
	<atom:link href="http://coffeecoders.de/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://coffeecoders.de</link>
	<description>professional devs at work</description>
	<lastBuildDate>Thu, 11 Feb 2010 10:35:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Get rid off phpmail()!</title>
		<link>http://coffeecoders.de/2009/08/get-rid-off-phpmail/</link>
		<comments>http://coffeecoders.de/2009/08/get-rid-off-phpmail/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 13:06:29 +0000</pubDate>
		<dc:creator>stevie</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://coffeecoders.de/?p=222</guid>
		<description><![CDATA[Dear sysadmins and developers, phpmail() IS OUT! Get rid off it. Now! One of the most common sources of spam are &#8220;hacked&#8221; webservers and poorly or even non-secured forms. By using phpmail the webserver must be allowed to send mails without checks for a valid sender. This results &#8211; mostly on a shared web host [...]]]></description>
			<content:encoded><![CDATA[<p>Dear sysadmins and developers,</p>
<p><a href="http://www.php.net/phpmail">phpmail()</a> IS OUT! Get rid off it. Now!</p>
<p>One of the most common sources of spam are &#8220;hacked&#8221; webservers and poorly or even non-secured forms. By using phpmail the webserver must be allowed to send mails without checks for a valid sender. This results &#8211; mostly on a shared web host &#8211; in having checking every clients installations for the bad script while the mailserver gets blacklisted due to the spam wave.<br />
<span id="more-222"></span><br />
There are enough possibilities out there on how to send mail without using phpmail such as <a href="http://pear.php.net/package/Net_SMTP/">PEAR Net_SMTP</a>. I even encourage every webmaster to turn off phpmail by blacklisting this function in php.ini. This way the developers would be forced to name an smtp account for sending mail which is <em>much</em> easier to track (and shut off if neccessary).</p>
]]></content:encoded>
			<wfw:commentRss>http://coffeecoders.de/2009/08/get-rid-off-phpmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Zend Framework 1.8 Bootstrapper and Doctrine 1.1.0</title>
		<link>http://coffeecoders.de/2009/06/using-the-zend-framework-18-bootstrapper-and-doctrine-110/</link>
		<comments>http://coffeecoders.de/2009/06/using-the-zend-framework-18-bootstrapper-and-doctrine-110/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 12:59:19 +0000</pubDate>
		<dc:creator>Daff</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://coffeecoders.de/?p=221</guid>
		<description><![CDATA[I think that by now, the Zend Framework is one of the most sophisticated PHP frameworks available. Additionally I really like the idea of Object Relational Mapper tools. Unfortunately the Zend Frameworks DB and ORM capabilities didn&#8217;t convince me yet. That&#8217;s where the powerful ORM tool for PHP named Doctrine comes into play. It is [...]]]></description>
			<content:encoded><![CDATA[<p>I think that by now, the <a href="http://framework.zend.com/">Zend Framework</a> is one of the most sophisticated PHP frameworks available.<br />
Additionally I really like the idea of <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">Object Relational Mapper</a> tools. Unfortunately the Zend Frameworks DB and ORM capabilities didn&#8217;t convince me yet. That&#8217;s where the powerful ORM tool for PHP named <a href="http://www.doctrine-project.org/">Doctrine</a> comes into play.<br />
It is fairly easy to get Doctrine and the Zend Framework (here I&#8217;m usually referring to the MVC part) working together,<br />
but in my opinion that might not use the full potential of these two Frameworks put together.<br />
So I started developing a wrapper Framework which I named &#8211; in the lack of a better name <img src='http://coffeecoders.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  &#8211; Cuckoo.<br />
At this point in developmnent it only offers ZF 1.8 bootstrap classes for Doctrine and an application wrapper which makes using Doctrine and ZF together easier. A sample application is included as well, I hope it works more or less out of the box.</p>
<p>The next steps will be a Zend Form derivate that can generate forms by using the meta information from your doctrine<br />
model but stays fully customizable as well as cool Ajax/ExtJs support.</p>
<p><a href="http://coffeecoders.de/wp-content/uploads/2009/06/cuckoo_prealpha.zip">Download 0.001 PreAlpha</a></p>
]]></content:encoded>
			<wfw:commentRss>http://coffeecoders.de/2009/06/using-the-zend-framework-18-bootstrapper-and-doctrine-110/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a simple pagination to your site</title>
		<link>http://coffeecoders.de/2009/02/adding-a-simple-pagination-to-your-site/</link>
		<comments>http://coffeecoders.de/2009/02/adding-a-simple-pagination-to-your-site/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 02:19:28 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://coffeecoders.de/?p=184</guid>
		<description><![CDATA[or: the dangerousness of simple mathematics I guess many people had this problem before and I think everybody managed to solve this quite similar. Anyways, just in case this is useful for anybody: here&#8217;s how I added a pagination to a site recently. Given you have an array of products for example. Or maybe search [...]]]></description>
			<content:encoded><![CDATA[<h3>or: the dangerousness of simple mathematics</h3>
<p>I guess many people had this problem before and I think everybody managed to solve this quite similar. Anyways, just in case this is useful for anybody: here&#8217;s how I added a pagination to a site recently.</p>
<p>Given you have an array of products for example. Or maybe search results, a list of articles&#8230; something like that. Unfortunately they are too many to display them on a single page. Well, sure, you could but let&#8217;s be honest: that isn&#8217;t an option as the page would exceed its &#8220;scrollable-with-no-harm-to-scroll-fingers&#8221; length. And you don&#8217;t want to get sued by your visitors, right <img src='http://coffeecoders.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Ok, so you&#8217;re going to add a nice pagination to your site, so that everybody is happy.<br />
What I found out to be a bit tricky was to calculate the actual number of pages. We need that number so that we know, how many page links we will show next to our current view.<br />
<span id="more-184"></span><br />
Two simple examples to illustrate the probelm:<br />
Let&#8217;s say we have <strong>8</strong> items. <strong>8 divided by 4 is 2</strong>, so we&#8217;re going to need two pages. No big deal, right?<br />
Okay then we try this with <strong>9</strong> items. <strong>9 divided by 4 gives us 2.25</strong>. So we will clearly need a 3rd page for product number 9, but how do we calculate this from our result?<br />
<code><br />
$itemcount = $res-&gt;length();<br />
$pagemin = $itemcount / 4;<br />
$pagemax = ceil($itemcount / 4);<br />
if ( $pagemax - intval($pagemin) === 1) ) {<br />
$pages = $pagemax;<br />
} else {<br />
$pages = intval($pagemin);<br />
}<br />
</code></p>
<h3>The code explained</h3>
<p>That&#8217;s why I compare two values here: the actual division result and the next bigger integer. Now we try to find out if both values differ. If they do, we have a scenario where we do want another page, so we pick the bigger result as our page number. If not we are just happy and use the smaller number.</p>
<p>So now that we know our actual page count we can do something (slightly simplified) like this:</p>
<p><code><br />
while($i = 0;$i &lt; $pages; $i++) {<br />
print '&lt;a href="?page=' . $i . '"&gt;Page ' . $i . '';<br />
}<br />
</code></p>
<div id="attachment_192" class="wp-caption aligncenter" style="width: 499px"><img class="size-full wp-image-192" src="http://coffeecoders.de/wp-content/uploads/2009/02/pagination.jpg" alt="A pagination helps to navigate through long lists of items" width="489" height="134" /><p class="wp-caption-text">A pagination helps to navigate through long lists of items</p></div>
<p>With a little bit of styling this even looks nice. And of course, this is just a start. You also might want to add &#8220;previous&#8221; and &#8220;next buttons&#8221;, or those &#8220;first page&#8221;, &#8220;last page&#8221; buttons, limit the maximum number of page links shown, or you could center the currently viewed page in the middle, hide the previous button on the first page, etc&#8230; There are a lot of fine tuning options that will improve the user experience of your pagination.</p>
]]></content:encoded>
			<wfw:commentRss>http://coffeecoders.de/2009/02/adding-a-simple-pagination-to-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP5&#8242;s XMLWriter</title>
		<link>http://coffeecoders.de/2009/01/using-php5s-xmlwriter/</link>
		<comments>http://coffeecoders.de/2009/01/using-php5s-xmlwriter/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 18:04:58 +0000</pubDate>
		<dc:creator>stevie</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://coffeecoders.de/?p=95</guid>
		<description><![CDATA[The Class library of PHP5 offers a possibility to easily generate valid XML-files. Sadly the documentation and the usage examples are very poor on this topic so PHPBuilder Forum member iceomnia decided to do something about it and wrote a quick howto on this subject. With that information you can jump right into the code [...]]]></description>
			<content:encoded><![CDATA[<p>The Class library of PHP5 offers a possibility to easily generate valid XML-files.</p>
<p>Sadly the documentation and the usage examples are very poor on this topic so <a href="http://www.phpbuilder.com/board/index.php">PHPBuilder Forum</a> member <a href="http://www.phpbuilder.com/board/member.php?u=189469">iceomnia</a> decided to do something about it and wrote a quick howto on this subject.</p>
<p>With that information you can jump right into the code and generate your own XML files within minutes. Have fun&#8230;</p>
<p>Link: <a href="http://www.phpbuilder.com/columns/iceomnia_20090116.php3">PHPBuilder.com, the best resource for PHP tutorials, templates, PHP manuals, content management systems, scripts, classes and more.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://coffeecoders.de/2009/01/using-php5s-xmlwriter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework Book: Surviving The Deep End</title>
		<link>http://coffeecoders.de/2009/01/zend-framework-book-surviving-the-deep-end/</link>
		<comments>http://coffeecoders.de/2009/01/zend-framework-book-surviving-the-deep-end/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 19:17:39 +0000</pubDate>
		<dc:creator>stevie</dc:creator>
				<category><![CDATA[common]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://coffeecoders.de/?p=86</guid>
		<description><![CDATA[For all those who always wanted to try out Zend&#8217;s Framework for PHP or just struggle with the usage of it, Pádraic Brady published an Open Book about that topic named &#8220;Surviving The Deep End&#8220;. Maybe it&#8217;ll help you through the hard time figuring out the basics or solving specific issues. Link: Zend Framework Book: [...]]]></description>
			<content:encoded><![CDATA[<p>For all those who always wanted to try out <a title="Homepage of the Zend Framework" href="http://framework.zend.com/">Zend&#8217;s Framework for PHP</a> or just struggle with the usage of it, Pádraic Brady published an Open Book about that topic named &#8220;<em>Surviving The Deep End</em>&#8220;.</p>
<p>Maybe it&#8217;ll help you through the hard time figuring out the basics or solving specific issues.</p>
<p>Link: <a href="http://www.survivethedeepend.com/">Zend Framework Book: Surviving The Deep End</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://coffeecoders.de/2009/01/zend-framework-book-surviving-the-deep-end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
