<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Hugh Fletcher</title>
	
	<link>http://hughfletcher.com</link>
	<description>What Can The Web Do For You?</description>
	<lastBuildDate>Sun, 07 Feb 2010 04:13:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/hughfletcher/qQtQ" /><feedburner:info uri="hughfletcher/qqtq" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Safe mailto links in Wordpress using CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/hughfletcher/qQtQ/~3/PlUi3OSMvU8/</link>
		<comments>http://hughfletcher.com/blog/safe-mailto-links-in-wordpress-using-codeigniter/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 20:19:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://hughfletcher.com/?p=48</guid>
		<description><![CDATA[Recently I did a half-way makeover of my site/blog that included removing the contact page that only one, count them, one person ever used.  Now granted it was a guy from Microsoft I had recently met and contacted me about a job opportunity, I never the less decided to get rid of the whole [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I did a half-way makeover of my site/blog that included removing the contact page that only one, count them, one person ever used.  Now granted it was a guy from Microsoft I had recently met and contacted me about a job opportunity, I never the less decided to get rid of the whole contact page thing and simply put an email link in my <a href="about">about page</a>.  Wanting to obfuscate it from evil email harvesters, Wordpress by default doesn&#8217;t offer a easy way of doing this within a post.  That&#8217;s where the Wordpress shortcode API and CodeIgniter come in.</p>
<p><span id="more-48"></span></p>
<p>Wordpress has a cool feature that allows you to create shortcodes to put in your posts like <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">[bartag foo="foo-value"]</span> and then process it using a PHP function.   Go <a title="Wordpress Shortcode API" href="http://codex.wordpress.org/Shortcode_API">to the codex page</a> and check it out, it&#8217;s pretty straight forward.  Next go grab you a copy of CodeIgniter, crack it open and go to system/helpers/url_helper.php.  Snatch the safe_mailto() function and paste it in your code.  I put mine in the functions page in the theme for quickness but you can put it in a plug in if your up for all that.  Now underneath the CI function ,  write you a function that takes the attributes and content from the shortcode and then call the safe_mailto() function.  You should end up with something like below. That&#8217;s it! Now you can have protected and obfuscated email links in your posts! </p>
<pre class="brush: php;">
//The CodeIgniter function
if ( ! function_exists('safe_mailto'))
{
	function safe_mailto($email, $title = '', $attributes = '')
	{
		// The actual function. You get the drift...
	}
}

// The function to process the shortcode
function maillink_func($atts, $content = null) {
	extract(shortcode_atts(array(
		'email' =&gt; get_bloginfo ( 'admin_email' ),
                'title' =&gt; null,
                'class' =&gt; null,
                'id'    =&gt; null,
                'style' =&gt; null
                //add more attributes if you want them, but add below too!
	), $atts));

        return safe_mailto($email, $content, array(
                'class' =&gt; $class,
                'id' =&gt; $id,
                'style' =&gt; $style
            ));
}

//Register the shortcode with Wordpress
add_shortcode('maillink', 'maillink_func');

// Usage
// [maillink email=&quot;someone@somewhere.com&quot;]
// [maillink email=&quot;someone@somewhere.com&quot; class=&quot;link&quot;]Email Me![/maillink]</pre>
<img src="http://feeds.feedburner.com/~r/hughfletcher/qQtQ/~4/PlUi3OSMvU8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hughfletcher.com/blog/safe-mailto-links-in-wordpress-using-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hughfletcher.com/blog/safe-mailto-links-in-wordpress-using-codeigniter/</feedburner:origLink></item>
		<item>
		<title>How to start blogging, Part Hugh</title>
		<link>http://feedproxy.google.com/~r/hughfletcher/qQtQ/~3/F8hhCv2bMGs/</link>
		<comments>http://hughfletcher.com/blog/how-to-start-blogging-part-hugh/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 07:08:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Noteworthy]]></category>

		<guid isPermaLink="false">http://hughfletcher.com/?p=1</guid>
		<description><![CDATA[In part Hugh of my series  &#8217;How to start blogging&#8217; I explain how to start a blog, progressively once a year change the design and then make a  post proclaiming your new change and the silly reasons you did it.  In this yearly post you should also mention apologies for not posting anything else except maybe one, [...]]]></description>
			<content:encoded><![CDATA[<p>In part Hugh of my series  &#8217;How to start blogging&#8217; I explain how to start a blog, progressively once a year change the design and then make a  post proclaiming your new change and the silly reasons you did it.  In this yearly post you should also mention apologies for not posting anything else <a title="Linking External Style Sheets In Codeigniter" href="http://hughfletcher.com/blog/linking-external-style-sheets-in-codeigniter/">except maybe one</a>, and then state how you &#8216;plan&#8217; on doing better.  After doing this for several years, including during all this  time change the urls to some of your pages including your RSS feed and you will successfully confuse anyone trying to follow your site. And that&#8217;s the Part Hugh of it.</p>
<p><span id="more-1"></span></p>
<p>So yea I changed the site again but for the better I think (ugh here we go again).  No I won&#8217;t  go all into it with my reasons for this and that, just that I like it, I think it will work for me based on what I&#8217;m doing now a days,  and we&#8217;ll just see how the whole thing goes.</p>
<p>Thanks for dropping by!</p>
<img src="http://feeds.feedburner.com/~r/hughfletcher/qQtQ/~4/F8hhCv2bMGs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hughfletcher.com/blog/how-to-start-blogging-part-hugh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hughfletcher.com/blog/how-to-start-blogging-part-hugh/</feedburner:origLink></item>
		<item>
		<title>Linking External Style Sheets In CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/hughfletcher/qQtQ/~3/Vv8Q1Wsd6U8/</link>
		<comments>http://hughfletcher.com/blog/linking-external-style-sheets-in-codeigniter/#comments</comments>
		<pubDate>Sun, 21 Oct 2007 21:47:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://hughfletcher.com/?p=71</guid>
		<description><![CDATA[Having been working with CodeIgniter for about two years now,  I have always struggled with how to structure my themes.  This past week I came up with what seems to be such an obvious solution for external css handling in CodeIgniter, that I was surprised I haven&#8217;t read about it elsewhere.  Perhaps [...]]]></description>
			<content:encoded><![CDATA[<p>Having been working with <a title="CodeIgniter" href="http://codeigniter.com">CodeIgniter</a> for about two years now,  I have always struggled with how to structure my themes.  This past week I came up with what seems to be such an obvious solution for external css handling in CodeIgniter, that I was surprised I haven&#8217;t read about it elsewhere.  Perhaps it&#8217;s so obvious that most felt it need not to be mentioned, however I would have loved to come across something like this long ago.</p>
<p><span id="more-71"></span></p>
<p>Before I start, credit must be given for my inspiration to the <a title="Rapyd For CodeIgniter" href="http://www.rapyd.com">Rapyd</a> dev team.  A lot of where I got this process from was due to how Rapyd has it&#8217;s samples set up in it&#8217;s distribution.  The Rapyd samples pre-load a view filled with css and then plants it inline into the final view that is outputted.  I liked the idea of having my css organized with my views, but didn&#8217;t want it inline with the rest of the html.  Here&#8217;s how linking it externally can simply be done&#8230;</p>
<p>First set up a controller, maybe say named &#8216;themes&#8217;, and inside that controller we will set up a &#8217;style&#8217; function. First in that style function were going to set the header and tell the browser that this will be a style sheet.  It&#8217;s very important you do this, otherwise the browser should disregard it, or at least I know in <a class="zem_slink" title="Firefox" rel="homepage" href="http://www.mozilla.com/en-US/firefox/">Firefox</a> it will.  Next we&#8217;ll call the view containing the css.</p>
<pre class="brush: php;">class Themes extends Controller {
   function index () {
      //do something
   }

   function style() {
      $this-&gt;output-&gt;set_header(&quot;Content-type: text/css&quot;);
      $this-&gt;load-&gt;view('themes/style');
   }
}</pre>
<p>Now we will just call this controller from our final output view,  or however you have your views embedded, in a link statement in your head area like so&#8230;</p>
<pre class="brush: xml;">&lt;link href=&quot;http://mysite.com/themes/style&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</pre>
<p>An alternate way of doing this&#8230;</p>
<pre class="brush: php;">function style() {
   header(&quot;Content-type: text/css&quot;);
   echo $this-&gt;load-&gt;view('themes/style', null, true);
}</pre>
<p>However this method seems a little redundant to just use only a part of <a class="zem_slink" title="CodeIgniter" rel="homepage" href="http://www.codeigniter.com">CodeIgniter</a>&#8217;s abilities.  But it might show someone how to apply this method in an regular php application.  Douglas Clifton has a good article at <a title="Generating Dynamic CSS with PHP" href="http://www.digital-web.com/articles/generating_dynamic_css_with_php/">Digital Web Magazine</a> on doing it the non-CodeIgniter &#8220;style&#8221;.</p>
<p>Of course their is much more functionality you could add to your themes controller, but going into all that is beyond what I wanted to do here.  Theme changing and adding dynamic variables within your &#8216;css&#8217; views are just a start, and my meager little mind is thinking of many others, if I play with it more I&#8217;ll let ya know how it goes.</p>
<img src="http://feeds.feedburner.com/~r/hughfletcher/qQtQ/~4/Vv8Q1Wsd6U8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://hughfletcher.com/blog/linking-external-style-sheets-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://hughfletcher.com/blog/linking-external-style-sheets-in-codeigniter/</feedburner:origLink></item>
	</channel>
</rss>
