<?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>Michael Kretz</title>
	<atom:link href="http://www.michaelkretz.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.michaelkretz.com</link>
	<description>Michael Kretz is a Web Designer, Front-end Developer and Game Developer</description>
	<lastBuildDate>Sat, 04 Jun 2011 19:25:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Simple PHP pagination function</title>
		<link>http://www.michaelkretz.com/coding/simple-php-pagination-function</link>
		<comments>http://www.michaelkretz.com/coding/simple-php-pagination-function#comments</comments>
		<pubDate>Thu, 26 May 2011 08:41:55 +0000</pubDate>
		<dc:creator>kretzm</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[page numbers]]></category>
		<category><![CDATA[paginate]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.michaelkretz.com/?p=124</guid>
		<description><![CDATA[The McCodes v2 game engine is quite minimal in a sense that it doesn’t with a lot of functionality to improve the interface of the game. It is up to the community to develop features and modifications to offer such necessary functions. Below is my PHP pagination function that I created. It is quite simple, but it ...]]></description>
			<content:encoded><![CDATA[<p>The McCodes v2 game engine is quite minimal in a sense that it doesn’t with a lot of functionality to improve the interface of the game. It is up to the community to develop features and modifications to offer such necessary functions. Below is my PHP pagination function that I created. It is quite simple, but it does the job well.</p>
<p><strong>Features</strong></p>
<ul>
<li>can be used anywhere in your game</li>
<li>ability to customize how many pages are displayed in the spread</li>
<li>CSS styled pagination elements</li>
<li>First Page and Last Page buttons</li>
</ul>
<p><strong>How to Use</strong></p>
<p>The pagination function calls for 5 arguments; $total, $action, $page, $perpage, $spread.</p>
<ul>
<li>$total: the total number of entries to use in your pagination. Ex. If this function was used for your events, you would need to send in the total number of events for the given user.</li>
<li>$action: the function requires you to use a $_GET action parameter to send the user back to the correct page. If you are using a different parameter, or not using a parameter at all, the function can be easily modified to accomodate</li>
<li>$page: what page the user is currently on</li>
<li>$perpage: how many instances you want to display (default 25)</li>
<li>$spread: the maximum number of pages you want to show between the first and last button (default 5)</li>
</ul>
<p>The function will print out the page list and will return the value of the current page that you are on, so that you can use it in your query. The returned value will be whatever page the user is currently on multiplied by the total number of instances per page. This will be used as the starting value for your loop (in my case a MySQL query).</p>
<p><strong>CODE</strong></p>
<pre class="brush: php; title: ;">
/* ------- pagination function -------
$total: number of instances to consider
$page: what page the user is on
$perpage: sorting how many instances per page is shown
$action: the action for the vent (ex. ?action=index)
$spread: how many page option links sit between the first and last links
*/

function pagination($total, $action, $page = 1, $perpage = 25, $spread = 5)
{
	global $db;

	//return nothing as the total number of instances is less than the per page sort
	if($total &lt; $perpage) {
		return 0;
	}
	$page=abs(intval($page));

	//Calculate the last page
	$lastpage=floor($total/$perpage);

	//Class for page links
	$span_pre=&quot;&lt;span class='pagelist'&gt;&quot;;
	$span_suf=&quot;&lt;/span&gt;&quot;;

	//Color styling for page link that the user is on
	$font_pre=&quot;&lt;font color='#00FF33' weight='bold'&gt;&quot;;
	$font_suf=&quot;&lt;/font&gt;&quot;;

	//checking what the distance is away from the median of the spread (rounded to highest int)
	$spread_dist=intval($spread/2);

	//check if the total number of instances is great enough that first and last links are needed.
	$totalspread=$spread+2;
	if(($total/$perpage) &gt;= $totalspread)
	{
		//Only show first link when player isn't viewing the first page
		if($page &gt; ($spread_dist+1)) {
			//Show First link
			print &quot;&lt;a href='?action=$action&amp;page=1'&gt;&quot;.$span_pre.&quot;&lt;&lt; First&quot;.$span_suf.&quot;&lt;/a&gt;..&quot;;
			$start_point = $page-$spread_dist;
			$end_point = $spread;
		}
		else {
			//Player is on first page already
			$start_point=1;
		}

		//Only show last link when player isn't viewing the last page
		if($page &lt; ($lastpage-($spread_dist))) {
			//Show last link
			$lastlink=&quot;..&lt;a href='?action=$action&amp;page=$lastpage'&gt;&quot;.$span_pre.&quot;Last &gt;&gt;&quot;.$span_suf.&quot;&lt;/a&gt;&quot;;
			$end_point = $page+$spread_dist+1;
			if($start_point == 1) {
				$end_point = $start_point + $spread;
			}
		}
		else {
			//Player is on last page already
			$end_point=$lastpage+1;
			if($end_point &gt; ($lastpage - $spread_dist)) {
				$start_point=$lastpage-$spread+1;
			}
		}

		//Inbetween pages
		for ($x = $start_point; $x &lt; $end_point; $x++) {
			if($x==$page) {
				print&quot;&lt;a href='?action=$action&amp;page=$x'&gt;&quot;.$span_pre.$font_pre.$x.$font_suf.$span_suf.&quot;&lt;/a&gt;&quot;;
			}
			else {
				print&quot;&lt;a href='?action=$action&amp;page=$x'&gt;&quot;.$span_pre.$x.$span_suf.&quot;&lt;/a&gt;&quot;;
			}
		}

		print $lastlink;

		return ($page-1)*$perpage;
	}
	else {
		for ($x = 1; $x &lt;= $lastpage+1; $x++) {
			if($x==$page) {
				print&quot;&lt;a href='?action=$action&amp;page=$x'&gt;&quot;.$span_pre.$font_pre.$x.$font_suf.$span_suf.&quot;&lt;/a&gt;&quot;;
			}
			else {
				print&quot;&lt;a href='?action=$action&amp;page=$x'&gt;&quot;.$span_pre.$x.$span_suf.&quot;&lt;/a&gt;&quot;;
			}
		}

		return ($page-1)*$perpage;
	}
}
</pre>
<p>Code also displayed at: <a title="Make Web Games" href="http://www.makewebgames.com/showthread.php/39356-Pagination-Function" target="_blank">http://www.makewebgames.com/showthread.php/39356-Pagination-Function</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelkretz.com/coding/simple-php-pagination-function/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Fresh Start</title>
		<link>http://www.michaelkretz.com/general/a-fresh-start</link>
		<comments>http://www.michaelkretz.com/general/a-fresh-start#comments</comments>
		<pubDate>Wed, 18 May 2011 14:40:39 +0000</pubDate>
		<dc:creator>kretzm</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[eptonic]]></category>
		<category><![CDATA[fresh]]></category>
		<category><![CDATA[fringethech]]></category>
		<category><![CDATA[kretz]]></category>
		<category><![CDATA[michael kretz]]></category>
		<category><![CDATA[michaelkretz]]></category>
		<category><![CDATA[re-design]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[refresh]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themeforest]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.michaelkretz.com/?p=81</guid>
		<description><![CDATA[After residing on my to-do list for quite some time, I can finally cross off &#8220;re-design website&#8221;. It was really difficult for me to get motivated to re-design michaelkretz.com, what with my internship in Geneva Switzerland, my game (Blade of Eternity) to manage and develop for, and the fact that I would rather looking up ...]]></description>
			<content:encoded><![CDATA[<p>After residing on my to-do list for quite some time, I can finally cross off &#8220;re-design website&#8221;. It was really difficult for me to get motivated to re-design michaelkretz.com, what with my internship in Geneva Switzerland, my game (<a title="Blade of Eternity" href="http://www.bladeofeternity.com" target="_blank">Blade of Eternity</a>) to manage and develop for, and the fact that I would rather looking up all the latest updates and techniques for PHP, AJAX, jQuery instead of re-working my online identity. My internship is ending in 2 and a half months and I needed to promote myself and my work through my digital identity. The static web site built for my 4th year pre-thesis class would just not cut it anymore, not if I wanted to look attractive to potential employers. I work best under pressure, so over the past couple weeks I&#8217;ve put pressure on myself to design a nice looking resume, and re-design my website, so that my job applications would look attractive.</p>
<p>My previous website was built as an HTML site with a jQuery slider to show off my previous work. There was not really any thought to scalability or flexibility, as the point of it was to show off my work and to get a good grade. Blogging was not something that I saw myself doing so I never attempted to incorporate any blogging tools or CMS into my site. It was a nice site for its time, and I did end up getting a very good mark on it, however it was time to transition to the professional realm and build a website that I would consistently update and maintain. Also, I believe that by blogging, I will challenge myself to learn more, show-off my non-design work, and build my credibility as a web designer and front-end developer.</p>
<p><strong>So that brings me to the web site re-design.</strong><br />
It didn&#8217;t go as smoothly as I had hoped.<br />
I chose to use a theme for my website as I&#8217;ve worked with WordPress before, but nothing overly extensive. I also didn&#8217;t have the time to spend learning how to make a new theme. So I shopped around for some good looking themes that I could modify into my own. I came across a very clean and promising theme on <a title="ThemeForest" href="http://themeforest.net" target="_blank">themeforest.net</a> called &#8220;Fringetech&#8221;. After testing out the live preview, I decided to make the purchase (my first ever). For about a week, I tried to customize the theme to my likings. I just wanted to have a home page (with recent blog updates, some information about<a title="Blade of Eternity" href="http://www.bladeofeternity.com" target="_blank"> Blade of Eternity</a> and contact details), a portfolio page and a blog page. After getting most of the web site customizations in, I hit a road block when trying to work with the posts. It seems that the Fringetech creator had decided to move away from the core WordPress post system and use his own blog modification. This didn&#8217;t work so well, as many plugins would not work correctly, and blog posts were not stored in the default database location. Moving to another theme would be a nightmare. I tried to work with a bit more to, but it was just not worth the time and effort, so I ended up requesting a refund.</p>
<p><strong>My advice: DON&#8217;T PURCHASE THE FRINGETECH THEME</strong></p>
<p>Perhaps I was a bit too hasty in buying the theme, but it did teach me a lot of about how WordPress is structured, and gave me some experience modifying it. Nevertheless, I had to find myself another theme. My search led me the theme <a title="Eptonic theme on themeforest" href="http://themeforest.net/item/eptonic-beyond-the-limits/241366" target="_blank">Eptonic on themeforest</a>, which is the theme that my website ended up being built upon. The creator made it really easy to add customize content and I only had to modify some areas to get the desired functionality. There are some kinks that need to be worked out still, but I am quite happy with the end result.</p>
<p>Thus, I present to you, my website michaelkretz.com.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelkretz.com/general/a-fresh-start/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

