<?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>DEVTRENCH: Web Development from the Front Lines &#187; WordPress</title>
	<atom:link href="http://www.devtrench.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devtrench.com</link>
	<description>Web Development from the Front Lines</description>
	<lastBuildDate>Thu, 26 Aug 2010 03:22:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DEVTRENCH Blank Theme for Wordpress</title>
		<link>http://www.devtrench.com/blank-theme-for-wordpress/</link>
		<comments>http://www.devtrench.com/blank-theme-for-wordpress/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 03:57:43 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/?p=553</guid>
		<description><![CDATA[Sometimes when starting out a new Wordpress theme it&#8217;s nice to have something to start from that&#8217;s pretty bare, but has enough code so that you don&#8217;t feel like you&#8217;re reinventing the wheel.  I know there&#8217;s lots of blank themes out there, but I created my own and this is what I usually start from.  [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when starting out a new Wordpress theme it&#8217;s nice to have something to start from that&#8217;s pretty bare, but has enough code so that you don&#8217;t feel like you&#8217;re reinventing the wheel.  I know there&#8217;s lots of blank themes out there, but I created my own and this is what I usually start from.  It&#8217;s basically the default theme, stripped down with reset and typography CSS from blueprint.  This theme has very little &#8211; almost none &#8211; html markup, but includes the common php tags wordpress uses to display content.  This makes it ideal to start from because you just have to surround the php tags with your XHTML code.</p>
<div class='downloadit'><h3><a href="http://www.devtrench.com/download/devtrench_blank_1.0.zip" title="Downloaded 20 times">Download: DEVTRENCH Blank Theme</a></h3></div>
<p><span id="more-553"></span></p>
<p>If you use this theme here are a few steps to get your started and is basically the process I go through.  Before creating the Wordpress theme I&#8217;m assuming you have XHTML/CSS sources to work from.</p>
<ol>
<li>Copy your existing CSS into style.css</li>
<li>Copy your images into the images folder.  To make everything work right, I recommend using the same file structure as a wordpress theme with your CSS and image folder in the same directory.</li>
<li>Copy the html head and banner protion of your design into the header.php file.  The banner portion of your design is anything that is the same across all parts of your site.  Typically this is logo, menu, search bar, etc.</li>
<li>Copy the footer portion of your design into footer.html.  Like the banner, the footer is anything at the bottom of your design that is the same across all pages.</li>
<li>Next, start the homepage design.  You can use the index.php file or copy index.php to a home.php file.  Copy the necessary code from your design template into the wordpress template, surrounding the php tags with your code where necessary.</li>
<li>Then do the inside or single page template by modifying the single.php page.  Similar to the homepage you&#8217;ll take your inside page template code and surround the php code in single.php with it.</li>
</ol>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=553&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/blank-theme-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick and Dirty Wordpress Page Feed Plugin</title>
		<link>http://www.devtrench.com/quick-and-dirty-wordpress-page-feed-plugin/</link>
		<comments>http://www.devtrench.com/quick-and-dirty-wordpress-page-feed-plugin/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 15:49:48 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/?p=263</guid>
		<description><![CDATA[Since WordPress doesn't support rss feeds for pages out of the box and I needed it, I decided to write this plugin to satisfy my need for now.  Like the title says, this is quick and dirty, but it gets the job done. The next version of this plugin will be an RSS 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Since WordPress doesn't support rss feeds for pages out of the box and I needed it, I decided to write this plugin to satisfy my need for now.  Like the title says, this is quick and dirty, but it gets the job done. The next version of this plugin will be an RSS 2 feed.  I just wanted to get this out since I saw a lot of people asking about this in the WP forums.</p>
<p><strong>Download <a class="downloadlink" href="http://www.devtrench.com/download/wp-page-feeds.zip" title="Version 0.1 downloaded 329 times" >WordPress Page Feeds (873 bytes)</a></strong></p>
<pre class="brush: php;">
&lt;?php
/*
Plugin Name: WordPress Page Feeds
Plugin URI: http://www.devtrench.com/quick-and-dirty-wordpress-page-feed-plugin
Description: Adds functionality for rss feeds for pages
Version: 0.1
Author: James Ehly (aka devtrench)
Author URI: http://www.devtrench.com
*/

add_action('do_feed_page','do_feed_page');

function do_feed_page() {
  header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
  $more = 1;

  $pid = $_GET['pid'];
  if (is_numeric($pid ) &amp;&amp; !empty($pid)) {
    $pid = mysql_escape_string($pid);
    $pages = get_pages(array('child_of'=&gt;$pid,'sort_order'=&gt;'DESC'));
  } else {
    $pages = get_pages(array('sort_order'=&gt;'DESC'));
  }

  echo '&lt;?xml version=&quot;1.0&quot; encoding=&quot;'.get_option('blog_charset').'&quot;?'.'&gt;'; ?&gt;

&lt;rss version=&quot;0.92&quot;&gt;
&lt;channel&gt;
	&lt;title&gt;&lt;?php bloginfo_rss('name'); wp_title_rss(); ?&gt;&lt;/title&gt;
	&lt;link&gt;&lt;?php bloginfo_rss('url') ?&gt;&lt;/link&gt;
	&lt;description&gt;&lt;?php bloginfo_rss('description') ?&gt;&lt;/description&gt;
	&lt;lastBuildDate&gt;&lt;?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?&gt;&lt;/lastBuildDate&gt;
	&lt;docs&gt;http://backend.userland.com/rss092&lt;/docs&gt;
	&lt;language&gt;&lt;?php echo get_option('rss_language'); ?&gt;&lt;/language&gt;
	&lt;?php do_action('rss_head'); ?&gt;

&lt;?php foreach($pages as $page) { ?&gt;
	&lt;item&gt;
		&lt;title&gt;&lt;?=$page-&gt;post_title?&gt;&lt;/title&gt;
		&lt;description&gt;&lt;![CDATA[&lt;?=$page-&gt;post_content?&gt;]]&gt;&lt;/description&gt;
		&lt;link&gt;&lt;?php echo get_permalink($page-&gt;ID); ?&gt;&lt;/link&gt;
		&lt;?php do_action('rss_item'); ?&gt;
	&lt;/item&gt;
&lt;?php } ?&gt;
&lt;/channel&gt;
&lt;/rss&gt;
  &lt;?php
}
?&gt;
</pre>
<p>To use it, place the file in your plugins folder and then call your feed like this:</p>
<div class="igBar"><span id="lhtml-2"><a href="#" onclick="javascript:showPlainTxt('html-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-2">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">This will call all of your pages (the limit is set by the default post per page limit in WP)</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http://example.com/?feed=page</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">This will call only children of the page with an id of 30.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http://example.com/?feed=page<span style="color: #ddbb00;">&amp;pid=30 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I'll post back with an advanced version of this plugin once I get time to write it. Feel free to make feature requests here.</p>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=263&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/quick-and-dirty-wordpress-page-feed-plugin/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Fix Permissions After WordPress SVN Install</title>
		<link>http://www.devtrench.com/fix-permissions-after-wordpress-svn-install/</link>
		<comments>http://www.devtrench.com/fix-permissions-after-wordpress-svn-install/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 04:58:08 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpsuexe]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/?p=254</guid>
		<description><![CDATA[If you use WordPress for a lot of sites, installing it with SVN is really the way to go.  I've been switching over all of my blogs to use SVN since it makes updating sooooo much easier.  In fact, updating WordPress used to be my biggest gripe about the program, and now I [...]]]></description>
			<content:encoded><![CDATA[<p>If you use <a href="http://wordpress.org" target="_blank">WordPress </a>for a lot of sites, <a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion" target="_blank">installing it with SVN</a> is really the way to go.  I've been switching over all of my blogs to use SVN since it makes updating sooooo much easier.  In fact, updating WordPress used to be my biggest gripe about the program, and now I don't even give it a second thought - it really makes it that easy.</p>
<p>However if you are on a shared host like I am, then the checked out files might not have the right permissions for your setup.  My host is running PHPSuExe and that means that all executable files can only be writable by the user (644 for files and 755 for directories).  But the checked out files and directories are all writable by the group (664 and 775).  What to do?</p>
<p>I just SSH in, cd to the blog directory, and do a recursive chmod that removes the group write privilege from all files and folders.  For example if your blog is in the typical cpanel root:</p>
<p><code>cd public_html<br />
chmod -R g-w ./</code></p>
<p>Works every time.</p>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=254&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/fix-permissions-after-wordpress-svn-install/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Scrape an Entire Wordpress Blog</title>
		<link>http://www.devtrench.com/how-to-scrape-an-entire-wordpress-blog/</link>
		<comments>http://www.devtrench.com/how-to-scrape-an-entire-wordpress-blog/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 19:24:13 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/?p=186</guid>
		<description><![CDATA[When I find a new blog that I really like or think has some good information I usually want to read the whole thing, and in the past, I've been frustrated by how annoying it is to do it online.  I just want all posts in one document, free of ads, that I can [...]]]></description>
			<content:encoded><![CDATA[<p>When I find a new blog that I really like or think has some good information I usually want to read the whole thing, and in the past, I've been frustrated by how annoying it is to do it online.  I just want all posts in one document, free of ads, that I can read from start to finish.  </p>
<p>I've also been having the itch to learn the <a href="httpL://www.perl.org">Perl</a> programming language, and I thought this would be a good project to get my feet wet.</p>
<h3>Strategy</h3>
<p>Since the majority of blogs I read are in written in <a href="http://www.wordpress.org">WordPress</a>, it's pretty easy to take advantage of the GET string that can be used to access each post.  The GET string looks like <a href="http://www.devtrench.com/?p=2">http://www.devtrench.com/?p=2</a>.  Normally, post id's start with 1 and auto increment from there, so all we have to do is figure out what the id is of the latest post, and write some code that will loop over a scraper that many times.  Sometimes the latest post id will be hidden in the HTML of the post somewhere, and other times you just have to guess at it for a while until you figure it out.</p>
<h3>Code</h3>
<p>Here's the Perl code that I'm currently using to do this.  It's meant to be run from the command line, and I output the data to a file using '> output.txt' after the command.  Also, I ripped off most of this code from <a href="http://pleac.sourceforge.net/pleac_perl/">PLEAC-Perl</a>, which is an online Perl cookbook.  Cookbooks can really accelerate learning a language when you want to do specific tasks like this.</p>
<p>Hopefully this code is commented enough for you to understand what is going on.</p>
<div class="igBar"><span id="lperl-4"><a href="#" onclick="javascript:showPlainTxt('perl-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PERL:</span>
<div id="perl-4">
<div class="perl">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl -w </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># http://www.devtrench.com - How to Scrape a Wordpress Blog </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># These packages are required so load them</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">use</span> LWP::<span style="color: #006600;">UserAgent</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">use</span> HTTP::<span style="color: #006600;">Request</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">use</span> HTTP::<span style="color: #006600;">Response</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">use</span> URI::<span style="color: #006600;">Heuristic</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Usage: perl fetch_blog.pl http://www.domain.com highest_post_id start_pattern end_pattern</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$raw_url</span>&nbsp; = <a href="http://www.perldoc.com/perl5.6/pod/func/shift.html"><span style="color: #000066;">shift</span></a>; <span style="color: #808080; font-style: italic;"># should be the domain with http:// and no trailing slash</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$post_num</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/shift.html"><span style="color: #000066;">shift</span></a>; <span style="color: #808080; font-style: italic;"># this is the highest id number that you can find in the blog</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$start_pattern</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/shift.html"><span style="color: #000066;">shift</span></a>; <span style="color: #808080; font-style: italic;"># a start pattern to match. we don't want the entire page so find some unique text before the blog post. it's best to put the pattern in single quotes</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$end_pattern</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/shift.html"><span style="color: #000066;">shift</span></a>; <span style="color: #808080; font-style: italic;"># some unique text that signifies the end of a blog post</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$url</span> = URI::<span style="color: #006600;">Heuristic</span>::<span style="color: #006600;">uf_urlstr</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$raw_url</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$| = <span style="color: #cc66cc;color:#800000;">1</span>; <span style="color: #808080; font-style: italic;">#to flush next line </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># fire up a new user agent that can browse the web for us</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ua</span> = LWP::<span style="color: #006600;">UserAgent</span>-&gt;<span style="color: #006600;">new</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$ua</span>-&gt;<span style="color: #006600;">agent</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"DEVTRENCH.COM WordPress Post Fetcher v0.1"</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;"># give it time, it'll get there</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># now loop through all posts</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$i</span>=<span style="color: #cc66cc;color:#800000;">1</span>;<span style="color: #0000ff;">$i</span>&lt;=<span style="color: #0000ff;">$post_num</span>;<span style="color: #0000ff;">$i</span>++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;"># here we request each post from the site using the get string common to wordpress blogs</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$req</span> = HTTP::<span style="color: #006600;">Request</span>-&gt;<span style="color: #006600;">new</span><span style="color: #66cc66;">&#40;</span>GET =&gt; <span style="color: #0000ff;">$url</span>.<span style="color: #ff0000;">'/?p='</span>.<span style="color: #0000ff;">$i</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #0000ff;">$req</span>-&gt;<span style="color: #006600;">referer</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"http://www.devtrench.com"</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;"># perplex the log analysers</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$response</span> = <span style="color: #0000ff;">$ua</span>-&gt;<span style="color: #006600;">request</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$req</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$response</span>-&gt;<span style="color: #006600;">is_error</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;"># uh oh there was an error, probably a 404 which is caused by deleted or non published posts</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<a href="http://www.perldoc.com/perl5.6/pod/func/printf.html"><span style="color: #000066;">printf</span></a> <span style="color: #ff0000;">"&lt;p&gt;ERROR POST #$i: %s&lt;/p&gt;&lt;hr&gt;"</span>, <span style="color: #0000ff;">$response</span>-&gt;<span style="color: #006600;">status_line</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$content</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$content</span> = <span style="color: #0000ff;">$response</span>-&gt;<span style="color: #006600;">content</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$test</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$_</span> = <span style="color: #0000ff;">$content</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;"># this is the regular expression that will match the start and end pattern</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$test</span> = /\Q<span style="color: #0000ff;">$start_pattern</span>\E<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>\Q<span style="color: #0000ff;">$end_pattern</span>\E/<a href="http://www.perldoc.com/perl5.6/pod/func/s.html"><span style="color: #000066;">s</span></a><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$content</span> = $<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;"># this line prints out what the regex found as html, but it could easily be modified to print as plain text as well</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">"&lt;div class='fetcher_content'&gt;&lt;p&gt;&lt;b&gt;Post #$i&lt;/b&gt;&lt;/p&gt;"</span>.<span style="color: #0000ff;">$content</span>.<span style="color: #ff0000;">"&lt;/div&gt;&lt;hr&gt;"</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This was a fun experiment for me and a great way to finally get around to learning Perl.  I always find that if I create small tasks like this for myself that learning a language or framework is much more interesting and rewarding.  Now if you want to do this in PHP, which is what I usually program in, you can follow the same logic using <a href="http://us.php.net/curl">curl</a> as your user agent.</p>
<p>Hint 1: If you use this code as is it will print out HTML.  Surround the HTML that it generates with basic &lt;html&gt; and &lt;body&gt; tags and create your own styles in the &lt;head&gt;. Then you can view it in a web browser and print to PDF.  </p>
<p>Hint 2: The blog I was trying to scrape did not allow me to hotlink images from my HTML file, but saving the page as HTML from FireFox was a workaround for that, and then I saved that created page as a PDF. </p>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=186&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/how-to-scrape-an-entire-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Watch Out For Automatic Wordpress Updates</title>
		<link>http://www.devtrench.com/watch-out-for-automatic-wordpress-updates/</link>
		<comments>http://www.devtrench.com/watch-out-for-automatic-wordpress-updates/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 14:38:50 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/?p=181</guid>
		<description><![CDATA[After upgrading to Wordpress 2.5.x one of my favorite features has to be the automatic plugin updating.  But today, one DEVTRENCH reader alerted me that a certain download wasn't working. Well, as it turns out, none of the downloads that use the wp-DownloadMonitor plugin were working.  Seems like the new automatic upgrading system [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading to Wordpress 2.5.x one of my favorite features has to be the automatic plugin updating.  But today, one DEVTRENCH reader alerted me that a certain download wasn't working. Well, as it turns out, none of the downloads that use the wp-DownloadMonitor plugin were working.  Seems like the new automatic upgrading system changes the way that plugins can be made and after doing the auto upgrade of this plugin it ERASES your old download files with no warning! Of course if you read the README file for wp-DownloadMonitor it says it all in there, but you don't exactly get that information when clicking on upgrade in the Wordpress interface.  </p>
<p>From the README file:</p>
<blockquote><p>= Upgrade instructions from v2.0.6 =</p>
<p>Due to the new wordpress update system, the upload directory can no longer be within the plugin folder; wordpress deletes it. Therefore the plugin directory is now the uploads folder in the wp-content folder. ENSURE YOU MOVE DOWNLOADS HERE BEFORE UPGRADING! The plugin will convert the urls to the new directory on activation.</p></blockquote>
<p>This is stupid, and I was lucky, because I did a backup before upgrading to WP 2.5.1.  And BTW, it does not convert the urls - I had to do that manually in the database.</p>
<p>So, I think I'll be a little more careful about using the automatic plugin updates from now on and be doing a backup first.</p>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=181&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/watch-out-for-automatic-wordpress-updates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress.com Accounts are Fun</title>
		<link>http://www.devtrench.com/wordpresscom-accounts-are-fun/</link>
		<comments>http://www.devtrench.com/wordpresscom-accounts-are-fun/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 20:49:25 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/wordpresscom-accounts-are-fun/</guid>
		<description><![CDATA[I saw on twitter that doshdosh has a wordpress.com account so I thought it would be fun to sign up for one just to see what it is like.  I've always come at WP from the self hosted side of things and thought that the wordpress.com version would suck. I was pleasantly surprised that [...]]]></description>
			<content:encoded><![CDATA[<p>I saw on twitter that doshdosh has a wordpress.com account so I thought it would be fun to sign up for one just to see what it is like.  I've always come at WP from the self hosted side of things and thought that the wordpress.com version would suck. I was pleasantly surprised that it does not suck.  You can do pretty much anything you can do on a self install except have your own theme (looks to me like you can pay to have your own css).  There are lots of things that you can upgrade (ie pay for), and that is how they make money...that was always a mystery to me before.</p>
<p><a href="http://devtrench.wordpress.com">DEVTRENCH's Wordpress Dominion</a></p>
<p>I still wouldn't recommend blogging at a free host/blog tool, but at the very least you can use your account to get some links, I guess.</p>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=176&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/wordpresscom-accounts-are-fun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free Smilies for Your Wordpress Blog &#8211; SquareSmilies</title>
		<link>http://www.devtrench.com/free-smilies-for-your-wordpress-blog-squaresmilies/</link>
		<comments>http://www.devtrench.com/free-smilies-for-your-wordpress-blog-squaresmilies/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 07:59:59 +0000</pubDate>
		<dc:creator>James Ehly</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.devtrench.com/free-smilies-for-your-wordpress-blog-squaresmilies/</guid>
		<description><![CDATA[I've been kind of a dick lately ranting in the last few posts so decided I should be nicer.  Here are some free smilies for your wordpress blogs (or what ever you want to use them for).  These are fun to make! Learn how to make and install them here. 
Download SquareSmilies in [...]]]></description>
			<content:encoded><![CDATA[<p>I've been kind of a dick lately ranting in the last <a href="/things-that-suck-about-modx-cms/">few posts</a> so decided I should be nicer.  Here are some <strong>free smilies for your wordpress blogs</strong> (or what ever you want to use them for).  These are fun to make! Learn how to make and install them <a href="http://codex.wordpress.org/Using_Smilies">here</a>. </p>
<p><strong>Download SquareSmilies in zip format:</strong><br />
<a class="downloadlink" href="http://www.devtrench.com/download/square-smilies.zip" title="Version1 downloaded 76 times" >Square Smilies (76)</a></p>
<table  style='margin-top:10px;' border="0" cellpadding="2" width="90%"  align='center'>
<tbody>
<tr align='center'>
<th> icon </th>
<th> text </th>
<th> text </th>
<th> full text </th>
<th> icon </th>
<th> full text
</th>
</tr>
<tr align='center'>
<td><img alt="smile" src="http://www.devtrench.com/images/square-smilies/icon_smile.gif" border="0" height="15" width="15">
</td>
<td>&#58;)</p>
</td>
<td>&#58;-)
</td>
<td>&#58;smile&#58;
</td>
<td><img alt="lol" src="http://www.devtrench.com/images/square-smilies/icon_lol.gif" border="0" height="15" width="15">
</td>
<td>&#58;lol&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="biggrin" src="http://www.devtrench.com/images/square-smilies/icon_biggrin.gif" border="0" height="15" width="15">
</td>
<td>&#58;D
</td>
<td>&#58;-D
</td>
<td>&#58;grin&#58;
</td>
<td><img alt="redface" src="http://www.devtrench.com/images/square-smilies/icon_redface.gif" border="0" height="15" width="15">
</td>
<td>&#58;oops&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="sad" src="http://www.devtrench.com/images/square-smilies/icon_sad.gif" border="0" height="15" width="15">
</td>
<td>&#58;(
</td>
<td>&#58;-(</p>
</td>
<td>&#58;sad&#58;
</td>
<td><img alt="cry" src="http://www.devtrench.com/images/square-smilies/icon_cry.gif" border="0" height="15" width="15">
</td>
<td>&#58;cry&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="surprised" src="http://www.devtrench.com/images/square-smilies/icon_surprised.gif" border="0" height="15" width="15">
</td>
<td>&#58;o
</td>
<td>&#58;-o
</td>
<td>&#58;eek&#58;
</td>
<td><img alt="evil" src="http://www.devtrench.com/images/square-smilies/icon_evil.gif" border="0" height="15" width="15">
</td>
<td>&#58;evil&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="eek" src="http://www.devtrench.com/images/square-smilies/icon_eek.gif" border="0" height="15" width="15">
</td>
<td>8&#79;
</td>
<td>8-&#79;
</td>
<td>&#58;shock&#58;</p>
</td>
<td><img alt="twisted" src="http://www.devtrench.com/images/square-smilies/icon_twisted.gif" border="0" height="15" width="15">
</td>
<td>&#58;twisted&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="confused" src="http://www.devtrench.com/images/square-smilies/icon_confused.gif" border="0" height="15" width="15">
</td>
<td>&#58;?
</td>
<td>&#58;-?
</td>
<td>&#58;???&#58;
</td>
<td><img alt="rolleyes" src="http://www.devtrench.com/images/square-smilies/icon_rolleyes.gif" border="0" height="15" width="15">
</td>
<td>&#58;roll&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="cool" src="http://www.devtrench.com/images/square-smilies/icon_cool.gif" border="0" height="15" width="15">
</td>
<td>8&#41;
</td>
<td>8-&#41;
</td>
<td>&#58;cool&#58;
</td>
<td><img alt="exclaim" src="http://www.devtrench.com/images/square-smilies/icon_exclaim.gif" border="0" height="15" width="15"></p>
</td>
<td>&#58;!&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="mad" src="http://www.devtrench.com/images/square-smilies/icon_mad.gif" border="0" height="15" width="15">
</td>
<td>&#58;x
</td>
<td>&#58;-x
</td>
<td>&#58;mad&#58;
</td>
<td><img alt="question" src="http://www.devtrench.com/images/square-smilies/icon_question.gif" border="0" height="15" width="15">
</td>
<td>&#58;?&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="razz" src="http://www.devtrench.com/images/square-smilies/icon_razz.gif" border="0" height="15" width="15">
</td>
<td>&#58;P
</td>
<td>&#58;-P
</td>
<td>&#58;razz&#58;
</td>
<td><img alt="idea" src="http://www.devtrench.com/images/square-smilies/icon_idea.gif" border="0" height="15" width="15">
</td>
<td>&#58;idea&#58;</p>
</td>
</tr>
<tr align='center'>
<td><img alt="neutral" src="http://www.devtrench.com/images/square-smilies/icon_neutral.gif" border="0" height="15" width="15">
</td>
<td>&#58;|
</td>
<td>&#58;-|
</td>
<td>&#58;neutral&#58;
</td>
<td><img alt="arrow" src="http://www.devtrench.com/images/square-smilies/icon_arrow.gif" border="0" height="15" width="15">
</td>
<td>&#58;arrow&#58;
</td>
</tr>
<tr align='center'>
<td><img alt="wink" src="http://www.devtrench.com/images/square-smilies/icon_wink.gif" border="0" height="15" width="15">
</td>
<td>;&#41;
</td>
<td>;-&#41;
</td>
<td>&#58;wink&#58;
</td>
<td><img alt="mrgreen" src="http://www.devtrench.com/images/square-smilies/icon_mrgreen.gif" border="0" height="15" width="15">
</td>
<td>&#58;mrgreen&#58;
</td>
</tr>
</tbody>
</table>
<img src="http://www.devtrench.com/?ak_action=api_record_view&id=171&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.devtrench.com/free-smilies-for-your-wordpress-blog-squaresmilies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
