<?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>CodeJoust Blog &#187; code</title>
	<atom:link href="http://iain.codejoust.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://iain.codejoust.com</link>
	<description>Iain's thoughts, ideas, interests from CodeJoust</description>
	<lastBuildDate>Wed, 07 Jul 2010 21:05:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress Quick Tip</title>
		<link>http://iain.codejoust.com/2010/02/wordpress-quick-tip/</link>
		<comments>http://iain.codejoust.com/2010/02/wordpress-quick-tip/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 00:50:19 +0000</pubDate>
		<dc:creator>Code Dude</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://iain.codejoust.com/?p=315</guid>
		<description><![CDATA[There are times when you might want to display your blog posts on a page other than the blog page in Wordpress. To successfully do this, requires a short piece of PHP code. For example, you could show your latest work on the homepage on your website. Here&#8217;s the code I used to show my [...]]]></description>
			<content:encoded><![CDATA[<p>There are times when you might want to display your blog posts on a page other than the blog page in Wordpress. To successfully do this, requires a short piece of PHP code. For example, you could show your latest work on the homepage on your website. Here&#8217;s the code I used to show my latest work on a portfolio I was building for myself. </p>
<p>There is however, something else that made this extra hard. I wanted to integrate it with the Jquery <a href="http://fancybox.net/">Fancybox</a> plugin. To do required some extra code that didn&#8217;t make things simpler. </p>
<p>The basic code outline for using Fancybox for your images is this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;the url to the normal sized version of the image&quot; title=&quot;The name of the image” class=&quot;zoom&quot;&gt;
&lt;img src=&quot;the url to thumbnail sizes version of the image&quot; /&gt;
&lt;/a&gt;</pre></div></div>

<p>This presents some problems with integrating this into Wordpress. Here how I changed it to work with Wordpress posts.</p>
<p><img class="hide" style="display:none;" src="http://iain.codejoust.com/wp-content/uploads/2010/02/php1.png" alt="php" width="556" height="225" class="alignnone size-full wp-image-324" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$postslist</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts=3&amp;order=ASC&amp;orderby=title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postslist</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> 
	setup_postdata<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> 
	&lt;div class=&quot;project&quot;&gt;
		&lt;a class=&quot;zoom&quot; 
                      rel=&quot;group&quot;
                      title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;
                      href=&quot;wp-content/themes/starkers/style/images/<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.png&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	        &lt;/a&gt;
	&lt;h4&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h4&gt; 
	&lt;/div&gt;			
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The first 4 lines are the php that grab the posts. (Note I set it to show the 3 latest posts.)<br />
In the 5th line I enclose each post in a div with an id of &#8220;project&#8221;.<br />
In the 6th line, there are the basic Fancybox classes that make it work in this particular image.<br />
On the 7th line, I set the name of the image to the title of the post<br />
On the 8th line, I set the url of the normal sized version of the image, in this case it was an image in the theme&#8217;s image folder. Notice how I used &#8220;the_title();&#8221; in the url to make it dynamic for each post.<br />
On the 9th line I just set it to grab the content of the post<br />
10th line-closing out the link<br />
On the 11th line I grab the title of the post<br />
And then close the div and end the foreach statement.</p>
<p>There is one thing you have to do manually to make this work. Set a unique category for the posts to be used here. In this case I used the category &#8220;1&#8243;</p>
<p>Also, the body of the post must only have the small version of the image in it. </p>
<p>Pretty cool, heh?</p>
]]></content:encoded>
			<wfw:commentRss>http://iain.codejoust.com/2010/02/wordpress-quick-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Background Changer</title>
		<link>http://iain.codejoust.com/2009/05/html-background-changer/</link>
		<comments>http://iain.codejoust.com/2009/05/html-background-changer/#comments</comments>
		<pubDate>Mon, 04 May 2009 18:07:53 +0000</pubDate>
		<dc:creator>Iain</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://iain.codejoust.com/?p=40</guid>
		<description><![CDATA[Hi Everyone!
I recently have had a few comments about the background image changer.
This post is for those who wish to do this on their blog etc.
The code is under a creative commons license (you need to keep in the comment by blah&#8230; etc)
&#8212;
&#8211; In this demo I will be using &#8220;-your image url-&#8221; as &#8220;http://img.wherever.com/image.jpg&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone!</p>
<p>I recently have had a few comments about the background image changer.<br />
This post is for those who wish to do this on their blog etc.<br />
The code is under a creative commons license (you need to keep in the comment by blah&#8230; etc)<br />
&#8212;<br />
&#8211; In this demo I will be using &#8220;-your image url-&#8221; as &#8220;http://img.wherever.com/image.jpg&#8221; etc. and &#8221; /*-your color-*/ &#8221; as a hex color code (can get those here http://www.colorschemer.com/online.html) which are preceded by a # and are 6 digits, color names can work also. (get rid of /*- and the */ when inserting your value, repace it with the other string.</p>
<p>The code:</p>
<p>In your blogger edit layout tab there is another tab that says edit html.<br />
Put this code right before the in the blog html add :</p>
<p><code>background-color: /*-your defalt color here-*/ !important;<br />
background-position: /*-possible values here are top, bottom, and center, left, right-*/ !important;<br />
background-image: url(/*-your background url-*/) !important;</code><br />
<code>/*background code changer by JPN3 Consulting, (http://jpn3.blogspot.com/, http://jpn3.50webs.com/) /*<br />
</code></p>
<p>Then, create a module called HTML/Javascript:</p>
<p>In that paste this code (with your modifications) (if your want to make a different background link, just copy from the &lt;a&gt; to the &lt;/a&gt; and paste, you&#8217;ll have another link. if you want a line break inbetween the links, insert &lt;br /&gt; inbetween the &lt;/a&gt; and &lt;a&gt; tags.</p>
<blockquote><p>&lt;a href=&#8221;#&#8221; onclick=&#8221;document.body.style.backgroundImage = &#8216;url(/*-your background image url-*/)&#8217;;document.body.style.backgroundColor = &#8216;/*-background color-*/;&#8221;&gt; /*-link text-*/&lt;/a&gt; | &lt;br /&gt;</p>
<p>&lt;href=&#8221;#&#8221; onclick=&#8221;document.body.style.backgroundImage = &#8216;url(/*-your background image url-*/)&#8217;;document.body.style.backgroundColor = &#8216;/*-background color-*/;&#8221;&gt; /*-link text 2-*/&lt;/a&gt;&lt;!&#8211; code by JPN3 Consulting (http://jpn3.50webs.com/)(http://jpn3.blogspot.com/) &#8211;&gt;</p></blockquote>
<div style="text-align: left;"><span style="font-family: Georgia,&quot;Times New Roman&quot;,serif;">And that should be all, </span>I probably made a typo ect, because I don&#8217;t have time to test this version, so, if you have any problems, post a comment with your problem and a link to what page your trying to implement it on. If you want any features and/or help, you can comment on this post also.</div>
<div style="text-align: left;">Iain Nash</div>
<p><span style="font-family: monospace;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://iain.codejoust.com/2009/05/html-background-changer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
