<?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>Brandon&#039;s Blog &#187; PHP</title>
	<atom:link href="http://www.foszor.com/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.foszor.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 01 Sep 2011 21:26:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Server Logs: when XML and PHP have sex</title>
		<link>http://www.foszor.com/blog/2008/10/server-logs-when-xml-and-php-have-sex/</link>
		<comments>http://www.foszor.com/blog/2008/10/server-logs-when-xml-and-php-have-sex/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 18:02:34 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.foszor.com/blog/?p=62</guid>
		<description><![CDATA[My homey Chad has introduced me to the usage of XML. At first, I really didn&#8217;t know much about it besides the fact RSS feeds use it. But now the more I learn the more I love it. When we wrote the logs for Gear, we had a couple of choices. We could bloat a [...]]]></description>
			<content:encoded><![CDATA[<p>My homey Chad has introduced me to the usage of <a href="http://en.wikipedia.org/wiki/XML">XML</a>. At first, I really didn&#8217;t know much about it besides the fact RSS feeds use it. But now the more I learn the more I love it.</p>
<p>When we wrote the logs for Gear, we had a couple of choices. We could bloat a MySQL database with tons of log events, write it all to a flat file, or devise something new. Which chose the latter and our answer was XML. With the ability to store attributes and content, have parents and all sorts of hierarchy&#8230; its easily one of the best decisions we&#8217;ve made.</p>
<p>But when we get back to the topic of having the website and game servers talk, we run into a hiccup. All our events are stored in different sub tables; which means the log has a tables like &lt;chatlog&gt; and &lt;eventlog&gt;. Yeah that&#8217;s all fine and dandy, and we love how it turned out&#8230; but what happens when people want to view said logs? They aren&#8217;t shuffled together in chronological order&#8230; they&#8217;re all separate. <strong>SHIT FUCK DAMN!</strong></p>
<p>Putting them together in order wasn&#8217;t as easy as it should have been. Well actually I&#8217;m lying; it <em>was</em> easy once I figured out <em>how</em> to do it. That&#8217;s the thing about programming/scripting/developing custom shit: its not that the syntax or platform limits your ability to do something, or that it requires butt-loads of work&#8230; its being creative enough to figure out how to fucking do it. <strong>WHRY?!?</strong> Because not everything you want to do has been done by someone else in easy <a href="http://en.wikipedia.org/wiki/Copypasta">copypasta</a> format.</p>
<p><a href="http://www.foszor.com/blog/wp-content/uploads/2008/10/logs.png" class="highslide" onclick="return hs.expand(this)"><img src="http://www.foszor.com/blog/wp-content/uploads/2008/10/logs-150x150.png" alt="Server Logs" title="Server Logs" width="150" height="150" class="alignright size-thumbnail wp-image-69" /></a>When I started working on it I was looking for some PHP command that <a href="http://en.wiktionary.org/wiki/automagical">automagically</a> did it for me, and I think that was my problem. When trolling the PHP manual website and furiously searching Google for &#8220;put my XML in order&#8221; was no help, I decided to do it on my own.</p>
<p>Basically it came down to putting all the data into an array, and then sorting said array with the <a href="http://us3.php.net/usort">usort</a> function. <a href="http://www.youtube.com/watch?v=V0UNCnDTEBA">SUCCESS!</a></p>
<p>The only thing left was to display the data in a readable format. So mix in a tad of HTML, add a pinch of CSS&#8230; blend until sexy and you&#8217;ve got a finished product!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.foszor.com/blog/2008/10/server-logs-when-xml-and-php-have-sex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a CMS</title>
		<link>http://www.foszor.com/blog/2008/10/writing-a-cms/</link>
		<comments>http://www.foszor.com/blog/2008/10/writing-a-cms/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:02:29 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Website]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.foszor.com/blog/?p=32</guid>
		<description><![CDATA[*** Preface: For those who want to further read about what a CMS is click here A content management system (CMS) is a computer application used to create, edit, manage, and publish content in a consistently organized fashion So the last website design I cooked up was pretty neat, but I&#8217;m remaking it (see my [...]]]></description>
			<content:encoded><![CDATA[<p><small>*** Preface: For those who want to further read about what a CMS is click <a href="http://en.wikipedia.org/wiki/Content_management_system">here</a></small></p>
<blockquote><p>A content management system (CMS) is a computer application used to create, edit, manage, and publish content in a consistently organized fashion</p></blockquote>
<p>So the last website design I cooked up was pretty neat, but I&#8217;m remaking it (<em>see my previous post to understand why</em>). The other thing I&#8217;m focusing on is the script that drives the site. Last time it was a rudimentary PHP script that just spit out content. This time I&#8217;ve taken a step back and decided to do it <strong>RIGHT</strong>.</p>
<p>I&#8217;m going to write it myself from the ground up. Its easy enough to go with some prepackaged script some nerds put together, but then I&#8217;ll end up hacking the shit out of it to make it do what I want&#8230; so whats the point in using it in the first place? The other reason to write this myself is because the website interacts with the game server so much; I want to make sure I have as much control over this as possible.</p>
<p>Here&#8217;s some cool things I&#8217;ve learned that you should all use at one point or another in a PHP script:</p>
<ul>
<li>Classes. Use classes or you&#8217;re and idiot. Object orientated programming is your friend.</li>
<li><a href="http://us3.php.net/ob_start">ob_start</a>&#8230; look this function up and harness its power.</li>
<li>Just like any application, make your web applications modular. God kicks a puppy in the face every time you don&#8217;t.</li>
<li>Comment your code. Even if you&#8217;re the only person that&#8217;s ever going to look at it, it helps you debug and sometimes even reminds you what the fuck you were thinking.</li>
</ul>
<p>I don&#8217;t think I&#8217;ll make a template system. I&#8217;ll just make a hybrid index.php that renders the basic site layout and calls functions to display content. I&#8217;ve tossed around the idea of making templates, but I think its a waste of time for what my needs are.</p>
<p>I&#8217;m still working on the new site design&#8230; I&#8217;m getting closer. One step closer I guess, but now I&#8217;m off to play some Xbox 360.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.foszor.com/blog/2008/10/writing-a-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

