<?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>Zac Vineyard's Blog</title>
	<atom:link href="http://zacvineyard.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://zacvineyard.com/blog</link>
	<description>code, design, videos, and other nonsense</description>
	<lastBuildDate>Thu, 22 Jul 2010 19:23:25 +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>Setting a GET Parameter as a Variable in Typoscript</title>
		<link>http://zacvineyard.com/blog/2010/07/06/setting-a-get-parameter-as-a-variable-in-typoscript/</link>
		<comments>http://zacvineyard.com/blog/2010/07/06/setting-a-get-parameter-as-a-variable-in-typoscript/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 15:31:55 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Typo3]]></category>
		<category><![CDATA[$_GET]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[tt_news]]></category>
		<category><![CDATA[typoscript]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=344</guid>
		<description><![CDATA[Recently I had a problem that, in spite of many "support leads" on other sites, was hard to figure out. All I wanted to do was reference as GET parameter in a URL as a variable in Typoscript. After many failed attempts, I found a solution to my problem. So, for future reference, and for all others who may be struggling with this problem, here is a solution.]]></description>
			<content:encoded><![CDATA[<p><a href="http://zacvineyard.com/blog/wp-content/uploads/2010/07/typo3.jpg"><img src="http://zacvineyard.com/blog/wp-content/uploads/2010/07/typo3.jpg" alt="" title="typo3" width="150" height="150" class="alignright size-full wp-image-352" /></a>Recently I had a problem that, in spite of many &#8220;support leads&#8221; on other sites, was hard to figure out. All I wanted to do was reference as GET parameter in a URL as a variable in Typoscript. After many failed attempts, I found a solution to my problem. So, for future reference, and for all others who may be struggling with this problem, here is a slice of example code that solved my problem:</p>
<blockquote class="overflow">

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">lib.featured &lt; plugin.tt_news
lib.featured {
    code &gt;
    code = LIST
    pid_list &gt;
    pid_list = 10064
    catImageMode = 1    
    catTextMode = 0
    categorySelection = TEXT
    categorySelection.data = GPvar : cat
    categoryMode = 1
    limit = 1
    singlePid = 1729
    general_stdWrap.crop = 300 |&lt;img src=&quot;fileadmin/templates/news/images/featured.png&quot; class=&quot;tag&quot; /&gt; ... | 1
    templateFile = fileadmin/templates/ext_templates/tt_news_student_life_feature.html
}</pre></div></div>

</blockquote>
<p>What I was trying to accomplish was changing news categories on a single page so that different news would display on a page simply by changing a category number. The two lines you should pay attention to above are:</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">categorySelection = TEXT
categorySelection.data = GPvar : cat</pre></div></div>

</blockquote>
<p>Here, the code &#8220;<code>GPvar : cat</code>&#8221; will get the value of a GET parameter named &#8220;cat&#8221; out of a URL like this:</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">http://www.example.com/index.php?id=7565&amp;cat=19</pre></div></div>

</blockquote>
<p>What I discovered was that, in order to use the GET parameter in Typoscript, I needed to <em>type</em> the variable in Typoscript before it could be referenced. Hence the &#8220;<code>categorySelection = TEXT</code>&#8221; code.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/07/06/setting-a-get-parameter-as-a-variable-in-typoscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse PHP in HTML Pages on GoDaddy Hosting</title>
		<link>http://zacvineyard.com/blog/2010/05/12/parse-php-in-html-pages-on-godaddy-hosting/</link>
		<comments>http://zacvineyard.com/blog/2010/05/12/parse-php-in-html-pages-on-godaddy-hosting/#comments</comments>
		<pubDate>Thu, 13 May 2010 04:02:16 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[GoDaddy]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=333</guid>
		<description><![CDATA[Sometimes it is helpful, mainly to avoid broken links, to make sure your html files (with a .htm or .html extension) can parse PHP. On GoDaddy hosting, this threw me for a loop.]]></description>
			<content:encoded><![CDATA[<p>Sometimes it is helpful, mainly to avoid broken links, to make sure your html files (with a .htm or .html extension) can parse PHP. Recently I was working on a GoDaddy hosted project where I needed this functionality but it wasn&#8217;t working as I had planned.</p>
<p>Usually, to get html files to parse PHP, I add this line of code to my Apache .htaccess file:</p>
<blockquote><p><code>AddType application/x-httpd-php .htm .html .php</code></p></blockquote>
<p>It is similar for GoDaddy hosting, but this is what you need:</p>
<blockquote><p><code>AddType application/x-httpd-php5 .htm .html .php<br />
AddHandler x-httpd-php5  .htm .html .php</code></p></blockquote>
<p>After you add that to your .htaccess file, your html files will parse PHP on GoDaddy hosting. Super handy!</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/05/12/parse-php-in-html-pages-on-godaddy-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.eduGuru: Organizing a Higher-Ed Online Media Stream</title>
		<link>http://zacvineyard.com/blog/2010/03/30/eduguru-organizing-a-higher-ed-online-media-stream/</link>
		<comments>http://zacvineyard.com/blog/2010/03/30/eduguru-organizing-a-higher-ed-online-media-stream/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 14:02:26 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[organization]]></category>
		<category><![CDATA[UX]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=329</guid>
		<description><![CDATA[I'm very happy to see my post "Organizing a Higher-Ed Online Media Stream" on .eduGuru. Thank you to Kyle James for letting me guest write for one of the best .edu blogs on the internet!]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2010/03/stream.jpg" alt="stream" title="stream" width="150" height="150" class="alignright size-full wp-image-330" />I&#8217;m very happy to see my post &#8220;Organizing a Higher-Ed Online Media Stream&#8221; on .eduGuru. Thank you to Kyle James for letting me guest write for one of the best .edu blogs on the internet!</p>
<blockquote><p>
The most important content on web sites it text. Images help ground a user&#8217;s experience and video can be quite captivating, but, ultimately, quality text it the champion of web content. Some developers will obviously argue against this point, but I don&#8217;t want this to be a discussion about visual design, but rather a discussion on how universities, who at some level operate like a traditional media outlets, can use their story, news, and event media to its fullest potential.
</p></blockquote>
<p><strong><a href="http://doteduguru.com/id4788-organizing-a-higher-ed-online-media-stream.html">Read the Full Article</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/03/30/eduguru-organizing-a-higher-ed-online-media-stream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Better PHP Upload and Rename Script</title>
		<link>http://zacvineyard.com/blog/2010/03/15/a-better-php-upload-and-rename-script/</link>
		<comments>http://zacvineyard.com/blog/2010/03/15/a-better-php-upload-and-rename-script/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 14:57:11 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=306</guid>
		<description><![CDATA[An earlier post of mine provides a fairly good example of a PHP script that renames a file as you upload it to a server. In this post, I've decided to take another look at that type of script and make it easier to use. I'm going to break the code you'll need into two parts: the HTML and the PHP.]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2010/03/upload_arrow.jpg" alt="upload_arrow" title="upload_arrow" width="150" height="150" class="alignright size-full wp-image-315" /><a href="http://zacvineyard.com/blog/2009/01/05/upload-and-rename-a-file-with-php/">An earlier post of mine</a> provides a fairly good example of a PHP script that renames a file as you upload it to a server. In this post, I&#8217;ve decided to take another look at that type of script and make it easier to use. I&#8217;m going to break the code you&#8217;ll need into two parts: the HTML and the PHP. Once you have this script on your server, make sure you create a writable folder (I call mine &#8220;upload&#8221;) on your server to contain your uploaded files.</p>
<h2>HTML</h2>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
	&lt;input type=&quot;file&quot; name=&quot;file&quot; id=&quot;file&quot;&gt;
	&lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;Submit&quot; value=&quot;Submit&quot;&gt;
&lt;/form&gt;</pre></div></div>

</blockquote>
<h2>PHP</h2>
<blockquote class="overflow">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Upload and Rename File</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$file_basename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// get file extention</span>
	<span style="color: #000088;">$file_ext</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #990000;">strripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// get file name</span>
	<span style="color: #000088;">$filesize</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;size&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$allowed_file_types</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.doc'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'.docx'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'.rtf'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'.pdf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_ext</span><span style="color: #339933;">,</span><span style="color: #000088;">$allowed_file_types</span><span style="color: #009900;">&#41;</span>  <span style="color: #339933;">&amp;&amp;</span>  <span style="color: #009900;">&#40;</span><span style="color: #000088;">$filesize</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">200000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// rename file</span>
		<span style="color: #000088;">$newfilename</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_basename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$file_ext</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;upload/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$newfilename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>		
			<span style="color: #666666; font-style: italic;">// file already exists error</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;You have already uloaded this file.&quot;</span><span style="color: #339933;">;</span>			
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>		
			<span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;tmp_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;upload/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$newfilename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;File uploaded successfully.&quot;</span><span style="color: #339933;">;</span>			
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_basename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
		<span style="color: #666666; font-style: italic;">// file selection error</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Please select a file to upload.&quot;</span><span style="color: #339933;">;</span>		
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>	
		<span style="color: #666666; font-style: italic;">// file type error</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Only these file typs are allowed for upload: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span><span style="color: #000088;">$allowed_file_types</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;tmp_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</blockquote>
<p>Having a script like this in your arsenal is a great tool. Developers often need to have a user upload a file back the server, making this script a nice trick in the bag. And if you look closely, it isn&#8217;t very complicated. In lines seven through eleven of the PHP, we define some variables that get used in the rest of the script. Pay particular attention to the array called <code>$allowed_file_types</code>. That array determines the types of files a user can upload with this script. You&#8217;ll also want to pay attention to line sixteen on the script, which is where we rename the file. I am just md5-ing the file name, but you can use anything you want here.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/03/15/a-better-php-upload-and-rename-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parse Google Calendar XML with Actionscript 3.0 the Right Way</title>
		<link>http://zacvineyard.com/blog/2010/02/25/parse-google-calendar-xml-with-as/</link>
		<comments>http://zacvineyard.com/blog/2010/02/25/parse-google-calendar-xml-with-as/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 16:49:25 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Calendar]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=252</guid>
		<description><![CDATA[If you ever sit down to try and parse Google calendar XML data in Actionscript (specifically AS3), you'll find that there is a lot of misinformation on the web, including many poor, broken examples of code. I'd like to try and demystify some of the problems behind parsing Google calendar XML by showing how it is done the right way.]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2010/02/cal.jpg" alt="cal" title="cal" width="150" height="148" class="alignright size-full wp-image-299" />If you ever sit down to try and parse Google calendar XML data in Actionscript (specifically AS3), you&#8217;ll find that there is a lot of misinformation on the web, including many poor, broken examples of code. I&#8217;d like to try and demystify some of the problems behind parsing Google calendar XML by showing how it is done the right way.</p>
<h2>How to Find the URL to Some Google Calendar XML</h2>
<p>Google does a great job of giving you direct access to the XML of any calendar that may appear on your personal calender. You even have the option of making your private calendars public, thereby getting access to your own calendar XML feed. In Google calendar, if you click Settings (Img.1), then click the first orange XML button (Img. 2), Google gives you a URL to your calendar&#8217;s XML. You must make the calendar you want to use in your AS3 project public.</p>
<div id="attachment_253" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-253" title="Click Settings" src="http://zacvineyard.com/blog/wp-content/uploads/2010/01/1.jpg" alt="Click Settings to find the Google Calendar XML URL" width="600" height="220" /><p class="wp-caption-text">Click Settings to find the Google Calendar XML URL for your AS3 project</p></div>
<div id="attachment_254" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-254" title="Click the Orange XML Button" src="http://zacvineyard.com/blog/wp-content/uploads/2010/01/2.jpg" alt="Click the Orange XML Button" width="600" height="220" /><p class="wp-caption-text">Click the Orange XML Button</p></div>
<p>Once you have the URL to your XML, you may want to append some sorting options to your XML.</p>
<h2>Sort Your XML Before You Use It</h2>
<p>By default, Google adds events to your XML by the date the event was created on the calendar, not by the event&#8217;s start date or end date. This is odd but there is a quick fix. By appending a little more data to your calendar URL, you have have sorted XML. I recommend adding this to the end of your URL:</p>
<blockquote><p><code>?orderby=starttime&amp;sortorder=ascending&amp;max-results=5</code></p></blockquote>
<p>Now that you have sorted, usable XML, let&#8217;s add it to your Actionscript.</p>
<h2>The Code</h2>
<p>Here is a short example of how to parse your Google Calender XML in Actionscript 3.0.</p>
<blockquote class="overflow">

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> xmlLoader<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLLoader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> xml_data<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">XML</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; 
xmlLoader.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">COMPLETE</span>, load_xml<span style="color: #000000;">&#41;</span>; 
&nbsp;
xmlLoader.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;http://www.google.com/calendar/feeds/0p18vi9o7tve7uokobk4irlhb4@group.calendar.google.com/public/full?orderby=starttime&amp;max-results=5&amp;singleevents=true&amp;sortorder=a&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> load_xml<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
&nbsp;
	xml_data = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">XML</span><span style="color: #000000;">&#40;</span>e.<span style="color: #004993;">target</span>.<span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span>;
	parse_xml<span style="color: #000000;">&#40;</span>xml_data<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> parse_xml<span style="color: #000000;">&#40;</span>xml_data<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #009900;">// Number of XML / Calendar Entries</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> numEntries<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = xml_data.<span style="color: #000000; font-weight: bold;">*::</span>entry.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">// Loop for Event Title and Summary</span>
	<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>; i<span style="color: #000000; font-weight: bold;">&lt;</span>numEntries; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #6699cc; font-weight: bold;">var</span> event_text = xml_data.<span style="color: #000000; font-weight: bold;">*::</span>entry<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #000000; font-weight: bold;">*::</span>title.<span style="color: #004993;">text</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #004993;">toXMLString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #6699cc; font-weight: bold;">var</span> eventStartDate = xml_data.<span style="color: #000000; font-weight: bold;">*::</span>entry<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #000000; font-weight: bold;">*::</span>summary.<span style="color: #004993;">text</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #004993;">toXMLString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>event_text<span style="color: #000000;">&#41;</span>;
		<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>eventStartDate<span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

</blockquote>
<p>If you have some basic knowledge of AS3 loaders, then this will not look very complicated. First, we create a new AS3 loader, which will grab our XML and load it up so we can put it to use. Once you actually deploy your flash site, you may need to use a PHP XML proxy file to spoof your sever into thinking the Google Calendar XML is local.</p>
<p>After we create the loader, we add an event listener that sends the data to our parse function after the data loads. Then, we&#8217;re off and running. Make sure you replace the Google URL with our own calendar URL (I have a demo in there now). You can also change which XML node data you&#8217;d like to get by the word &#8220;title&#8221; in the event_text variable with the name of another node in the XML. See below:</p>
<blockquote><p><code>xml_data.*::NODE_YOU_WANT[ARRAY_INDEX_NUMBER].*:: NODE_YOU_WANT.text().toXMLString();</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/02/25/parse-google-calendar-xml-with-as/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Back to Basics</title>
		<link>http://zacvineyard.com/blog/2010/02/02/back-to-basics/</link>
		<comments>http://zacvineyard.com/blog/2010/02/02/back-to-basics/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:00:16 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=223</guid>
		<description><![CDATA[I'm restructuring my blog to only focus on these languages and environments: Apache, PHP, MySQL, Javascript (usually via jQuery), XML, Actionscript, CSS, and HTML. Very rarely have I had to extend my reach out into other languages to accomplish the creation of a quality web page or web application.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been exploring the depths of web development for quite sometime now, and it occured to me yesterday that almost every single project I have ever worked on only uses the most basic and popular web development languages and environments. These are Apache, PHP, MySQL, Javascript (usually via jQuery), XML, Actionscript, CSS, and HTML. Very rarely have I had to extend my reach out into other languages to accomplish the creation of a quality web page or web application.</p>
<p>In light of this, I&#8217;m restructuring my blog to only focus on these languages and environments. I will also look at content management systems, but only in a limited scope. Most of my content management system talk will probably be connected with <a href="http://typo3.org">Typo3</a>.</p>
<p>And, because I am a higher-ed web professional, I may sneak in a few posts about marketing and web development from the university website perspective. </p>
<p>To kick things off, check out my latest post: <a href="http://zacvineyard.com/blog/2009/12/19/build-a-basic-authorize-net-payment-form/">Building a Basic Authorize.net Payment Form</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/02/02/back-to-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a Basic Authorize.net Payment Form</title>
		<link>http://zacvineyard.com/blog/2009/12/19/build-a-basic-authorize-net-payment-form/</link>
		<comments>http://zacvineyard.com/blog/2009/12/19/build-a-basic-authorize-net-payment-form/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 05:18:52 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[authorize.net]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[payment]]></category>
		<category><![CDATA[test.authorize.net]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=226</guid>
		<description><![CDATA[Getting a payment form that works can be tricky. But once you figure it out, you have the form as a reference forever. I'd like to show you how to build a basic Authorize.net payment form using HTML and PHP. Luckily, Authorize.net does a very good job providing documentation to web developers, making this form creation process very easy. ]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-277" title="shield" src="http://zacvineyard.com/blog/wp-content/uploads/2009/12/shield.jpg" alt="shield" width="150" height="190" />Getting a payment form that works can be tricky. But once you figure it out, you have the form as a reference forever. I&#8217;d like to show you how to build a basic Authorize.net payment form using HTML and PHP.</p>
<p>Luckily, Authorize.net does a very good job providing documentation to web developers, making this form creation process very easy.</p>
<p>This form is for Authorize.Net&#8217;s <a href="http://developer.authorize.net/api/aim/" target="_blank">Advanced Integrated Method</a>, the recommended connection method that offers the most security and flexibility.</p>
<p>The whole point of secure online transactions is that sensative information, especially credit card information, should never be stored in a database. That information should be used to handle a payment then immediately forgotten. Some online retailers save the last 4 digits of a credit card but only for recipt purposes. The form I will help you build will forget the credit card info, making it ultra safe. I will also show you how to log this form data in a database.</p>
<h2>Step 1: Database</h2>
<p>First we need a database. Here is a little SQL to get you going:</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`transaction_log`</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">`pid`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">`response_code`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">`payment_data`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">`response_data`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1 <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">5</span> ;</pre></div></div>

</blockquote>
<p>The record keeping system I use serializes data, which is very basic. This works to keep you out of tax problems (because you have a complete payment record) but it isn&#8217;t the best for a direct download because the data has to be un-serialized.</p>
<h2>Step 2: The HTML Form</h2>
<p>Now on the the HTML. I am going to append a little bit of Javascript and a touch of PHP into this HTML form.</p>
<blockquote class="overflow">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'run'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'payment_validation.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Payment gateway Form&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;form name=&quot;payment&quot; action=&quot;&quot; method=&quot;post&quot; onsubmit=&quot;document.getElementById('submit_button').disabled = 1;&quot;&gt;
	&lt;p&gt;&lt;input type=&quot;hidden&quot; name=&quot;page_id&quot; value=&quot;4&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;First Name&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;first_name&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Last Name&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;last_name&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Comments&lt;/label&gt;&lt;textarea name=&quot;comments&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Card Num&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;cc_card_num&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Expiration Date&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;cc_exp_date&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Amount&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;cc_amount&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;label&gt;Description&lt;/label&gt;&lt;input type=&quot;text&quot; name=&quot;cc_description&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;input name=&quot;submit&quot; id=&quot;submit_button&quot; type=&quot;submit&quot;&gt;&lt;/p&gt;
	&lt;p&gt;&lt;input type=&quot;hidden&quot; name=&quot;run&quot; value=&quot;true&quot;&gt;&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

</blockquote>
<p>It is good to take special note of the &#8220;onsubmit&#8221; attribute I&#8217;ve added to the form tag. This little snippet of Javascript prevents someone from accidentally clicking the submit button twice, thereby avoiding doubled transactions. The PHP at the top of the example HTML includes our payment validation script once the form is submitted. The &#8220;payment_validation.php&#8221; script it includes validates whether or not we have filled out all the form&#8217;s required fields. Now, some of these fields must be required because Authorize.net has a <a href="http://developer.authorize.net/guides/AIM/" target="_blank">set of required information</a> that they use for payment processing, including name, card number, etc. The PHP below just makes sure we have all that information.</p>
<h2>Step 3: Validation</h2>
<p>I am not going to go into to much more detail about form validation with PHP. That&#8217;s a topic for another tutorial. I will warn you, though, that the validation I use in this script is <em>very basic</em>. You should spend time making it stronger.</p>
<blockquote class="overflow">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$required_fields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'page_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'page_id'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'Amount'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'cc_amount'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'Credit Card Number'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'cc_card_num'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'Credit Card Expiration Date'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'cc_exp_date'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'Description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'cc_description'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> verify_data_present<span style="color: #009900;">&#40;</span><span style="color: #000088;">$required_fields</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Ensure we have some data</span>
		<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;strong&gt;No Post! Nothing to send to Authorize.net&lt;/strong&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Make sure that all of the required fields exist as keys in the post array</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$required_fields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; does not exist in post data and is required!&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; is a required field.&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_card_num'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Card number must be numeric!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_amount'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Amount must be a decimal of form x.xx without the dollar sign!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$value</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Verifty Required POST data isn't empty</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>verify_data_present<span style="color: #009900;">&#40;</span><span style="color: #000088;">$required_fields</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gateway.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;div class=&quot;</span>approved<span style="color: #0000ff;">&quot;&gt;Your transaction has been approved.&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</blockquote>
<h2>Step 4: The Gateway</h2>
<p>Near the end of this PHP script, you will see this line: <code>include('gateway.php');</code>. That is the magic PHP include that sends along the payment information to Authorize.net and, even if the payment fails, adds the transaction details to your database. Let&#8217;s take a look at that script now. I warn you, though, this PHP is intimidating at first glance.</p>
<blockquote class="overflow">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Settings</span>
<span style="color: #000088;">$post_url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;https://test.authorize.net/gateway/transact.dll&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;payments&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db_table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;transaction_log&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Setup the array with data to post to authorize.net</span>
<span style="color: #000088;">$post_values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">&quot;x_login&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;********&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Given to you by Authorize.net (make sure you replace!)</span>
	<span style="color: #0000ff;">&quot;x_tran_key&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;****************&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Given to you by Authorize.net (make sure you replace!)</span>
&nbsp;
	<span style="color: #0000ff;">&quot;x_version&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;3.1&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_delim_data&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;TRUE&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_delim_char&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;|&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_relay_response&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;FALSE&quot;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">&quot;x_type&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;AUTH_CAPTURE&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_method&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;CC&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_card_num&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_card_num'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_exp_date&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_exp_date'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #0000ff;">&quot;x_amount&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_amount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_description&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_description'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// The Values Below are Optional</span>
&nbsp;
	<span style="color: #0000ff;">&quot;x_first_name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;John&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_last_name&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Doe&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_address&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;1234 Street&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_state&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;CA&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;x_zip&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;90210&quot;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This section takes the input fields and converts them to the proper format</span>
<span style="color: #666666; font-style: italic;">// for an http post. For example: &quot;x_login=username&amp;amp;x_tran_key=a1B2c3D4&quot;</span>
&nbsp;
<span style="color: #000088;">$post_string</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post_values</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span> <span style="color: #000088;">$post_string</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$key</span>=&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$post_string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post_string</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp; &quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This sample code uses the CURL library for php to establish a connection,</span>
<span style="color: #666666; font-style: italic;">// submit the post, and record the response.</span>
<span style="color: #666666; font-style: italic;">// If you receive an error, you may want to ensure that you have the curl</span>
<span style="color: #666666; font-style: italic;">// library enabled in your php configuration</span>
&nbsp;
<span style="color: #000088;">$request</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// initiate curl object</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set to 0 to eliminate header info from response</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Returns response data instead of TRUE(1)</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$post_string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// use HTTP POST to send form data</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// uncomment this line if you get no gateway response.</span>
	<span style="color: #000088;">$post_response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// execute curl post and store results in $post_response</span>
	<span style="color: #666666; font-style: italic;">// additional options may be required depending upon your server configuration</span>
	<span style="color: #666666; font-style: italic;">// you can find documentation on curl options at http://www.php.net/curl_setopt</span>
	<span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// close curl object</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This line takes the response and breaks it into an array using the specified delimiting character</span>
<span style="color: #000088;">$response_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_values</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;x_delim_char&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$post_response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Before we allow the system to do anything with the
 * rest of the form data we need to make sure that the
 * credit card number gets removed to prevent sensitive
 * information from getting out just in case we are
 * compromised.
 */</span>
&nbsp;
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cc_card_num'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// remove the credit card info</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// **********************************************</span>
<span style="color: #666666; font-style: italic;">//     NOW WE CAN DO STUFF WITH THE RESPONSE</span>
<span style="color: #666666; font-style: italic;">// **********************************************</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Connect to the database</span>
<span style="color: #000088;">$mysqli</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_host</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_user</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_pass</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Check db connection</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_connect_errno</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_connect_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Store the form info</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$db_table</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; SET pid = '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', response_code = '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$response_array</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', payment_data = '&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;', response_data = '&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</blockquote>
<p>This script looks scary but it is quite straight forward. It starts with some basic variable declarations, which consist of database connection variables and a very important <code>$post_url</code>. This defines the URL we will use to POST data to Authorize.net. It is currently set to the default Authorize.net <em>test environment</em>. That way we don&#8217;t have to worry about actually spending money to experiment with this payment form.</p>
<p>The next part of this &#8220;gateway.php&#8221; script is an array of data called <code>$post_values</code>. This is the actual array of data that gets sent to Authorize.net. Notice the POST data we are adding from our form. That&#8217;s the real bread and butter of the whole process! More importantly, though, are two parts of this array that identify who you are to Authorize.net. They are the <code>x_login </code> and <code>x_tran_key</code>. I think of these as my username and password to Authorize.net. Make sure that when you get your login and key from Authorize.net (after your account setup) to keep them safe. You will have to add your login and key to this form. You can <a href="http://developer.authorize.net/testaccount/" target="_blank">request a test account</a> from Authorize.net.</p>
<p>After the <code>$post_values</code> array you&#8217;ll begin to see more complicated PHP. You do not need to edit this data. Whet you see is the initialization of a CURL object which handles the POST of our data to Authorize.net. It also handles the response we get, which tells us whether or not our payment was approved. That response gets added the <code>$post_response</code> array defined on line 55 of the &#8220;gateway.php&#8221; script.</p>
<p>After this CURL object (in the PHP) you&#8217;ll see a few lines of code that add the serialized POST data to our database, sans any credit card information. The credit card is stripped from our data on line 71 of the &#8220;gateway.php&#8221; script with the <code>unset($_POST['cc_card_num']);</code> command.</p>
<h2>Finished</h2>
<p>That&#8217;s it! Please take note that I echo the response array after the form is submitted. Interpreting this response can be challenging, but you can do it with help from the <a href="http://developer.authorize.net/guides/AIM/" target="_blank">Authorize.net Developer&#8217;s Guide</a>. This form is available for download.</p>
<h2>Thanks</h2>
<p>Thanks to <a href="http://ben.lobaugh.net/blog/">Ben Lobaugh</a> for his help with this script.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2009/12/19/build-a-basic-authorize-net-payment-form/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LitList Reborn</title>
		<link>http://zacvineyard.com/blog/2009/11/03/litlist-re-born/</link>
		<comments>http://zacvineyard.com/blog/2009/11/03/litlist-re-born/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 05:31:57 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=218</guid>
		<description><![CDATA[If you haven't seen it already, LitList, a project I started in 2007, just underwent a massive overhaul. I've been heavily developing a new platform for LitList, taking it away from previous functionality to add in many new features. It is now built on Codeigniter and I'm loving it.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://profile.ak.fbcdn.net/object3/416/29/n95607365613_9800.jpg" alt="" width="200" height="200" />If you haven&#8217;t seen it already, <a href="http://www.litlist.net">LitList</a>, a project I started in 2007, just underwent a massive overhaul. I&#8217;ve been heavily developing a new platform for LitList, taking it away from previous functionality to add in many new features. It is now built on <a href="http://codeigniter.com">Codeigniter</a> and I&#8217;m loving it.</p>
<p>New features include the ability to follow publishers and writers, a re-vamped contest page that&#8217;s sort-able, a place for publishers to add submission guidelines, and an activity wall that lets users see the announcements and updates from writers and publishers they follow.</p>
<p>I invite you to see the new LitList for yourself. Visit <a href="http://www.litlist.net">http://www.litlist.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2009/11/03/litlist-re-born/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript 3.0 SoundChannel Position Pause Bug</title>
		<link>http://zacvineyard.com/blog/2009/09/26/actionscript-3-0-soundchannel-position-pause-bug/</link>
		<comments>http://zacvineyard.com/blog/2009/09/26/actionscript-3-0-soundchannel-position-pause-bug/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 03:04:20 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=208</guid>
		<description><![CDATA[I spent my entire morning today trying to discover why I couldn't get a pause function to work properly on an actionscript 3.0 mp3 player. I came to find out that a very significant bug exists in actionscript that keeps channel.position (part of SoundChannel) from reporting the correct position location of a stopped mp3.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-213" title="as3" src="http://zacvineyard.com/blog/wp-content/uploads/2009/09/as3.jpg" alt="as3" width="200" height="200" />I spent my entire morning today trying to discover why I couldn&#8217;t get a pause function to work properly on an actionscript 3.0 mp3 player. I came to find out that a very significant bug exists in actionscript that keeps channel.position (part ofÂ <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundChannel.html">SoundChannel</a>) from reporting the correct position location of a stopped mp3. A few bloggers also talk about similar problems, and I list one link below.</p>
<h2>The Problem</h2>
<p>This is the heart of the problem: <strong>channel.position mis-reports the actual position of the audio for mp3 files less than 128kbps</strong>.</p>
<p>Files larger than 128kbps seem to work fine. It has also beenÂ suggestedÂ that in order for channel.position to work correctly, the mp3 audio must also sampled at 44.100kHz. It is also reported that Adobe has been notified of this bug.What surprised me the most about his endeavor is Adobe&#8217;s over-sight with theirÂ <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/media/SoundChannel.html">SoundChannel</a>. Not only is it, reportedly, loaded with bugs, but it also lacks basic functions. While we have aÂ <em>play()</em> andÂ <em>stop()</em>, for example, we aren&#8217;t given aÂ <em>pause()</em>.</p>
<p>I originally found information about this problem at <a href="http://www.stevensacks.net/2008/08/07/bug-with-sound-channel-position-and-mp3s-less-than-128kbps/">http://www.stevensacks.net/2008/08/07/bug-with-sound-channel-position-and-mp3s-less-than-128kbps/</a>.</p>
<h2>The Solution</h2>
<p>Until Adobe fixes this problem, re-sample your audio greater than 128kbps.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2009/09/26/actionscript-3-0-soundchannel-position-pause-bug/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress vs Drupal</title>
		<link>http://zacvineyard.com/blog/2009/07/30/wordpress-vs-drupal/</link>
		<comments>http://zacvineyard.com/blog/2009/07/30/wordpress-vs-drupal/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 16:27:31 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=177</guid>
		<description><![CDATA[This question is usually at the maelstrom of our storm: Which platform is better for my next project? To answer this, I want to point out the differences between Wordpress and Drupal.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-178 thumb" title="wordpress_drupal" src="http://zacvineyard.com/blog/wp-content/uploads/2009/07/wordpress_drupal.jpg" alt="wordpress_drupal" width="256" height="224" />There has been a wide variety of talk on the internet about different blogging platforms and content management systems, including ways to trick out  one system to act like the other. WordPress, reportedly the most widely used blogging platform, and Drupal, the most commonly used content management system in the US, are no exception to our discussions. This question is usually at the maelstrom of our storm: Which platform is better for my next project? To answer this, I want to point out the differences between WordPress and Drupal.</p>
<h2>WordPress</h2>
<p>WordPress is a system that comes hopped up on easy pills, and because of this, bloggers and developers love it equally. With WordPress 2.8, you can have a whole system online within a few minutes, including a pre-packaged theme. But this blogging platform also comes with some disadvantages.</p>
<p><strong>The Positives </strong></p>
<ul>
<li>WordPress is easy to install.</li>
<li>Thousands of extensions make WordPress flexible.</li>
<li>Online support in the WordPress Codex  is very good.</li>
<li>Easy to update.</li>
<li> Easy back-end navigation.</li>
<li>You don&#8217;t need to know much PHP.</li>
</ul>
<p>Getting a site out of idea land and into code is very easy with WordPress. After you run through the short install process, you have thousands of choices on ways to extend your WordPress install by using any number of extensions, some of which even make WordPress act more like a CMS. Take, for example, Sitemap Generator, a plugin that builds a site maps for WordPress sites. Developers would tell you that having a site map ready for Google to consume is essential. Other CMS-like plugins available for WordPress include user permissions extenders and plugins that give you hierarchical page navigation.</p>
<p>One thing you don&#8217;t need to worry about is WordPress&#8217; lack of support. Their support site is very thorough. Even learning about WordPress&#8217; specific functions is quite easy.   One more note about WordPress&#8217; positive aspects: since WordPress 2.8, you&#8217;ve been able to update the platform very easily. Literally with the click of a button, WordPress can get a new back-end.</p>
<p><strong>The Negatives </strong></p>
<ul>
<li>WordPress is too popular, and thus a major target for spammers.</li>
<li> Limited scope.</li>
</ul>
<p>The reason I mentioned the ease of being able to update WordPress is because, if left in a legacy state your Worpress install will eventually get hacked. Because of its popularity and its core blogging focus, spammers actively try to take advantage of WordPress to post spam comments and posts. But as long as you update your platform, the spammers stay at bay. Using Akismet also helps.</p>
<p>WordPress, too, when compared to other online content platforms, has a very limited scope. Its purpose is really to blog. So, if you are planning to build a site with multiple blogs, each of which have multiple authors, then look for a different platform. Or if you are planning to build a more dynamic site, one which frequently interacts with a database or collects data online, then WordPress probably isn&#8217;t for you.</p>
<h2>Drupal</h2>
<p>Do you look at a page of PHP and release a high-pitched squeal of excitement? If so, Drupal might throw you into cardiac arrest. While that might sound bad to WordPress lovers, Drupal is, in fact, very similar to WordPress in a number of ways. It too has good and bad properties.</p>
<p><strong>The Positives </strong></p>
<ul>
<li>Drupal is easy to install.</li>
<li>You can theme everything, including the back-end.</li>
<li>Online support is is very good.</li>
<li>Thousands of extensions are available.</li>
<li>You can build large sites.</li>
</ul>
<p>Since version 5, Drupal (which is in version 6 now) has had a similar step-though installation process to that of WordPress. But some call it more challenging. The install processes of both platforms seemed equal to me, neither of which were too complicates. As long as you know your database login information, you are fine.</p>
<p>Similarly too, Drupal has plenty of extensions. Installing extensions, too, is just like installing them in WordPress. Download the files and copy them into a plugin directory.</p>
<p>The major advantage you get from Drupal over WordPress is that you can build sites that go far beyond the blogging scope, though you can blog with Drupal too. Everyone from large corporations to small businesses use Drupal to give themselves a usable web space. Shopping cart systems, for example, are much more common in Drupal than in WordPress. If you use Drupal, however, don&#8217;t expect the ride to be as easy as it is on the WordPress train. Getting Drupal to do what you want can sometimes take writing your own PHP or modifying extensions, even though it gives you an excellent framework for adding content and pages to your site. And it comes with more robust architecture for you to exploit in sites, like the ability to add pages in a hierarchy.</p>
<p><strong>The Negatives </strong></p>
<ul>
<li> Building extensions requires a thorough knowledge of Drupal&#8217;s hook system.</li>
<li>You must be very well versed in HTML, CSS, and PHP.</li>
<li> Back-end navigation isn&#8217;t as friendly.</li>
<li>Less clear distinction between  front-end and back-end.</li>
</ul>
<p>Drupal, unlike WordPress, just isn&#8217;t as user friendly. There is less of a distinction between the back-end and the front-end of a Drupal site, which often made me feel confused about my location. I kept looking for a back-end, which is why I recommend skinning the back-end and front-end differently.   Also, Drupal&#8217;s back-end navigation isn&#8217;t as friendly. More clicking is involved to get you into CMS settings and content creation, whereas WordPress has everything conveniently organized in their back-end menu.</p>
<p>Those are some basic differences between Drupal and WordPress. Here&#8217;s what you should take to the bank: each of these systems can be used to blog, so take that as an excuse to learn both. Once you start blogging in Drupal, you may just turn into a PHP whiz that will never resort to simple blogging again. Or you might find yourself prepared to build more complicated sites for larger clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2009/07/30/wordpress-vs-drupal/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
