<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.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:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">

<channel>
	<title>Nettuts+ » Videos</title>
	
	<link>http://net.tutsplus.com</link>
	<description>Web Development &amp; Design Tutorials</description>
	<pubDate>Fri, 17 Jul 2009 16:00:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<itunes:explicit>no</itunes:explicit><itunes:subtitle>Web Development &amp; Design Tutorials</itunes:subtitle><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/NETTUTSVideos" type="application/rss+xml" /><item>
		<title>CodeIgniter From Scratch: Day 1</title>
		<link>http://net.tutsplus.com/videos/screencasts/codeigniter-from-scratch-day-1/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/codeigniter-from-scratch-day-1/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 21:10:14 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[code igniter]]></category>

		<category><![CDATA[codeigniter]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php framework]]></category>

		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=5812</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/380_ci_one/200x200.jpg" alt="CodeIgniter From Scratch: Day 1" />]]></description>
			<content:encoded><![CDATA[<p>
After numerous requests, today we are launching a new screencast series on Nettuts+ that will focus exclusively on the <a href="http://codeigniter.com/">CodeIgniter</a> PHP framework. Over the course of about 10 <strong>videos</strong>, I&#8217;ll teach you exactly how to use this framework. Ultimately, we&#8217;ll work our way up to building a custom CMS. Without further ado, here&#8217;s day one!
</p>
<p><span id="more-5812"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/380_ci_one/ci.zip"><img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg"></a>
</div>
<h3>Day 1</h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMVgZGVKAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/codeigniter-from-scratch-day-1/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/380_ci_one/ci.zip" length="1048562" type="application/force-download" /><media:content url="http://nettuts.s3.amazonaws.com/380_ci_one/ci.zip" fileSize="1048562" type="application/force-download" /><itunes:keywords>Screencasts, code igniter, codeigniter, framework, PHP, php framework, Videos</itunes:keywords></item>
		<item>
		<title>Easy E-Commerce With Magento</title>
		<link>http://net.tutsplus.com/videos/screencasts/easy-e-commerce-with-magento/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/easy-e-commerce-with-magento/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 18:03:42 +0000</pubDate>
		<dc:creator>Ed Baxter</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[e-commerce]]></category>

		<category><![CDATA[ecommerce]]></category>

		<category><![CDATA[magento]]></category>

		<category><![CDATA[screencast]]></category>

		<category><![CDATA[video tutorial]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=5650</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/370_magento/200x200.jpg" alt="Getting Started With Magento" />]]></description>
			<content:encoded><![CDATA[<p>Hundreds of ecommerce systems exist, but very few can match the power of Magento. In this <strong>screencast</strong>, I&#8217;ll demonstrate how to download and install Magento to a local host, configure some of the site options, and create simple and configurable products and categories for our test e-commerce site.
</p>
<p><span id="more-5650"></span></p>
<h3>Screencast</h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/AYGL4DsA" type="application/x-shockwave-flash" width=590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<h3>Why Use Magento?</h3>
<p>Well there are quite a few very good reasons to use Magento: </p>
<ul>
<li>A Simple Intuitive Interface</li>
<li>Easy To Download, Install &amp; Maintain</li>
<li>Built on current technologies unlike other systems.</li>
<li>Multiple Site Functionality</li>
<li>And best of all&#8230;It&#8217;s free and open source!</li>
</ul>
<h3>Preparation</h3>
<p>As with all successful things in life, preparation is key! Before we can install Magento we must set up a database on our server. Using phpmyadmin we create a new database called &#8220;magento&#8221;. We will use this later when we come to install Magento. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/create-database.jpg" border="0" /></div>
<h3>Downloading/Installing Magento</h3>
<p>Once our database has been set up on our server the next step is to download Magento itself. To do that we need to go to the <a href="http://www.magentocommerce.com/download">download page</a> on the Magento website. For this tutorial we will be downloading the Full Release in ZIP format. Once you have it downloaded unzip it to the folder of your choice. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/download-page.jpg" border="0" /></div>
<p>Now that we have the files on our server it’s time to install Magento, to do this we go to http://localhost/magento (or whichever folder your using) in your web browser. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/toc-agree.jpg" border="0" /></div>
<p>Accept the TOC&#8217;s and continue onto the next page.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/localization-settings.jpg" border="0" /></div>
<p>Pick the settings that apply to you and click continue. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/database-config.jpg" border="0" /></div>
<p>Going well so far&#8230;Now fill in the database connection settings. <strong>Make sure that you hit Use Web Server (Apache) Rewrites for added SEO friendliness</strong> and if you want to change the default access address for your backend from /admin edit the Admin Path field. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/user-details.jpg" border="0" /></div>
<p>Fill in the login details you&#8217;d like to use for your account and enter an custom encryption key if you like, otherwise leave it blank and Magento will make one for you. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/all-set.jpg" border="0" /></div>
<p>Great, now Magento has been installed on your server, if you have installed locally there is one last step you need to take before you can login&#8230;</p>
<p>In your Magento folder go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php</p>
<p>Find the session_set_cookie_params code block (Line 78) and replace it with this code:</p>
<pre name="code" class="php">
		session_set_cookie_params(
            $this->getCookie()->getLifetime(),
            $this->getCookie()->getPath()
            //$this->getCookie()->getDomain(),
            //$this->getCookie()->isSecure(),
            //$this->getCookie()->getHttponly()
        );
</pre>
<p><strong>On a proper webhost you do not need to do this!</strong> However as we are working on localhost we need to do this to address an cookie issue.</p>
<h3>Tax Rules</h3>
<p>To set up our different levels of tax we need to go to the Manage Tax Zones &amp; Rates tab under Sales &#038;raquo Tax. If the rule for your state doesn&#8217;t exist or has been changed recently then hit the &#8220;Add New Tax Rate&#8221;. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/tax-one.jpg" border="0" /></div>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/tax-two.jpg" border="0" /></div>
<p>Save your new tax rule and you are good to go!</p>
<h3>Categories</h3>
<p>To create a new category we need to go to the Catalog tab on the navigation and select Manage Categories. From there we can manage and add new categories.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/categories-one.jpg" border="0" /></div>
<p>To create our new category we need to click <strong>Add Subcategory</strong> and fill in the details like the picture below, making sure to change Is Active to Yes. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/categories-two.jpg" border="0" /></div>
<h3>Products</h3>
<p>Products are key to a site but in Magento there was multiple product types as shown below&#8230;To create a new product we need to <strong>Catalog tab</strong> on the navigation and select <strong>Manage Products</strong>. And finally click <strong>Add Product</strong></p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/new-product-one.jpg" border="0" /></div>
<h4>Simple Products</h4>
<p>These are the products that have no options, such as DVD. To create our Simple product select Default for the attribute set and Simple Product for the Product Type and click Continue.</p>
<h4>General Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-one.jpg" border="0" /></div>
<ol>
<li>Name: The name of our new product</li>
<li>Description: The main body description of the product; the place to really sell the product and all of its features!</li>
<li>Short Description: The quick overview that appears just below the price on the product page; the place to grab the attention of buyers</li>
<li>SKU: The stock code for the product</li>
<li>Weight: The weight of the product. This can be kilos, tonnes or whatever you want as long as you keep uniformity across all your products</li>
<li>Manufacturer: Blank by default but manufacturers can be added through the Manage Attributes Tab. </li>
<li>Colour: Blank by default but again like the manufactures can be added through the Manage Attributes Tab</li>
<li>Set Product As New From Date: Sets the product to new from the date you enter.</li>
<li>Set Product as New to Date: Sets when the product ends being new.</li>
<li>Status: If the product is Enabled and showing on the website or if it&#8217;s disabled. </li>
<li>URL key: The custom option for how the URL for your product is written. </li>
<li>Visibility: Where the product can be found by your visitors;
<ul>
<li>Nowhere: The product does not appear on the website.</li>
<li>Catalog: The product will appear on the website but not in search results.</li>
<li>Search: The product will not appear on the website but will appear in search results.</li>
<li>Catalog, Search: The product will appear on the website and in search results.</li>
</ul>
</li>
<li>Allow Gift Message:
<ul>
<li>Yes: Allows a gift message</li>
<li>No: Doesn&#8217;t allow a gift message</li>
<li>Config: Use the site&#8217;s configuration</li>
</ul>
</li>
</ol>
<h4>Price Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-two.jpg" border="0" /></div>
<ol>
<li>Price: The price of our product</li>
<li>Special Price: Offers on products for limited times.</li>
<li>Special Price From Date: The date in which the special price starts.</li>
<li>Special Price To Date: The date in which the special price ends.</li>
<li>Cost: The cost of the product.</li>
<li>Tax Class: If your product requires Tax added then Taxable Goods must be selected.</li>
<li>Tier Price: Allows for bulk discounts to be set up. Click <strong>Add Tier</strong> to add quantity discounts.</li>
<li>Google Checkout: Can visitors buy this product using Google Checkout.</li>
</ol>
<h4>Meta Information Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-three.jpg" border="0" /></div>
<ol>
<li>Meta Title: Information that appears in the &lt;title&gt; tag.</li>
<li>Meta Keywords: keywords that apply to your product.</li>
<li>Meta Description: A short description of your product that appears on Search Engine Result Pages.</li>
</ol>
<h4>Images Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-image-upload.jpg" border="0" /></div>
<p>Images are a key part of your product and the better quality you can get the more chance you have of making a sale, Magento allows for multiple images to be uploaded and specific images to be uploaded for the Base Image, the Small Image and the Thumbnail, as well as allowing for a label. If you want to remove an image simply click the Exclude to hide or the Remove to delete checkbox(s).</p>
<ul>
<li>Base Image: The main image that appears on the product page.</li>
<li>Small Image: The image that appears in the categories/search view.</li>
<li>Thumbnail: The thumbnail of the product.</li>
</ul>
<h4>Design Tab</h4>
<p>Unless you are using a template for your Magento store it&#8217;s best to give this one a miss, but for anyone who is curious the Design tab allows you to use themes that you have set up and allows you to choose active to and from dates as well as changing the page layout into different column blocks and so on.</p>
<h4>Inventory Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-inventory.jpg" border="0" /></div>
<ol>
<li>Manage Stock: If you&#8217;d like to track and manage stock levels then leave this set to Yes</li>
<li>Qty: The amount of product you have.</li>
<li>Stock Availability: If the product is in stock or not. Setting this to Out of Stock will not hide the product on the website!</li>
</ol>
<p>The other options are best left to the site configuration however are all pretty self explanatory if you wish to set them to your needs. </p>
<h4>Categories Tab</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-categories.jpg" border="0" /></div>
<p>Your product can appear in multiple categories; simply click the checkbox of the category you want it to appear in!</p>
<h4>Related Products / Up-sells / Cross-sells</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/simple-product-related-products.jpg" border="0" /></div>
<p>With related products, up-sells and cross-sells the interface to add is same, to add a product simply select a field you wish to search by and click the search button, a list of products matching your criteria will appear. Click the checkbox next to the product and it will appear as a related product/up-sell or cross-sell as applicable.</p>
<h4>Product Reviews / Product Tags / Customers Tagged Product</h4>
<p>These are all added by users and can viewed from the tabs. </p>
<h4>Custom Options</h4>
<p>These are custom options that you can add to your product. To add a custom option click <strong>Add New Option</strong> and fill in the details.</p>
<h3>Managing Attributes &amp; Attribute Sets</h3>
<p>Attributes are the options that make up your products, for example colour, weight and so on. Attribute sets are sets of attributes that make a whole product and allow us to make configurable products.</p>
<h4>Attributes</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attributes-one.jpg" border="0" /></div>
<p>To create a new attribute/view our current attributes we need to go to the Catalog tab on the navigation and select Attributes and then Manage Attributes. To view a attribute simply click on the row, to create a new attribute click the <strong>Add New Attribute</strong> Tab.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attributes-new.jpg" border="0" /></div>
<h4>Properties Tab</h4>
<p>It&#8217;s best to use an convention when you are naming your attributes, as your list grows it will make it easier to find what you are looking for. I like to use <i>options_option_product</i> which for this product would be options_colour_nettuts_shirt. We must set our scope to global and Catalog Input Type to Dropdown in order to create our configurable product(s). We are only applying our Attribute to Simple Products and Configurable Products. In order to use this attribute in our configurable products we must choose Yes on the <strong>Use To Create Configurable Product</strong> field. We must also select Yes on the Visible on Product View Page on Front-end field in order to make the attribute visible. </p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attributes-labels.jpg" border="0" /></div>
<h4>Manage Label / Options Tab</h4>
<p>Next we need to set up the options for our user to select from when choosing there product. In our example we are using Colour as our product option.</p>
<p>The title is what the visitor will see above the dropdown, with Magento we can define what the admin sees and what the user sees making it easier to track options with additional information, in the example we have called our Title, Colour. If we leave the Default Store View blank it will copy what we have entered into Admin.</p>
<p>To add the options for our product click the Add Option button for the number of options you require, in our example 3. Like the title if we leave the Default Store View blank it will copy what we have entered into Admin but we can use the Admin field to add more information, making it easy to fulfill orders for example. We use position to order our options and the Is Default radio box to define which option is default. We can easily delete any option using the button to the right. Once we have all the options we want click Save to return to the attributes page.</p>
<h4>Attribute Sets</h4>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attributes-two.jpg" border="0" /></div>
<p>Next we need to set up our Attribute Set in order to create our configurable product. We navigate to the Catalog tab on the navigation and select Attributes and then Manage Attribute Sets. Like the Attributes page we have a list of our Current Attribute Sets; Default should only be appearing. Click Add New Set.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attribute-set-one.jpg" border="0" /></div>
<p>Again like our Attribute we should use a convention to name our Attribute Set&#8230;so matching our Attribute; options_size_tshirts. Since we have no other Sets we are going to base the new one on Default.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/attribute-set-two.jpg" border="0" /></div>
<p>To include our Attribute into our Set we simply need to click and drop it into the General group from the right hand list. Click save and our set is complete. Going well so far&#8230;</p>
<h3>Creating A Configurable Product</h3>
<p>Creating a configurable product is very similar to creating a Simple Product. To start we create a new product. But we need to change the Attribute Set to the one we just created and the product type to Configurable Product and click continue.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/config-product-one.jpg" border="0" /></div>
<p>Next we need to pick the Attributes we would like to use in our product. Only attributes with a scope of Global, type of dropdown and the option to create a configurable product set to yes can be used.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/config-product-two.jpg" border="0" /></div>
<p>The only tabs that change are the Inventory tab and an new tab has been added called Associated Products which is where we will add our options. Once we have filled in all our details we need to save and continue edit before we can begin to add our Associated Products. Unlike some other ecommerce systems Magento creates simple products that are hidden in order to create a configurable product.</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/config-product-three.jpg" border="0" /></div>
<p>To create the options we are going to use the &#8220;Quick simple product creation&#8221; tool to make our Simple Product options. For the name and SKU fields you can let Magento auto generate these but for added control I suggest that you fill these in yourself. In the example we are creating a green shirt option. We have filled in the Name, SKU, Weight and have set the product to Enabled. However <strong>we must set the visibility of our product to nowhere</strong>. From the drop-down we select the attribute option we are creating for and set the price. For the default option we don&#8217;t enter a value and it will use the price we set on our configurable product but for the other options we enter the difference between the configurable product and the option. So if the Green top is $15 and our configurable product is $20 then we have to enter -5.00 as our price. We then need to set the Qty for the option and the Stock Availability to In Stock and click Quick Create. We repeat this process until we have added all of our options and click save. Our configurable product is now complete. If we view our products page we can see that Magento has created the options as simple products for us that have been hidden. Making tracking stock much easier!</p>
<div class="tutorial_image"><img src="http://nettuts.s3.amazonaws.com/370_magento/config-product-four.jpg" border="0" /></div>
<h3>Congratulations</h3>
<p>Well done, you have just downloaded and installed Magento to your localhost, you have created a simple product, a custom attribute and attribute set, a configurable product using your custom attribute and a category. I hope that you have learned some of the basics of Magento and I wish you all the best during your endeavors. If you have any questions please leave a comment below and i&#8217;ll try my best to help you out!</p>
<p>If you a real go getter and would like to get into some of the more advanced topics or would like to learn more than I suggest that you check out the <a href="http://www.magentocommerce.com/knowledge-base">Knowledge Base</a> on the Magento website as well as <a href="http://www.magentocommerce.com/design_guide">Designers Guide</a> if you’re interested in customizing Magento more.</p>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/easy-e-commerce-with-magento/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Easy Development With CodeIgniter</title>
		<link>http://net.tutsplus.com/videos/screencasts/easy-development-with-codeigniter/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/easy-development-with-codeigniter/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 16:13:34 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[code igniter]]></category>

		<category><![CDATA[codeigniter]]></category>

		<category><![CDATA[file upload]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php framework]]></category>

		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=5594</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/183_codeIgniter/200x200.png" alt="Easy Development With CodeIgniter" />]]></description>
			<content:encoded><![CDATA[<p>
In this week&#8217;s <strong>30 minute screencast</strong>, I&#8217;m going to show you how easy it is to work with the MVC pattern and CodeIgniter. This video is aimed at beginners who have no experience with a PHP framework.</p>
<p> For demonstration purposes, we&#8217;ll be building a simple image upload utility. We&#8217;ll then perform some validation, save the file to our uploads folder, and automatically create a respective thumbnail. With raw PHP, this can be somewhat time-consuming. However, with <a href="http://codeigniter.com/">CodeIgniter</a>, it&#8217;s simply a matter of referencing the correct library, and passing in some configuration options! Let&#8217;s dive in.
</p>
<p><span id="more-5594"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/363_ci_image_upload/imageUpload.zip"><img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg"></a>
</div>
<h3>The Tutorial</h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMVgYyhCAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<h3>Final Controller</h3>
<pre name="code" class="php">
&lt;?php

class Upload extends Controller {

	function Upload() {
		parent::Controller();
		// $this->load->helper('form');
	}

	function index() {
		$this->load->view('upload_form');
	}

	function doUpload() {
		$config['upload_path'] = 'uploads/';
		$config['allowed_types'] = 'gif|jpg|jpeg|png';
		$config['max_size'] = '1000';
		$config['max_width'] = '1920';
		$config['max_height'] = '1280';						

		$this->load->library('upload', $config);

		if(!$this->upload->do_upload()) echo $this->upload->display_errors();
		else {
			$fInfo = $this->upload->data();
			$this->_createThumbnail($fInfo['file_name']);

			$data['uploadInfo'] = $fInfo;
			$data['thumbnail_name'] = $fInfo['raw_name'] . '_thumb' . $fInfo['file_ext'];
			$this->load->view('upload_success', $data);
		}
	}

	function _createThumbnail($fileName) {
		$config['image_library'] = 'gd2';
		$config['source_image'] = 'uploads/' . $fileName;
		$config['create_thumb'] = TRUE;
		$config['maintain_ratio'] = TRUE;
		$config['width'] = 75;
		$config['height'] = 75;

		$this->load->library('image_lib', $config);
		if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();
	}
}
</pre>
<h3>Final View</h3>
<pre name="code" class="php">
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

&lt;html>
  &lt;head>
    &lt;title>Upload an Image &lt;/title>
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  &lt;/head>

  &lt;body>
    &lt;div id="container">
    	&lt;h2>Upload an Image &lt;/h2>

		&lt;?php echo form_open_multipart('upload/doUpload'); ?>
		&lt;input type="file" name="userfile" />
		&lt;p>&lt;input type="submit" value="Submit" name="submit" />&lt;/p>
		&lt;?php echo form_close(); ?>
    &lt;/div>

  &lt;/body>
&lt;/html>
</pre>
<p>
I hope you guys enjoyed this video tutorial. If you&#8217;d like to see more CodeIgniter tutorials and videos on Nettuts+, please be loud in the comments. I know I&#8217;d like to see more! I&#8217;m in the process of learning this framework myself, so links to resources, tips, etc. will be much appreciated!</p>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/easy-development-with-codeigniter/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/363_ci_image_upload/imageUpload.zip" length="605566" type="application/x-zip" /><media:content url="http://nettuts.s3.amazonaws.com/363_ci_image_upload/imageUpload.zip" fileSize="605566" type="application/x-zip" /><itunes:keywords>Screencasts, code igniter, codeigniter, file upload, framework, PHP, php framework, thumbnails</itunes:keywords></item>
		<item>
		<title>How to Make AJAX Requests With Raw JavaScript: Part 2</title>
		<link>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript-part-2/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript-part-2/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 20:57:00 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=5220</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/324_ajax/200x200.jpg" alt="How to Make AJAX Requests With Raw JavaScript: Part 2" />]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript/">A few weeks ago</a>, I demonstrated how to make AJAX requests with raw JavaScript. In today&#8217;s <strong>screencast</strong>, we&#8217;ll take things a step further as we use PHP to query a database, convert it to the JSON format, and use Javascript to asynchronously request this information and display it on the page. If you&#8217;re just getting started with these sorts of concepts, this is the perfect video for you!
</p>
<p><span id="more-5220"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/340_ajaxPart2/ajax.zip"><img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg"></a></p>
</div>
<h3>Video </h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMVgYayPAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed></p>
<p style="padding: 0 2em;"><em>After a bit of discussion on Twitter, I updated some of the PHP from this video. <br />You can view the revisions below. </em></p>
</div>
<h3>Final &#8220;Load&#8221; Script </h3>
<p>
<em>This block of code asynchronously requests a page, and then uses Douglass Crockford&#8217;s &#8220;Parse&#8221; script to create a new global object. That way, we can easily filter through the returned JSON data. </em>
</p>
<pre name="code" class="js">
function load(url, callback) {
    var xhr;

    if(typeof XMLHttpRequest !== 'undefined') xhr = new XMLHttpRequest();
    else {
        var versions = ["Microsoft.XmlHttp",
            "MSXML2.XmlHttp",
            "MSXML2.XmlHttp.3.0",
            "MSXML2.XmlHttp.4.0",
            "MSXML2.XmlHttp.5.0"];

        for(var i = 0, len = versions.length; i < len; i++) {
            try {
                xhr = new ActiveXObject(versions[i]);
                break;
            }
            catch(e){}
        } // end for
    }

    xhr.onreadystatechange = function() {
        if((xhr.readyState < 4) || xhr.status !== 200) return;
        callback(xhr);
    };

    xhr.open('GET', url, true);
    xhr.send('');

}

load('emails.php', function(xhr) {
 var response = JSON.parse(xhr.responseText);
 var container = document.getElementById('container');

 for(var i = 0, len = response.length; i < len; i++) {
   container.innerHTML += '
<li><strong>' + response[i].name + '</strong> : ' + response[i].email + '</li>

';
 }
});
</pre>
<h3>Final PHP </h3>
<p><em>Slightly modified from the video to improve efficiency &#8212; a much more elegant solution than what I originally came up with on the spot. </em></p>
<pre name="code" class="php">
&lt;?php
/*
Step 1: query the database
Step 2: Cycle through the returned data and convert it to the JSON format.
Step 3: Echo returned data -- to be retrieved with Javascript
*/

$mysql = new mysqli('localhost','root','root','ajaxTut') or die('There was a problem');

if($result = $mysql->query('SELECT * FROM contactInfo')) {
  $returnedArray = array();
  while($row = $result->fetch_object()) {
    $returnedArray[] = $row;
  }
echo json_encode($returnedArray);

} else {
  // error occurred
  echo 'error: ' . $mysql->error;

}
</pre>
<p>
I hope you all are enjoying this &#8220;video series that was never meant to be.&#8221; Originally, it was planned as a single tutorial; however, due to the fact that there is SO much to cover, I&#8217;d like to continue creating more videos for you &#8212; that is, if you&#8217;ll have them. Feel free to let me know what you&#8217;d like to learn next. </p>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript-part-2/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/340_ajaxPart2/ajax.zip" length="7666" type="application/x-zip" /><media:content url="http://nettuts.s3.amazonaws.com/340_ajaxPart2/ajax.zip" fileSize="7666" type="application/x-zip" /><itunes:keywords>Screencasts, AJAX, JavaScript, PHP</itunes:keywords></item>
		<item>
		<title>How to Make AJAX Requests With Raw Javascript</title>
		<link>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript/#comments</comments>
		<pubDate>Fri, 08 May 2009 19:03:08 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=4855</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/324_ajax/200x200.jpg" alt="How to Make AJAX Requests With Raw Javascript" /><ol>]]></description>
			<content:encoded><![CDATA[<p>
Javascript frameworks have turned simple AJAX functions into one-liners. This is quite incredible, considering the fact that it would require more than twenty to accomplish the same thing with raw Javascript. Nevertheless, it&#8217;s important to learn what&#8217;s &#8220;under the hood&#8221;.
</p>
<p><span id="more-4855"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/324_ajax/ajax.zip"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt=""></a>
</div>
<h3>Screencast</h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMVgYCWRwA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/324_ajax/firebug.png" alt="Get Request" />
</div>
<h3>Final Script</h3>
<p>
This is a relatively simple script that will allow you to asynchronously request pages by using a &#8220;load(URL, CALLBACK)&#8221; function.
</p>
<pre name="code" class="javascript">
// Our simplified "load" function accepts a URL and CALLBACK parameter.
load('test.txt', function(xhr) {
	document.getElementById('container').innerHTML = xhr.responseText;
});

function load(url, callback) {
		var xhr;

		if(typeof XMLHttpRequest !== 'undefined') xhr = new XMLHttpRequest();
		else {
			var versions = ["MSXML2.XmlHttp.5.0",
			 				"MSXML2.XmlHttp.4.0",
			 			    "MSXML2.XmlHttp.3.0",
			 			    "MSXML2.XmlHttp.2.0",
			 				"Microsoft.XmlHttp"]

			 for(var i = 0, len = versions.length; i < len; i++) {
			 	try {
			 		xhr = new ActiveXObject(versions[i]);
			 		break;
			 	}
			 	catch(e){}
			 } // end for
		}

		xhr.onreadystatechange = ensureReadiness;

		function ensureReadiness() {
			if(xhr.readyState < 4) {
				return;
			}

			if(xhr.status !== 200) {
				return;
			}

			// all is well
			if(xhr.readyState === 4) {
				callback(xhr);
			}
		}

		xhr.open('GET', url, true);
		xhr.send('');
	}

// or with jQuery...
$('#container').load('test.txt');
</pre>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/324_ajax/objectProperties.png" alt="Object Properties" />
</div>
<h3>A Few Notes To Consider While Watching </h3>
<p><strong>onreadystatechange</strong> will fire five times as your specified page is requested. </p>
<ul>
<li><strong>0: </strong> uninitialized</li>
<li><strong>1: </strong> loading </li>
<li><strong>2: </strong>loaded </li>
<li><strong>3: </strong>interactive </li>
<li><strong>4: </strong>complete
</ul>
<p>
A value of &#8220;4&#8243; is what we&#8217;re searching for. Once it&#8217;s been reached, we know that we&#8217;re free to perform an action with the returned data.
</p>
<h4>XMLHttpRequest and ActiveXObject </h4>
<p>
Modern browsers utilize the &#8220;XMLHttpRequest&#8221; object to make asynchronous requests. That means, if you&#8217;d like to ignore IE6, you&#8217;re free to remove the ActiveXObject check - this section.
</p>
<pre name="code" class="javascript">
		if(typeof XMLHttpRequest !== 'undefined') xhr = new XMLHttpRequest();
		else {
			var versions = ["Microsoft.XmlHttp",
			 				"MSXML2.XmlHttp",
			 			    "MSXML2.XmlHttp.3.0",
			 			    "MSXML2.XmlHttp.4.0",
			 			    "MSXML2.XmlHttp.5.0"];

			 for(var i = 0, len = versions.length; i < len; i++) {
			 	try {
			 		xhr = new ActiveXObject(versions[i]);
			 		break;
			 	}
			 	catch(e){}
			 } // end for
		}
</pre>
<p>
Instead, you could just write &#8220;var xhr = new XMLHttpRequest();&#8221;. Be cautious with this method. Once abstracted to its own &#8220;load&#8221; function, it&#8217;s easy to keep the IE check as it is.
</p>
<h4>Get Out of the Global Space</h4>
<p>
If making multiple requests, you might consider moving your code into its own object. Then, rather than directly calling the &#8220;load&#8221; function, you use &#8220;myObject.load();&#8221;. A basic guideline to accomplishing this would be:
</p>
<pre name="code" class="javascript">
var ajax = {
   load : function() {
// paste here
   },

   otherMethod : someFunction() {
// paste here
   }
}

ajax.load();
</pre>
<h3>Conclusion</h3>
<p>
I&#8217;ve no doubt that some of you will leave a comment stating something along the lines of, &#8220;Why would I ever do this when it can be done with just one line of jQuery?&#8221; The answer is because you need to learn what&#8217;s under the hood of your car, so to speak. Frameworks like Mootools and jQuery have made Javascript unbelievably accessible to designers. If you fall into this category, I strongly recommend that you pick up a raw Javascript book as well. There&#8217;s nothing wrong, in my opinion, with learning both simultaneously. Just be sure that you do learn both!
</p>
<p><strong><br />
It&#8217;s similar to working with WordPress if you don&#8217;t know PHP. Sure, it&#8217;s possible - but would you really want to?<br />
</strong>
</p>
<p>
Hopefully, this should get you up and running! I&#8217;d love to hear your thoughts! Have a great weekend. See you on Monday, or on <a href="http://www.twitter.com/NETTUTS">Twitter!</a>
</p>
<ul class="webroundup">
<li>Subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/how-to-make-ajax-requests-with-raw-javascript/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/324_ajax/ajax.zip" length="1334" type="application/zip" /><media:content url="http://nettuts.s3.amazonaws.com/324_ajax/ajax.zip" fileSize="1334" type="application/zip" /><itunes:keywords>Screencasts, AJAX, JavaScript, jQuery</itunes:keywords></item>
		<item>
		<title>A Crash-Course in WordPress Plugin Development</title>
		<link>http://net.tutsplus.com/videos/screencasts/a-crash-course-in-wordpress-plugin-development/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/a-crash-course-in-wordpress-plugin-development/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 16:07:16 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[wordpress plugin]]></category>

		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=4598</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/200x200.png" alt="A Crash-Course in WordPress Plugin Development" />]]></description>
			<content:encoded><![CDATA[<p>Despite an extensive <a href="http://codex.wordpress.org/Plugin_API">codex</a>, many WordPress users remain unfamiliar with how to create their own custom plugins. In today&#8217;s <strong>screencast</strong>, we&#8217;ll start from scratch and build our first usable plugin. For this example, we&#8217;ll write a simple &#8220;tuts formatting&#8221; function that allows a blog editor to more easily format articles.
</p>
<p><span id="more-4598"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/Tuts_Formatting.zip"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt=""></a>
</div>
<h3>Screencast</h3>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMV_L0lAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<h3>Step 1: Your First Plugin </h3>
<p>
When creating a WordPress plugin, the first step is obviously to make sure that you have access to a WordPress installation. If you don&#8217;t currently have a copy:
</p>
<ol>
<li>Visit <a href="http://www.wordpress.org">WordPress.org</a> and download the most recent version to your harddrive. </li>
<li>Install WAMP or MAMP if you won&#8217;t be working on a server. </li>
<li>Drag your downloaded WordPress folder into your websites folder.</li>
<li>Create a new database with MySQL or the command line. </li>
<li>In Firefox, browse to your new folder and begin the installation. </li>
</ol>
<p>
<em>* Note - this isn&#8217;t a &#8220;getting started with WordPress&#8221; tutorial. As such, I won&#8217;t go over the installation instructions in detail. Instead, I highly recommend that you review Drew Douglass&#8217; <a href="http://blog.themeforest.net/screencasts/new-wp-video-series-and-free-rockstar-book/">&#8220;WordPress for Designers&#8221;</a> series on the <a href="http://blog.themeforest.net">ThemeForest blog.</a></em>
</p>
<h4>The Plugins Folder </h4>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/folderStructure.png" alt="Folder Structure" />
</div>
<p>
Once WordPress is running, browse to wp-content -> plugins. This is where all of your plugins will be stored. Creating a new plugin is a simple matter of adding a new folder, index file, and inserting a few comments. Let&#8217;s do that now.
</p>
<ol>
<li>Within the plugins folder, right-click and create a new folder  - call it &#8220;Tuts_Formatting&#8221;. </li>
<li>In your favorite code editor, save a blank document as &#8216;index.php&#8217; and place it inside this folder. </li>
<li>Paste in the following comments at the top of your blank page: </li>
</ol>
<pre name="code" class="php">
&lt;?php 

/*
Plugin Name: Tuts Formatting
Plugin URI: http://net.tutsplus.com
Description: Saves me time.
Version: 1.0
Author: Jeffrey Way
Author URI: http://net.tutsplus.com
*/
</pre>
<p>
WordPress recognizes these comments and then creates an option within your admin panel.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/pluginInfo.png" alt="Plugin Info" />
</div>
<p>
Note that if these comments are not included, WordPress will NOT recognize your plugin. I recommend that you create a snippet and assign a keystroke if you&#8217;ll be creating many plugins in the future. I used TextExpander and assigned a key of &#8220;plugincomments&#8221;.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/textexpander.png" alt="text expander" style="width: 600px;" />
</div>
<h3>Step 2: Outlining Our Plugin </h3>
<p>
As I&#8217;m sure many of you can imagine, Nettuts+ requires our authors to follow a set of guidelines when submitting tutorials. For example:
</p>
<ul>
<li>Place all headings within H3 tags. </li>
<li>Wrap your images within divs with a class of tutorial image. (This adds the background and borders around every image on Nettuts+.) </li>
</ul>
<p>
Though most of our writers do it correctly, we often receive tutorials that need formatting revisions. In these instances, I have two options: return the tutorial to the sender, or make the changes myself. More than not, I typically make the changes myself.
</p>
<p>
<strong>Now wouldn&#8217;t it be convenient if I could create a WordPress plugin that will handle some of the workload for me? </strong>
</p>
<p>
That&#8217;s exactly what I did. However, that particular plugin might be a bit too advanced for your first one. Instead, I&#8217;ve created a &#8220;slimmed down&#8221; version that we&#8217;ll be working with today. All that it will do is:
</p>
<ol>
<li>Append the &#8220;Subscribe&#8221; info to the bottom of every tutorial. </li>
<li>Replace all H2 tags with H3 tags. (Per our rules) </li>
<li>Check to see if the author wrapped his images within divs. If he hasn&#8217;t, our plugin will take care of it. </li>
</ol>
<h3>Step 3: Filters </h3>
<p>
From the WordPress codex&#8230;
</p>
<blockquote>
<p>&#8220;Filters are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data (such as adding it to the database or sending it to the browser screen). Filters sit between the database and the browser (when WordPress is generating pages), and between the browser and the database (when WordPress is adding new posts and comments to the database); most input and output in WordPress passes through at least one filter. WordPress does some filtering by default, and your plugin can add its own filtering.&#8221;</p>
</blockquote>
<p>
To clarify, filters allow us to &#8220;latch&#8221; on to certain sections before the page is rendered. In our case, we want to latch onto the main content before it is displayed. That way, we can modify the formatting, as outlined above. To accomplish this, we can create a filter for &#8220;the_content&#8221;. Doing so is quite simple. Paste the following snippet into your index page.
</p>
<pre name="code" class="php">
add_filter('the_content', 'Tut_Formatting');
</pre>
<p>
This block of code essentially means: &#8220;before display the content (or the body of the blog post), run the function &#8220;Tut_Formatting&#8221;. Let&#8217;s create that function now. Add the following just before your &#8216;add_filter&#8217; code-block.
</p>
<pre name="code" class="php">
function Tut_Formatting($content) {
}
</pre>
<p>
When we use &#8220;add_filter&#8221;, we can pass the contents of the filtered item to our function - notice the $content parameter. In this case, $content will store the body of a specific blog posting.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/content.png" alt="$content" />
</div>
<h3>Step 4: The Function </h4>
<p>
Let&#8217;s begin by appending the &#8220;subscribe&#8221; info to the bottom of each posting. Within your function, create a new variable called $end_of_tut.
</p>
<pre name="code" class="php">
$end_of_tut = &lt;&lt;&lt;EOT
&lt;ul class="webroundup">
    &lt;li>Follow us on &lt;a href="http://www.twitter.com/nettuts">Twitter&lt;/a>, or subscribe to the &lt;a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed&lt;/a> for more daily web development tuts and articles.&lt;/li>&lt;/ul>

&lt;p>
  &lt;script type="text/javascript">&lt;!--digg_url = "post permalink (not digg url)"; // -->&lt;/script>
  &lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript">&lt;/script>
&lt;/p>
EOT;
</pre>
<p>
What you see above is the exact code that we use for every Nettuts+ posting. It merely contains links to our Twitter and RSS feeds, and then appends a Digg link. Digg provides that snippet of code at the bottom; just copy and paste it.
</p>
<h4>HereDocs</h4>
<p>
When mixing PHP and HTML, <a href="http://www.google.com/url?sa=t&#038;source=web&#038;ct=res&#038;cd=1&#038;url=http%3A%2F%2Fwww.php.net%2Flanguage.types.string&#038;ei=G-DxScOpAYestgfit5WyDw&#038;usg=AFQjCNEnGoOc76f4CqSI2js8NAhrInrwiw&#038;sig2=Cyb_pN4rSz4p4PwkYHlorA">heredocs</a> are an easy way to clean up your code. By using the syntax &lt;&lt;&lt;KEY, we can then insert regular html. We designate the closing of our html block by restating our key - in this case, EOT (for end of text). For more information, review the &#8220;Diving into PHP: Day 8&#8243; video on the <a href="http://blog.themeforest.net/screencasts/diving-into-php-day-8/">ThemeForest blog</a>.
</p>
<p>
If this was all that we wanted to accomplish, we would only need to return the content plus this new block of html. Doing so is easy:
</p>
<pre name="code" class="php">
return $content . $end_of_tut;
</pre>
<p>
Our function returns the body of the blog posting along with the &#8220;subscribe&#8221; info appended to the end. However, we&#8217;re going to do much more than this, so let&#8217;s continue on.
</p>
<h4>Regular Expressions </h4>
<p>
I chose to use regular expressions to handle the wrapping of our images. In case you forgot, we need to search the posting and check to see if the author wrapped all of their images within divs with a class of &#8220;tutorial_image&#8221;. If they have, great - we don&#8217;t need to do anything. However, if they haven&#8217;t done so, we&#8217;ll use regular expressions as our work-horse.
</p>
<pre name="code" class="php">
$match = preg_match_all('/&lt;div class=[\'"]?tutorial_image[\'"]?>\s*&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]\s*&lt;\/div>/i', $content, $matches);
</pre>
<p>
Preg_match_all is a PHP function that accepts three parameters:
</p>
<ol>
<li>The expression to search for. </li>
<li>What are we searching through? </li>
<li>Where will the matches be stored? </li>
</ol>
<p>
We begin by searching through the content of the blog posting - represented by the $content variable - and checking if there are images wrapped within divs. If you&#8217;re unfamiliar with regular expressions, don&#8217;t worry - it&#8217;s not that complicated.
</p>
<pre name="code" class="php">
/&lt;div class=[\'"]?tutorial_image[\'"]?>\s*&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]\s*&lt;\/div>/i
</pre>
<ol>
<li>Regular expressions are wrapped within delimiters. These can be anything you like. I tend to follow the Perl syntax and use the / /. <em>Notice how these wrap our expression. </em></li>
<li>We begin by searching for &#8220;&lt;div class=&#8221;. Now with regular expressions, we must compensate for what the author MIGHT do. Some may prefer to wrap their attributes in single quotes, while others may omit them entirely (though they shouldn&#8217;t). Knowing this, let&#8217;s allow either a double quote, single quote, or nothing. We do this by: [\'"]? When characters are wrapped within brackets, only one character will be used. The back-slash is simply to escape the single quote. The question mark afterward means, &#8220;allow zero or one of the preceding character.&#8221; This is how we allow for the author not using any quotes. </li>
<li>Continuing on - tutorial_image[\'"]? &#8212; We&#8217;re searching for the string &#8220;tutorial_image&#8221; once again followed by a single or double quote. </li>
<li>\s* means &#8220;look for zero or more spaces.&#8221; As you might have guessed, we represent a space with &#8220;\s&#8221;.  </li>
<li>Now, we need to match the image tag. You should now understand what the first section refers to: &lt;img src=[\'"]? </li>
<li>.+\. tells the engine to look for one or more of any character until it comes to a period. (&#8221;.&#8221; refers to any character; &#8220;+&#8221; refers to one or more of the proceeding character; &#8220;\.&#8221; literally refers to a period. </li>
<li>Now we need to find the correct extension. We search for either jpg, gif, jpeg, or png following by a single, double, or no quote. </li>
<li>The final block simply closes out our image and div tags. </li>
<li>The &#8220;i&#8221; at the very end informs the engine that the letters should not case insensitive. </li>
</ol>
<p>As you can imagine, it&#8217;s very difficult to explain regular expressions with words. If that last section completely confused you, watch the screencast for a much more in-depth explanation. </p>
<p>
Now that we&#8217;ve create our expression, we need to tell the engine exactly what we&#8217;re searching through. As I&#8217;m sure you&#8217;ve guessed, we need to search through $content. Add this as your second parameter. The third parameters designates an array where the matches will be stored.
</p>
<pre name="code" class="php">
$match = preg_match_all('/&lt;div class=[\'"]?tutorial_image[\'"]?>\s*&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]\s*&lt;\/div>/i', $content, $matches);
</pre>
<h4>Checking for Matches </h4>
<p>
When we run this regular expressions, we can expect one of two outcomes:
</p>
<ol>
<li>$match will be equal to 0, because the author forgot to wrap his images within divs. </li>
<li>$match will be equal to 1 or more - proving that the author remembered to wrap his images, in which case we don&#8217;t need to do anything. </li>
</ol>
<p>
We need to check the value of $match and proceed differently depending on its value.
</p>
<pre name="code" class="php">
if(!$match)
{
	$theContent = preg_replace('/&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]/', '&lt;div class="tutorial_image">$0&lt;/div>', $content);
}

else
{
	$theContent = $content;
}
</pre>
<p>
We use !$match to check if the variable is equal to zero. If it is, we&#8217;ll need to wrap our images accordingly. On the other hand, if it&#8217;s equal to one or more, that expression will return false, in which case the &#8220;else&#8221; statement will run instead. Let&#8217;s examine that first block:
</p>
<p>
We&#8217;re creating a new variable called $theContent. Next, we use another PHP function called &#8220;preg_replace&#8221;. This function accepts three parameters:
</p>
<ol>
<li>The regular expression </li>
<li>What to replace any matches with </li>
<li>What to search. </li>
</ol>
<pre name="code" class="php">
preg_replace('/&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]/', '&lt;div class="tutorial_image">$0&lt;/div>', $content);
</pre>
<p>
We&#8217;re pasting in that same regular expression from before, minus the div tags. So, we&#8217;re essentially finding all images within the content. The second parameter creates our div tag and pastes the matched image within - designated by $0, which returns the entire matched string. The third parameter informs the engine of what string we&#8217;re searching through.
</p>
<h4>Else </h4>
<p>
Now, if $match is equal to one or more, the else statement will run instead. In this scenario, the $theContent variable will be equal to $content, or the original body of text from the_content. It&#8217;s as simple as that!
</p>
<h4>Replacing H2s </h4>
<p>
The next step is to search for any uses of &lt;h2> tags, and replace them with &lt;h3>.
</p>
<pre name="code" class="php">
$theContent = preg_replace('/&lt;h2>/', '&lt;h3>', $theContent);
$theContent = preg_replace('/&lt;\/h2>/', '&lt;/h3>', $theContent);
</pre>
<p>
Hopefully, this syntax is becoming more clear. It should be rather obvious what the code is doing.
</p>
<h3>Step 5: Returning </h3>
<p>
The final step is to return the text from our function. However, we should consider something. We don&#8217;t want the blog postings on the home page to contain the &#8220;subscribe&#8221; info as well. This will clutter the page with a bunch of Digg buttons. Let&#8217;s reserve that for single postings. We can use a WordPress function called &#8220;is_single()&#8221; to determine if the user is on a single page or not.
</p>
<pre name="code" class="php">
return (is_single()) ? $theContent . $end_of_tut : $theContent;
</pre>
<p>
Here, we&#8217;re using the ternary operator. We can break this snippet down into three easy sections.
</p>
<ol>
<li>Is the user on a single page? </li>
<li>If they are, return $theContent and append the &#8220;Subscribe&#8221; information - referenced by the variable $end_of_tut. </li>
<li>If they are not, just return $theContent only. </li>
</ol>
<h3>That&#8217;s Our Plugin! </h3>
<p>
Return to your WordPress admin panel, and click on the &#8220;Plugins&#8221; tab. .
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/pluginsLink.png" alt="Plugins" />
</div>
<p>
Next, activate the &#8220;Tuts_Formatting&#8221; plugin.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/pluginInfo.png" alt="Activation" />
</div>
<h4>Create a New Posting </h4>
<p>
If our plugin is working correctly, its magic will occur behind the scenes. Create a new blog posting and try it out! Create a couple of h2 headings, add some images, and then click &#8220;Publish&#8221;. If everything worked correctly, the page will be modified accordingly. Using Firebug or &#8220;View Source&#8221;, we can verify this.
</p>
<h4>Images Wrapped Within Divs </h4>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/firebug.png" alt="Firebug" />
</div>
<p>
I&#8217;ve applied a bit of basic CSS to style our &#8220;tutorial_image&#8221; div.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/tutorialImageAdded.png" alt="tutorial image added" />
</div>
<h4>H2 Tags</h4>
<p>The H2 tags have now been successfully changed to H3s. </p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/h2Changed.png" alt="H2 to H3" />
</div>
<h4>Subscribe Info </h4>
<p>
If viewing a single posting, the &#8220;Subscribe&#8221; information should be appended to the bottom. Note that, if you&#8217;re working on a local server, the Digg button won&#8217;t display correctly. Don&#8217;t worry, it&#8217;ll work once you&#8217;ve transferred the files to your server.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/subscribe.png" alt="Subscribe Info Appended" />
</div>
<h3>Final Plugin Code</h3>
<pre name="code" class="php">
&lt;?php 

/*
Plugin Name: Tuts Formatting
Plugin URI: http://net.tutsplus.com
Description: Saves me time.
Version: 1.0
Author: Jeffrey Way
Author URI: http://net.tutsplus.com
*/	

function Tut_Formatting($content) {

	$end_of_tut = &lt;&lt;&lt;EOT
&lt;ul class="webroundup">
    &lt;li>Follow us on &lt;a href="http://www.twitter.com/nettuts">Twitter&lt;/a>, or subscribe to the &lt;a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed&lt;/a> for more daily web development tuts and articles.&lt;/li>&lt;/ul>
&lt;p>
&lt;script type="text/javascript">&lt;!--digg_url = "post permalink (not digg url)"; // -->
&lt;/script>
&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript">&lt;/script>&lt;/p>
EOT;

	$match = preg_match_all('/&lt;div class=[\'"]?tutorial_image[\'"]?>\s*&lt;img src=[\'"]?.+\.(jpg|gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]\s*&lt;\/div>/i', $content, $matches);

	if(!$match)
	{
		$theContent = preg_replace('/&lt;img src=[\'"]?.+\.(jpg||gif|jpeg|png)[\'"]?(\s.+)?[(\s\/>)|(>)]/', '&lt;div class="tutorial_image">$0&lt;/div>', $content);
	}

	else
	{
		$theContent = $content;
	}

	$theContent = preg_replace('/&lt;h2>/', '&lt;h3>', $theContent);
	$theContent = preg_replace('/&lt;\/h2>/', '&lt;/h3>', $theContent);

    # Or you can combine those two lines above into one if you would rather.
    # $theContent = preg_replace(’/<(\/?)h2>/’, ‘<$1h3>’, $theContent);

	return (is_single()) ? $theContent . $end_of_tut : $theContent;

} // end of Tut_Formatting

add_filter('the_content', 'Tut_Formatting');
</pre>
<p>
Hopefully, this relatively simple example will get you started with WordPress plugin development. I highly recommend that you review the <a href="http://codex.wordpress.org/Plugin_API">codex</a> to gain a greater understanding. The sky&#8217;s the limit when creating WordPress plugins; there&#8217;s very little that you can&#8217;t do. <strong>What are your favorite plugins? </strong>
</p>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/a-crash-course-in-wordpress-plugin-development/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/Tuts_Formatting.zip" length="1004" type="application/x-zip" /><media:content url="http://nettuts.s3.amazonaws.com/305_wordpressPlugin/Tuts_Formatting.zip" fileSize="1004" type="application/x-zip" /><itunes:keywords>Screencasts, plugin, Wordpress, wordpress plugin, wp</itunes:keywords></item>
		<item>
		<title>Fun With CSS Shapes</title>
		<link>http://net.tutsplus.com/videos/screencasts/fun-with-css-shapes/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/fun-with-css-shapes/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 03:02:33 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[blockquotes]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[shapes]]></category>

		<category><![CDATA[speech bubbles]]></category>

		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=4115</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/200x200.png" alt="Fun With CSS Shapes" />]]></description>
			<content:encoded><![CDATA[<p>
I bet a bunch of you don&#8217;t realize that we can create the illusion of shapes by using 100% CSS. By utilizing the border property in creative ways, we can make some really interesting polygons. In this week&#8217;s <strong>screencast</strong>, we&#8217;ll figure out a way to create speech-bubbles without resorting to background images.
</p>
<p><span id="more-4115"></span></p>
<p>
Most of us, by now, are familiar with using the &#8220;-moz-border-radius&#8221; and &#8220;-webkit-border-radius&#8221; properties to create rounded corners - or even complete circles - but there are other techniques to create more complicated shapes.
</p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/273_cssShapes/shapes.html"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt=""></a><br />
<a href="http://nettuts.s3.amazonaws.com/273_cssShapes/shapes.html" target="_blank"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_demo_nm.jpg" alt=""></a>
</div>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMV99RvAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<h3>Traditional Speech-Bubble</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/Picture 1.png" alt="css shapes" />
</div>
<pre name="code" class="css">
blockquote#one {
 width: 250px;
background: #e3e3e3;
padding: 25px;
position: relative;
}

#one .arrow {
 width: 0;
 height: 0;
 line-height: 0;
 border-top: 30px solid #e3e3e3;
 border-left: 60px solid white;
 border-right: 10px solid white;
 position: absolute;
 bottom: -30px;
 right: 30px;
}
</pre>
<p><em>Note how the &#8220;bottom&#8221; property is the reciprocal of the &#8220;border-top&#8221; property. </em></p>
<h3>Alternate</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/Picture 2.png" alt="css shapes" />
</div>
<pre name="code" class="css">
blockquote#two {
 width: 250px;
background: #e3e3e3;
padding: 25px;
position: relative;
}

blockquote#two .arrow {
 width: 0;
height: 0;
line-height: 0;
border-top: 40px solid #e3e3e3;
border-left: none;
border-right: 30px solid white;
position: absolute;
bottom: 60%;
right: -30px;
}
</pre>
<h3>Yet Another</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/Picture 6.png" alt="css shapes" />
</div>
<pre name="code" class="css">
blockquote#three {
 width: 450px;
 background: #e3e3e3;
 padding: 25px;
 position: relative;
}

#three .arrow {
 width: 0;
 height: 0;
 line-height: 0;
 border-bottom: 25px solid #e3e3e3;
 border-right: 50px solid white;
 position: absolute;
 top: -24px;
 left: 20px;
}
</pre>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/Picture-4.jpg" alt="css shapes" />
</div>
<h4>Interesting Note </h4>
<p>
I&#8217;m typing this paragraph minutes before posting the tutorial. I learned something tonight. Did you know that, if you want your document to validate, you can&#8217;t place text directly into a blockquote? It needs to be nested within a parent element - like the &lt;p> tag. Additionally, the validator didn&#8217;t like the fact that I used a span tag within the blockquote. It allows for a plethora of elements, but unfortunately not the span! Oh well; no big deal. Just replace it with a different element. It hardly makes a difference.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/273_cssShapes/spanTag.png" alt="Span tag within a blockquote" />
</div>
<h3>Pretty Nifty</h3>
<p>
I&#8217;m really eager to see how you guys have implemented this unique trick into your own projects. Send us links to your examples, via the comments. Thanks for watching. Next week, plan on learning something much more advanced. &#8230;I just need to figure out what! Until then.
</p>
<ul class="webroundup">
<li>Follow us on <a href="http://www.twitter.com/nettuts">Twitter</a>, or subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/fun-with-css-shapes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Easiest Way to Use Any Font You Wish</title>
		<link>http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 00:20:01 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=3927</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/259_cufon/200x200.png" alt="The Easiest Way to Use Any Font You Wish" />]]></description>
			<content:encoded><![CDATA[<p>
CSS 3 is on the horizon, and we&#8217;re all getting excited. Thanks to the latest browser updates, developers can begin working with time-saving new properties - such as @font-face. Unfortunately, the availability of these features is limited to a tiny fraction of our overall userbase. At least for the next year or so, we&#8217;ll need to continue utilizing the Flash and Javascript alternatives when embedding fonts.
</p>
<p>
Luckily, a new contender, Cufón, has made the process unbelievably simple. What makes it different? Rather than Flash, it uses a mixture of canvas and VML to render the fonts. In just a few minutes, I&#8217;ll demonstrate how to use any font you wish in your web applications. Excited?
</p>
<p><span id="more-3927"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/259_cufon/MyNewProject.zip"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt=""></a><br />
<a href="http://nettuts.s3.amazonaws.com/259_cufon/MyNewProject/index.html" target="_blank"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_demo_nm.jpg" alt=""></a></div>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMV9bERAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<h3>Pros</h3>
<ul>
<li>Lightning fast! </li>
<li>100 times more simple than siFR. </li>
<li>Up and running in a few minutes. </li>
<li>Not dependent upon a server-side language, like FLIR is. </li>
</ul>
<h3>Cons</h3>
<ul>
<li>It&#8217;s Javascript dependent. If disabled, the default fonts will be used. </li>
<li>The text isn&#8217;t selectable - never a good thing. </li>
<li>You can&#8217;t apply a hover state to converted elements. </li>
</ul>
<h3>Step 1: Download Cufón</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/cufon_homepage.png" alt="Cufon homepage" />
</div>
<p>
Visit <a href="http://cufon.shoqolate.com/generate/">Cufón&#8217;s website</a> and right-click on the &#8220;Download&#8221; button at the top. Choose &#8220;Save-As&#8221; and place it on your desktop.
</p>
<h3>Step 2: Convert a Font</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/fontChoose.png" alt="Choose A Font" />
</div>
<p>
In order to function, we need to use the font converter utility on the website. Alternatively, you may download the source code and convert your fonts locally. For the purposes of demonstration, I&#8217;ve chosen to use an obnoxious font: &#8220;Jokerman&#8221;. <em>Note - Windows users: you may have to copy the font from your &#8220;FONT&#8221; folder to the desktop for this to work. </em>
</p>
<p>
If desired, also upload the italic and bold files as well.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/jokerman.png" alt="Jokerman" />
</div>
<h4>Step 2b</h4>
<p>
Next, you&#8217;ll need to choose which glyphs should be included. Don&#8217;t be so quick to simply &#8220;CHOOSE ALL&#8221;. Doing so will cause the JS file size to increase dramatically. For example, we probably don&#8217;t need all of the Latin glyphs; so make sure they are left unchecked. In my case, I&#8217;ve checked the ones you see below.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/glyphs.png" alt="Glyphs" />
</div>
<h4>Step 2c</h4>
<p>
Cufón allows you to designate a specific url for your file, to increase security. It&#8217;s extremely important that you ensure that you have the proper privileges to use a font. <a href="http://www.fontembedding.com/fonts-and-the-law/">REFER HERE</a> to review the terms. If advantageous, type in your site&#8217;s url into this box.
</p>
<p>
Since we&#8217;re just getting started, you can leave the final two sections at their default values. Accept the terms, and click &#8220;Let&#8217;s Do This&#8221;. You&#8217;ll then be presented with a download box asking you where to save the generated script. Once again, save it to your desktop for easy retrieval.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/download.png" alt="Download Script" />
</div>
<h3>Step 3</h3>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/folderPreview.png" alt="Folder Preview" />
</div>
<p>
The next step is to prepare our project. Create a new folder on your desktop, add an index.html file, and drag your two Javascript files in.
</p>
<p>
Open the index file in your favorite code editor, add the basic HTML tags, and then reference your two Javascript files just before the closing body tag (you&#8217;re free to add them to the head section as well).
</p>
<pre name="code" class="js">
&lt;script type="text/javascript" src="js/cufon-yui.js">&lt;/script>
&lt;script type="text/javascript" src="js/Jokerman_400.font.js">&lt;/script>
</pre>
<h4>Calling the Script</h4>
<p>
Now, we need to decide what text should be replaced. Since our document is still blank, feel free to litter it with random tags and text. Let&#8217;s try to replace the default font in all the H1 tags with Jokerman.
</p>
<pre name="code" class="js">
&lt;script type="text/javascript">
	Cufon.replace('h1');
&lt;/script>
</pre>
<p>
When we call the &#8220;replace&#8221; method, we may append a string containing the tag name that we wish to replace - in our case, all H1 tags. Save the file, and view it in your browser.
</p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/259_cufon/replaced.png" alt="replaced" />
</div>
<h4>Step 3b</h4>
<p>
As always, IE needs a bit more to play nicely with the others. If you view this page in IE, you&#8217;ll notice a slight flickr/delay before the font is rendered. To remedy, simply append:
</p>
<pre name="code" class="js">
&lt;script type="text/javascript"> Cufon.now(); &lt;/script>
</pre>
<h3>Step 4</h3>
<p>
Let&#8217;s imagine that you want to have more control over your selector. For instance, perhaps you don&#8217;t want to change ALL the H1 tags, but merely the ones within the header of your document. Cufón doesn&#8217;t have its own selector engine built in. This feature was omitted to keep the file size as small as possible. Though this might seem like a downfall at first, it&#8217;s actually a great idea. Considering the ubiquity of Javascript frameworks lately, there is no need to double-up. We&#8217;ll review two methods to target specific elements.
</p>
<h4>Method 1: Javascript </h4>
<p>
If you won&#8217;t be using a JS framework in your project, we&#8217;ll simply use:
</p>
<pre name="code" class="js">
Cufon.replace(document.getElementById('header').getElementsByTagName('h1'));
</pre>
<p>
The code above states, &#8220;Get the element which has an id of &#8220;header&#8221;. Then, find all of the H1 tags within this element, and &#8220;replace&#8221; them with our new font.
</p>
<h4>Method 2: jQuery</h4>
<p>
To piggyback off of jQuery&#8217;s selector engine, we only need to import jQuery before Cufón.
</p>
<pre name="code" class="js">
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">&lt;/script>
&lt;script type="text/javascript" src="js/cufon-yui.js">&lt;/script>
&lt;script type="text/javascript" src="js/Jokerman_400.font.js">&lt;/script>
</pre>
<pre name="code" class="js">
Cufon.replace('#header h1');
</pre>
<p>
It&#8217;s as simple as that! Please note that you MUST import jQuery BEFORE your Cufón script in order for this method to work.
</p>
<h3>Complete</h3>
<p>
Believe it or not, you&#8217;re finished! With just a few lines of simple code, you&#8217;re free to use any font you wish! Just make sure you have permission and are compliant with type foundries’ licensing. </p>
<blockquote><p>
The main concern from the perspective of the type foundry appears to be that the typeface script generated by Cufón could be used to reverse engineer the very typeface itself. <br />
<cite>-Cameron Moll</cite>
</p></blockquote>
<p>
What are your thoughts? Have a better method that I&#8217;m not familiar with?
</p>
<ul class="webroundup">
<li>Subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/259_cufon/MyNewProject.zip" length="20582" type="application/zip" /><media:content url="http://nettuts.s3.amazonaws.com/259_cufon/MyNewProject.zip" fileSize="20582" type="application/zip" /><itunes:keywords>Screencasts</itunes:keywords></item>
		<item>
		<title>How to Build a Super Duper News Scroller</title>
		<link>http://net.tutsplus.com/videos/screencasts/how-to-build-a-super-duper-news-scroller/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/how-to-build-a-super-duper-news-scroller/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 01:02:09 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[jQuery]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[screencast]]></category>

		<category><![CDATA[simpepie]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=3569</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/243_newsscroller/200x200.png" alt="How to Build a Simple News Scroller" />]]></description>
			<content:encoded><![CDATA[<p>
This week, we&#8217;ll learn how to combine PHP, SimplePie, and jQuery to build a simple news scroller widget for your website. It&#8217;s much easier than you might think; so let&#8217;s begin.
</p>
<p><span id="more-3569"></span></p>
<div class="tutorial_image">
<a href="http://nettuts.s3.amazonaws.com/243_newsscroller/newsScroller.zip"><br />
<img src="http://nettuts.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt=""></a>
</div>
<div class="tutorial_image">
<embed src="http://blip.tv/play/gcMV9LFYAA" type="application/x-shockwave-flash" width="590" height="443" allowscriptaccess="always" allowfullscreen="true"></embed>
</div>
<p><em>Note that I modified the code slightly after recording this screencast. Don&#8217;t worry, they&#8217;re just minor changes; but as with anything, you should continuously refactor your code. </em></p>
<div class="tutorial_image">
<img src="http://nettuts.s3.amazonaws.com/243_newsscroller/finalPreview.png" alt="Final Product" />
</div>
<h3>Final NewsScroll Plugin</h3>
<pre name="code" class="js">
(function($) {

$.fn.newsScroll = function(options) {

	return this.each(function() {	

		var
		  $this = $(this), 

		  defaults = {
		  	speed: 400,
		  	delay: 3000,
		  	list_item_height: $this.children('li').outerHeight()
	     },

		  settings = $.extend({}, defaults, options); 

	  setInterval(function() {
	  	    $this.children('li:first')
	  	    		.animate({
	  	    			marginTop : '-' + settings.list_item_height,
	  	    		   opacity: 'hide' },

	  	    		   settings.speed,

	  	    		   function() {
	  	 					$this
	  	 					  .children('li:first')
	  	 					  .appendTo($this)
	  	 					  .css('marginTop', 0)
	  	 					  .fadeIn(300);
  		 			  }
 	 			  ); // end animate
 	  }, settings.delay); // end setInterval
	});
}

})(jQuery);
</pre>
<h3>With Commenting </h3>
<pre name="code" class="js">
// Create a self-invoking anonymous function. That way,
// we're free to use the jQuery dollar symbol anywhere within.
(function($) {

// We name our plugin "newscroll". When creating our function,
// we'll allow the user to pass in a couple of parameters.
$.fn.newsScroll = function(options) {

	// For each item in the wrapped set, perform the following.
	return this.each(function() {	

		var
		  // Caches this - or the ul widget(s) that was passed in.
		  //  Saves time and improves performance.
		  $this = $(this), 

		  // If the user doesn't pass in parameters, we'll use this object.
		  defaults = {
		  	speed: 400, // How quickly should the items scroll?
		  	delay: 3000, // How long a rest between transitions?
		  	list_item_height: $this.children('li').outerHeight() // How tall is each list item? If this parameter isn't passed in, jQuery will grab it.
	     },
	      // Create a new object that merges the defaults and the
	      // user's "options".  The latter takes precedence.
		  settings = $.extend({}, defaults, options);

	  // This sets an interval that will be called continuously.
	  setInterval(function() {
	  	    // Get the very first list item in the wrapped set.
	  	    $this.children('li:first')
	  	    		// Animate it
	  	    		.animate({
	  	    			marginTop : '-' + settings.list_item_height, // Shift this first item upwards.
	  	    		   opacity: 'hide' }, // Fade the li out.

	  	    		   // Over the course of however long is
	  	    		   // passed in. (settings.speed)
	  	    		   settings.speed, 

	  	    		   // When complete, run a callback function.
	  	    		   function() {

	  	    		   	// Get that first list item again.
	  	 					$this.children('li:first')
	  	 					     .appendTo($this) // Move it the very bottom of the ul.

	  	 					     // Reset its margin top back to 0. Otherwise,
	  	 					     // it will still contain the negative value that we set earlier.
	  	 					     .css('marginTop', 0)
	  	 					     .fadeIn(300); // Fade in back in.
  		 			  }
 	 			  ); // end animate
 	  }, settings.delay); // end setInterval
	  });
}

})(jQuery);
</pre>
<h3>Final Page</h3>
<pre name="code" class="php:collapse">
&lt;?php

require 'simplepie.inc';
$feed = new SimplePie('http://net.tutsplus.com/rss');
$feed->handle_content_type();

?>

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml">
&lt;head>
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
&lt;link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8" />
&lt;title>Super Duper News Scroller&lt;/title>
&lt;/head>

&lt;body>

&lt;div id="container">
	&lt;h1>Super Duper News Scroller: &lt;small>Built With PHP, SimplePie, and jQuery&lt;/small&lt;/h1>

		&lt;ul id="widget">
			&lt;?php foreach($feed->get_items(0, 15) as $item) : ?>
			&lt;li>
				&lt;?php echo $item->get_description(); ?>
				&lt;h4>&lt;a href="&lt;?php echo $item->get_permalink(); ?>">&lt;?php echo $item->get_title(); ?>&lt;/a>&lt;/h4>
				&lt;p>
					&lt;?php echo $item->get_date(); ?>
				&lt;/p>
			&lt;/li>
			&lt;?php endforeach; ?>
		&lt;/ul>
&lt;/div>&lt;!--end container-->

&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">&lt;/script>
&lt;script type="text/javascript" src="jquery.newsScroll.js">&lt;/script>

&lt;script type="text/javascript">
	$('#widget').newsScroll({
		speed: 2000,
		delay: 5000
	});

	// or just call it like:
	// $('#widget').newsScroll();
&lt;/script>

&lt;/body>
&lt;/html>
</pre>
<h3>That&#8217;s It</h3>
<p>
In twenty minutes, we were able to build a nice and simple scroller. You&#8217;re now free to take the plugin and expand it to your needs. What you have here should be considered the first step. How can you improve upon it?
</p>
<h3>You Also Might Like&#8230;</h3>
<ul class="webroundup">
<li>
<div class='tutorial_image'><img src='http://nettuts.s3.amazonaws.com/222_extendingSimplePie/200x200.jpg' alt='Screenshot 1' /></div>
<h4>Extending SimplePie to Parse Unique RSS Feeds</h4>
<p>A few days ago, as I prepared our Create a Slick Flickr Gallery with SimplePie tutorial, it occurred to me that we haven’t posted many articles that covered SimplePie. Considering how fantastic a library it is, I think it’s time to take a closer look. </p>
<p><a href='http://net.tutsplus.com/videos/screencasts/extending-simplepie-to-parse-unique-rss-feeds/'>Visit Article</a></p>
</li>
<li>
<div class='tutorial_image'><img src='http://nettuts.s3.amazonaws.com/215_jqueryPlugin/200x200.png' alt='Screenshot 1' /></div>
<h4>You Still Can&#8217;t Create a jQuery Plugin?</h4>
<p>It’s tough. You read tutorial after tutorial, but they all assume that you know more than you actually do. By the time you’re finished, you’re left feeling more confused than you initially were. Why did he create an empty object? What does it mean when you pass “options” as a parameter? What do “defaultsettings” actually do?</p>
<p>Never fear; I’m going to show you exactly how to build your own “tooltip” plugin, at the request of one of our loyal readers. </p>
<p><a href='http://net.tutsplus.com/videos/screencasts/you-still-cant-create-a-jquery-plugin/'>Visit Article</a></p>
</li>
<li>
<div class='tutorial_image'><img src='http://themeforest.s3.amazonaws.com/22_jQueryForBeginners/jQueryForBeginnersBlogImage.png' alt='Screenshot 1' /></div>
<h4>jQuery for Absolute Beginners</h4>
<p>Hi everyone! Today, I posted the final screencast in my “jQuery for Absolute Beginners” series on the ThemeForest Blog. If you’re unfamiliar - over the course of about a month, I posted fifteen video tutorials that teach you EXACTLY how to use the jQuery library. We start by downloading the library and eventually work our way up to creating an AJAX style-switcher.</p>
<p><a href='http://net.tutsplus.com/articles/web-roundups/jquery-for-absolute-beginners-video-series/'>Visit Article</a></p>
</li>
<li>
<div class='tutorial_image'><img src='http://themeforest.s3.amazonaws.com/39_DivingIntoPHP/diving-into-php.jpg' alt='Screenshot 1' /></div>
<h4>Diving into PHP: Video Series</h4>
<p>Today marks the beginning of a brand new series on the ThemeForest blog that will show you EXACTLY how to get started with PHP. Just as with the “jQuery for Absolute Beginners” screencasts, we’ll start from scratch and slowly work our way up to some more advanced topics. If you’ve been hoping to learn this language, be sure to pay a visit and subscribe to the RSS feed to be updated when new videos are posted.</p>
<p><a href='http://net.tutsplus.com/videos/screencasts/diving-into-php-video-series/'>Visit Article</a></p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/how-to-build-a-super-duper-news-scroller/feed/</wfw:commentRss>
		<enclosure url="http://nettuts.s3.amazonaws.com/243_newsscroller/newsScroller.zip" length="100529" type="application/zip" /><media:content url="http://nettuts.s3.amazonaws.com/243_newsscroller/newsScroller.zip" fileSize="100529" type="application/zip" /><itunes:keywords>Screencasts, JavaScript, jQuery, PHP, screencast, simpepie</itunes:keywords></item>
		<item>
		<title>Professional Frontend Engineering</title>
		<link>http://net.tutsplus.com/videos/screencasts/professional-frontend-engineering/</link>
		<comments>http://net.tutsplus.com/videos/screencasts/professional-frontend-engineering/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 05:57:45 +0000</pubDate>
		<dc:creator>Jeffrey Way</dc:creator>
		
		<category><![CDATA[Screencasts]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=3632</guid>
		<description><![CDATA[<img src="http://nettuts.s3.amazonaws.com/246_frontendEngineering/natekoechley280.jpg" alt="Professional Frontend Engineering" />]]></description>
			<content:encoded><![CDATA[<p>
Last night, long after I should have fallen asleep, I came across a fantastic overview of &#8220;frontend engineering.&#8221; This is a must-watch video, presented by <a href="http://nate.koechley.com/">Nate Koechley</a>. Many designers will get more from this video than an entire book. Nate covers everything from underused html tags, to doctypes, to proper naming conventions. I highly recommend watching it.
</p>
<p><span id="more-3632"></span></p>
<div class="tutorial_image">
<object width="512" height="322"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" /><param name="allowFullScreen" value="true" /><param name="AllowScriptAccess" VALUE="always" /><param name="bgcolor" value="#000000" /><param name="flashVars" value="id=12486762&#038;vid=4671445&#038;lang=en-us&#038;intl=us&#038;thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/7843/81860441.jpeg&#038;embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" type="application/x-shockwave-flash" width="512" height="322" allowFullScreen="true" AllowScriptAccess="always" bgcolor="#000000" flashVars="id=12486762&#038;vid=4671445&#038;lang=en-us&#038;intl=us&#038;thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/7843/81860441.jpeg&#038;embed=1" ></embed></object><br /><a href="http://video.yahoo.com/watch/4671445/12486762">Nate Koechley: &quot;Professional Frontend Engineering&quot;</a>
</div>
<ul class="webroundup">
<li>Subscribe to the <a href="http://feeds.feedburner.com/nettuts" title="NETTUTS RSS Feed">NETTUTS RSS Feed</a> for more daily web development tuts and articles.</li>
</ul>
<p>
<script type="text/javascript"><!--digg_url = "post permalink (not digg url)"; // -->
</script><br />
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://net.tutsplus.com/videos/screencasts/professional-frontend-engineering/feed/</wfw:commentRss>
		<enclosure url="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" length="1343" type="application/x-shockwave-flash" /><media:content url="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" fileSize="1343" type="application/x-shockwave-flash" /><itunes:keywords>Screencasts</itunes:keywords></item>
	<media:rating>nonadult</media:rating></channel>
</rss>
