<?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>Division Overlay Blog &#187; javascript</title>
	<atom:link href="http://blog.divisionoverlay.net/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.divisionoverlay.net</link>
	<description></description>
	<lastBuildDate>Wed, 13 Jan 2010 05:35:06 +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>Dynamic content plug-in</title>
		<link>http://blog.divisionoverlay.net/dynamic-content-plug-in</link>
		<comments>http://blog.divisionoverlay.net/dynamic-content-plug-in#comments</comments>
		<pubDate>Thu, 07 Aug 2008 05:31:40 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.divisionoverlay.net/?p=125</guid>
		<description><![CDATA[Today we are building a “plug-in” mainly for WordPress, but you we will show you how to use it on a regular site as well. You will need to know a certain degree of how to make a website from scratch. It would be to your best advantage to know PHP, jQuery, CSS and XHTML [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.divisionoverlay.net/wp-content/uploads/2008/08/looky.png"><img class="aligncenter size-full wp-image-136" title="Result" src="http://blog.divisionoverlay.net/wp-content/uploads/2008/08/looky.png" alt="" width="500" height="75" /></a></p>
<p>Today we are building a “plug-in” mainly for WordPress, but you we will show you how to use it on a regular site as well.</p>
<p class="MsoNormal">You will need to know a certain degree of how to make a website from scratch. It would be to your best advantage to know PHP, jQuery, CSS and XHTML to fully understand what is actually happening.</p>
<p class="MsoNormal"><span id="more-125"></span></p>
<p class="MsoNormal">Things you will need to complete this plug-in:</p>
<p class="MsoNormal">The latest version of <a href="http://jquery.com/">jQuery</a></p>
<p class="MsoNormal">You will need this file <a href="http://divisionoverlay.net/files/block.txt">block.php</a> (right-click / save-as)</p>
<p class="MsoNormal">The top graphic <a href="http://divisionoverlay.net/files/that.png">that.png</a></p>
<p class="MsoNormal">The content background <a href="http://divisionoverlay.net/files/this.png">this.png</a></p>
<h2>Adding the scripts</h2>
<p class="MsoNormal">First we must add the jquery script to the page</p>
<address class="MsoNormal">&lt;script type=”text/javascript” src=”jquery-1.2.6.js”&gt;&lt;/script&gt;</address>
<p class="MsoNormal">Now we must add the jquery that will take the elements and hide them, and give the function to show, hide and toggle</p>
<div class="code">
<address class="MsoNormal">&lt;script type=&#8221;text/javascript&#8221;&gt;</address>
<address class="MsoNormal">$(document).ready(function() {<br />
// hides the slickbox as soon as the DOM is ready<br />
// (a little sooner than page load)<br />
$(&#8216;#recent, #archiv&#8217;).hide();<br />
// shows the slickbox on clicking the noted link<br />
$(&#8216;a#arc-s&#8217;).click(function() {<br />
$(&#8216;#archiv&#8217;).show(&#8216;slow&#8217;);<br />
return false;<br />
});<br />
// hides the slickbox on clicking the noted link<br />
$(&#8216;a#arc-h&#8217;).click(function() {<br />
$(&#8216;#archiv&#8217;).hide(&#8216;fast&#8217;);<br />
return false;<br />
});<br />
// toggles the slickbox on clicking the noted link<br />
$(&#8216;a#arc&#8217;).click(function() {<br />
$(&#8216;#archiv&#8217;).slideToggle(700);<br />
return false;<br />
});<br />
// shows the slickbox on clicking the noted link<br />
$(&#8216;a#rec-s&#8217;).click(function() {<br />
$(&#8216;#recent&#8217;).show(&#8216;slow&#8217;);<br />
return false;<br />
});<br />
// hides the slickbox on clicking the noted link<br />
$(&#8216;a#rec-h&#8217;).click(function() {<br />
$(&#8216;#recent&#8217;).hide(&#8216;fast&#8217;);<br />
return false;<br />
});<br />
// toggles the slickbox on clicking the noted link<br />
$(&#8216;a#rec&#8217;).click(function() {<br />
$(&#8216;#recent&#8217;).slideToggle(700);<br />
return false;<br />
});<br />
}); </address>
<address class="MsoNormal">&lt;/script&gt;</address>
</div>
<h2 class="MsoNormal">Adding the links to show the content</h2>
<p>This step is fairly simple, all we need to do is make a simple link, but give it a couple of unique attributes. Let&#8217;s also place the links inside a div so it can be easily styled.</p>
<div class="code">
<address>&lt;div id=&#8221;mini-nav&#8221;&gt;<br />
&lt;a href=&#8221;#&#8221; id=&#8221;arc&#8221; onclick=&#8221;$(&#8216;#recent&#8217;).slideUp(&#8216;slow&#8217;);&#8221;&gt;Topics&lt;/a&gt;<br />
&lt;a href=&#8221;#&#8221; id=&#8221;rec&#8221; onclick=&#8221;$(&#8216;#archiv&#8217;).slideUp(&#8216;slow&#8217;);&#8221;&gt;Recent Posts&lt;/a&gt;<br />
&lt;/div&gt;</address>
</div>
<p>We added the id=&#8221;" which has the name of the link and the onclick=&#8221;" will hide the the div opposite of the one clicked.</p>
<h2>Now lets add the block</h2>
<p>The block, as i refer to it as, is the content that will be displayed when you click on one of the two links above. By now I hope you have downloaded <a href="http://divisionoverlay.net/files/block.php">block.php </a></p>
<div class="code">
<address>&lt;?php include(&#8220;block.php&#8221;); ?&gt;</address>
</div>
<h3>Further details on the Block</h3>
<p>In the block file, I have it coded to Work on WordPress. This will not work on anything else but wordpress. So to change that, we need to open up the block.php file and edit a few parts.</p>
<p>Inside the div &#8220;archiv&#8221;</p>
<div class="code">
<address>&lt;?php wp_list_categories(&#8216;show_count=1&amp;title_li=&#8217;); ?&gt;</address>
<p>Take out that, which will list all the categories in WordPress and add whatever text/code you wish.
</p></div>
<p>Inside the div &#8220;recent&#8221;</p>
<div class="code">
<address>&lt;?php</address>
<address> global $post;</address>
<address> $myposts = get_posts(&#8216;numberposts=5&amp;offset=1&amp;category=1&#8242;);</address>
<address> foreach($myposts as $post) :</address>
<address>?&gt;</address>
<address> &lt;li&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;</address>
<address>&lt;?php endforeach; ?&gt;</address>
</div>
<p>Change that, which get your recent posts in WordPress, to whatever text/code you want.</p>
<h2>Now to style it</h2>
<p>Add this either to your stylesheet (.css), or to the local file between the &lt;style&gt; tags.</p>
<div class="code">
<address>#mini-nav {<br />
position: absolute;<br />
top: 0px;<br />
left: 45%;<br />
width: 150px;<br />
height:20px;<br />
background: url(that.png);<br />
}<br />
.doit li{<br />
display: inline;<br />
padding-right: 10px;<br />
}<br />
#archiv, #recent {<br />
margin-top: 35px;<br />
margin-bottom: 10px;<br />
padding-top: 6px;<br />
width: 600px;<br />
height: 54px;<br />
background: url(this.png);<br />
}</address>
</div>
<p>This will put the two links at the top of the page on top of the black button. And it will create the padding and margins for the rest of your content that you can add.</p>
<h2>Wrapping up</h2>
<p>So, this will create dynamic content on any site, and is a great little plug-in for WordPress. If you have any questions or comments, please leave them in the comment field below. I hope you enjoyed it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.divisionoverlay.net/dynamic-content-plug-in/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
