<?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>Stuck Together With Tape &#187; webdev</title>
	<atom:link href="http://www.stucktogetherwithtape.com/blog/tag/webdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stucktogetherwithtape.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 11 Dec 2009 12:49:01 +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>Winters coming, WrapUp!</title>
		<link>http://www.stucktogetherwithtape.com/blog/2009/10/winters-coming-wrapup/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=winters-coming-wrapup</link>
		<comments>http://www.stucktogetherwithtape.com/blog/2009/10/winters-coming-wrapup/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 13:28:09 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wrapup]]></category>

		<guid isPermaLink="false">http://www.stucktogetherwithtape.com/?p=20</guid>
		<description><![CDATA[I&#8217;ve been using this library, or iteration of, for about a year now and have finally had time to document it properly. WrapUp is a CodeIgniter Library to manage your sites &#60;head&#62; element. Defining the doctype Setting the page title Adding meta data Adding CSS Addming Javascript files This saves alot of time getting a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using this library, or iteration of, for about a year now and have finally had time to document it properly. WrapUp is a CodeIgniter Library to manage your sites &lt;head&gt; element.</p>
<p>Defining the doctype<br />
Setting the page title<br />
Adding meta data<br />
Adding CSS<br />
Addming Javascript files</p>
<p>This saves alot of time getting a site up and running. Its also extremly handy for large sites as you can define your default meta data, css &amp; javascript in a __constructor so its is inhereted by all pages on the site.</p>
<p>A few examples of WrapUp can be found after the jump.</p>
<p><span id="more-20"></span></p>
<p>Load the library, you&#8217;ll probably want to autoload this if you are using it on the whole site.</p>
<p><code>$this−&gt;load−&gt;library('wrapup');</code></p>
<p>The WrapUp library enables you to quickly get an HTML page up and running.</p>
<p><code>$this-&gt;wrapup-&gt;head();</code></p>
<p>The <strong>head()</strong> function returns the basic html head structure as a string.</p>
<p>There&#8217;s not a lot to it but from here you can easily customise your head page, set up defaults and overide/add elements for specific pages.</p>
<p>I normally create a MY_Controller which all my classes inherit from. Then all my default head elements, css links, js files are added to the wrapup library in the MY_Controller constructor.</p>
<p><code>// set doctype to transistional<br />
$this-&gt;wrapup-&gt;set_doctype('t');<br />
// add charset meta tag<br />
$meta = array(<br />
'http-equiv' =&gt;'Content-type',<br />
'content' =&gt; 'text/html;charset=UTF-8'<br />
);<br />
$this-&gt;wrapup-&gt;add_meta(meta);<br />
// add default css stylesheet<br />
$this-&gt;wrapup-&gt;add_css('style.css');<br />
// add google jquery script<br />
$this-&gt;wrapup-&gt;add_js('jquery.min.js');<br />
// add a default page titles<br />
$this-&gt;wrapup-&gt;set_title('My Page Title');</code></p>
<p>This sets up our default page head element. I find it saves me a lot of time if I ever need to change the default style sheet for instance or the doctype. I only have to change it in one place!</p>
<p>Another feature of WrapUp is managing inline javascript and CSS. I try not to include any inline CSS due to the dreaded <a href="http://en.wikipedia.org/wiki/Flash_of_unstyled_content" target="_blank">FOUC</a> but its useful for debugging. Using WrapUp to manage you javascript enables you to generate javascript programatically (include server side variables) and group all off your javascript and send it to the browser at the bottom of the page right before closing your body tags.</p>
<p>You can add inline javascript by calling the add_js_inline() WrapUp method.</p>
<p><code>$js = 'function say_hello(){alert("hello");}';<br />
$this-&gt;wrapup-&gt;add_js_inline($js);</code></p>
<p>Inline code can then be returned in your view by calling inline() method</p>
<p><code>$this-&gt;wrapup-&gt;inline();</code></p>
<p>So that&#8217;s about it for an introduction to WrapUp, no doubt i&#8217;ll add/tweak it as I discover news needs. Checkout the full <a title="WrapUp Docs" href="http://www.stucktogetherwithtape.com/user_guide/wrapup">documentation</a> in the code vault to see other methods like add_rss()</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stucktogetherwithtape.com/blog/2009/10/winters-coming-wrapup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
