<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Weebtutorials</title>
	<atom:link href="http://weebtutorials.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://weebtutorials.com</link>
	<description>Web development tutorials</description>
	<lastBuildDate>Wed, 18 Apr 2012 07:14:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>PHP: How to retrieve data from database &amp; format as XML</title>
		<link>http://weebtutorials.com/2012/04/php-how-to-retrieve-data-from-database-format-as-xml/</link>
		<comments>http://weebtutorials.com/2012/04/php-how-to-retrieve-data-from-database-format-as-xml/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 18:42:10 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=755</guid>
		<description><![CDATA[<p>This tutorial will show you how to connect to a MySQL database, retrieve some data and finally how to format and display that data in XML format. The code will be written in OOP format, which in this case means creating a number of re-usable classes. An outline of the steps: &#160; See demo: Step 1: Connecting to the database. As mentioned previously, the code is going to be written in an object oriented fashion. Let us begin with the connection class. To establish the connection the class will use PDO, you can read more about PDO and the following class using the link below: http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/ Moving on, Create a new file called &#8216;db_conn.class.php&#8217; and add the following code. First of all, the class is using the singleton pattern. If you don&#8217;t know what this is you can find out more using the link provided previously. Just for clarity though, the pattern is used when global access is desirable and only one instance of the class is required. You will notice that the &#8216;__construct&#8217; method is set to private. This prevents the class from be instantiated externally. The &#8216;getConnection&#8217; method is set to &#8216;public static&#8217; which means it is accessible externally, and can be called without ever instantiating the class. The method checks to see if a database connection object exists, if not it creates one and then returns it. Using this class it is possible to connect to the database, you can do so by using the following code: Step 2: Create class to query database. With the database connection class complete, let us move on to the database query class. The class below is an abstract class and is used to provide a base set of methods &#38; properties for any children which extend it. Although using an abstract class isn&#8217;t actually necessary in this scenario, it makes it possible to easily extend the functionality at a later date if needs be. For example, you could easily create another child class, lets say &#8216;getRecordSet&#8217; which could then be used to return data in the usual format, rather than XML. As a final note, abstract classes cannot be instantiated &#8211; so you will not be using this class directly. Instead you will create a further class which extends it. Take a look at the code below, then see the explanation beneath it for further clarification. First of all though, create a new document called &#8216;getRecordSet.class&#8217; and add in the code. So, first of all the connection class is &#8216;imported&#8217; using the &#8216;require_once&#8217; function. The class is now available for use. The class is then declared with the abstract access modifier (cannot be used directly, must inherit from the class first). Inside the class we declare two properties, with the protected access modifier. This means the properties can only be used INSIDE the class, or inside child classes. The &#8216;db&#8217; property will hold the database connection object, the &#8216;stmt&#8217; property will hold the SQL statement. Inside the constructor the connection class is used to establish a database connection, and finally is a function used to query the database and return the result. Step 3: Create a child class to format sql query results as XML. The following class is a child of the previous class and is used to set the xml headers, format the sql results and finally to display them. The comments explain the process fairly well, but it seems necessary to a least give an overview first. The class has a method named &#8216;getRecordSet&#8217;, the same as its parent. Inside this method,  the necessary headers are set for XML, the &#8216;getRecordSet&#8217; method of the parent is called (runs query and returns data) and a new variable is created to store the results. At this point the function loops through the data set, storing the data into structured XML nodes. XML nodes work in a similar way to HTML elements, they have an opening tag, a closing tag and can also have attributes, the only difference being you can name them as you wish. In this example, by using an associative array (&#8216;fetch(PDO::FETCH_ASSOC)&#8217;), the name of the database column will be saved to the array key. This key is then used to name the XML nodes, so our XML nodes will be named the same as the database columns. Take a look at the demo to get an idea of how this looks. Quick note: You will notice that the &#8216;getRecordSet&#8217; method accepts another parameter, this is the name used for the custom XML elements</p>
 ]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to connect to a MySQL database, retrieve some data and finally how to <strong>format and display that data in XML format</strong>. The code will be written in OOP format, which in this case means creating a number of re-usable classes.</p>
<p>An outline of the steps:</p>
<div class="shortcode-list shortcode-list-arrow3">
<ul>
<li>Create database connection class.</li>
<li>Create class to query database.</li>
<li>Create child class with method to format data as XML.</li>
</ul>
</div>
<p>&nbsp;</p>
<h2>See demo:</h2>
<p><a href="http://weebtutorials.com/examples/sqltoxml/demo.php" class="gdl-button shortcode-small-button" style="color:#fff; background-color:#efac1b; border-color:#e3a31a; ">XML Demo</a></p>
<h2>Step 1: Connecting to the database.</h2>
<p>As mentioned previously, the code is going to be written in an object oriented fashion. Let us begin with the connection class. To establish the connection the class will use PDO, you can read more about PDO and the following class using the link below:</p>
<p><a title="PDO Connection class" href="http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/">http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/</a></p>
<p>Moving on, Create a new file called &#8216;db_conn.class.php&#8217; and add the following code.</p><pre class="crayon-plain-tag">&amp;lt;?php

//db connection class using singleton pattern
class dbConn{

//variable to hold connection object.
protected static $db;

//private construct - class cannot be instantiated externally.
private function __construct() {

try {
// assign PDO object to db variable
self::$db = new PDO( 'mysql:host=localhost;dbname=DBNAME', 'USERNAME', 'PASSWORD' );
setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}
catch (PDOException $e) {
//Output error - would normally log this to error file rather than output to user.
echo &quot;Connection Error: &quot; . $e-&amp;gt;getMessage();
}

}

// get connection function. Static method - accessible without instantiation
public static function getConnection() {

//Guarantees single instance, if no connection object exists then create one.
if (!self::$db) {
//new connection object.
new dbConn();
}

//return connection.
return self::$db;
}

}//end class

?&amp;gt;</pre><p>First of all, the class is using the singleton pattern. If you don&#8217;t know what this is you can find out more using the link provided previously. Just for clarity though, the pattern is used when global access is desirable and only one instance of the class is required. You will notice that the &#8216;__construct&#8217; method is set to private. This prevents the class from be instantiated externally.</p>
<p>The &#8216;getConnection&#8217; method is set to &#8216;public static&#8217; which means it is accessible externally, and can be called without ever instantiating the class. The method checks to see if a database connection object exists, if not it creates one and then returns it.</p>
<p>Using this class it is possible to connect to the database, you can do so by using the following code:</p><pre class="crayon-plain-tag">$conn = dbConn::getConnection();</pre><p></p>
<h2>Step 2: Create class to query database.</h2>
<p>With the database connection class complete, let us move on to the database query class. The class below is an abstract class and is used to provide a base set of methods &amp; properties for any children which extend it.</p>
<p>Although using an abstract class isn&#8217;t actually necessary in this scenario, it makes it possible to easily extend the functionality at a later date if needs be. For example, you could easily create another child class, lets say &#8216;getRecordSet&#8217; which could then be used to return data in the usual format, rather than XML.</p>
<p>As a final note, abstract classes cannot be instantiated &#8211; so you will not be using this class directly. Instead you will create a further class which extends it.</p>
<p>Take a look at the code below, then see the explanation beneath it for further clarification. First of all though, create a new document called &#8216;getRecordSet.class&#8217; and add in the code.</p><pre class="crayon-plain-tag">//include db connection class
require_once( 'db_conn.class.php' );

// abstract class used as base class to store functionality/data required by children.
abstract class get_RecordSet {

//properties.
protected $db;
protected $stmt;

//constructor
function __construct()
{
//store db connection in class property.
$this-&amp;gt;db = dbConn::getConnection();
}

//standard function to retrieve database info using PDO.
public function getRecordSet ($sql)
{
$this-&amp;gt;stmt = $this-&amp;gt;db-&amp;gt;query($sql);
return $this-&amp;gt;stmt;
}

}</pre><p>So, first of all the connection class is &#8216;imported&#8217; using the &#8216;require_once&#8217; function. The class is now available for use. The class is then declared with the abstract access modifier (cannot be used directly, must inherit from the class first).</p>
<p>Inside the class we declare two properties, with the protected access modifier. This means the properties can only be used INSIDE the class, or inside child classes. The &#8216;db&#8217; property will hold the database connection object, the &#8216;stmt&#8217; property will hold the SQL statement.</p>
<p>Inside the constructor the connection class is used to establish a database connection, and finally is a function used to query the database and return the result.</p>
<h2>Step 3: Create a child class to format sql query results as XML.</h2>
<p>The following class is a child of the previous class and is used to set the xml headers, format the sql results and finally to display them. The comments explain the process fairly well, but it seems necessary to a least give an overview first.</p>
<p>The class has a method named &#8216;getRecordSet&#8217;, the same as its parent. Inside this method,  the necessary headers are set for XML, the &#8216;getRecordSet&#8217; method of the parent is called (runs query and returns data) and a new variable is created to store the results.</p>
<p>At this point the function loops through the data set, storing the data into structured XML nodes. XML nodes work in a similar way to HTML elements, they have an opening tag, a closing tag and can also have attributes, the only difference being you can name them as you wish.</p>
<p>In this example, by using an associative array (<em>&#8216;fetch(PDO::FETCH_ASSOC)&#8217;</em>), the name of the database column will be saved to the array key. This key is then used to name the XML nodes, so our XML nodes will be named the same as the database columns. Take a look at the demo to get an idea of how this looks.</p>
<p><strong>Quick note:</strong> You will notice that the &#8216;getRecordSet&#8217; method accepts another parameter, this is the name used for the custom XML elements<br />
<pre class="crayon-plain-tag">//class to return record set in xml format
class XMLRecordSet extends get_RecordSet {

//overiding base class. Two parameters, first is sql statement, second is option and is
//the name to be used for xml.
public function getRecordSet($sql, $elementName = 'element')
{

//Set headers to XML.
header(&quot;Content-Type: text/xml&quot;);

try {
//execute parent function to run query &amp;amp; retrieve data.
$stmt = parent::getRecordSet($sql);

//var to store values
$returnValue = &quot;&quot;;
//xml header info
$returnValue .= &quot;&amp;lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;ISO-8859-1\&quot;?&amp;gt;\n&quot;;
//xml parent node, or wrapper to be named according to 'element' parameter
$returnValue .= &quot;&amp;lt;{$elementName}s&amp;gt;\n&quot;;
// fetch each record as an associative array
while ($book = $stmt-&amp;gt;fetch(PDO::FETCH_ASSOC)) {
//child node element name
$returnValue .= &quot;\t&amp;lt;$elementName&amp;gt;\n&quot;;
// iterate through each field in the associative array,
foreach ($book as $key =&amp;gt; $value) {
// Store values as xml elements, using key as element name.
$returnValue .= &quot;\t\t&amp;lt;$key&amp;gt;&quot; . htmlspecialchars($value) .&quot;&amp;lt;/$key&amp;gt;\n&quot;;
}
//close each single element.
$returnValue .= &quot;\t&amp;lt;/$elementName&amp;gt;\n&quot;;
}
//close xml wrapper element.
$returnValue .= &quot;&amp;lt;/{$elementName}s&amp;gt;\n&quot;;

//return data in xml format.
return $returnValue;

}
catch (PDOException $e) {
//catch and display error
echo &quot;Connection Error: &quot; . $e-&amp;gt;getMessage();
}
}
}</pre>
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2012/04/php-how-to-retrieve-data-from-database-format-as-xml/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2012/04/php-how-to-retrieve-data-from-database-format-as-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BrownPort WordPress theme.</title>
		<link>http://weebtutorials.com/2012/04/brownport-wordpress-theme/</link>
		<comments>http://weebtutorials.com/2012/04/brownport-wordpress-theme/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 18:48:12 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress theme]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=734</guid>
		<description><![CDATA[<p>Free WordPress theme: Another free wordpress theme today&#8230;Been working on this on and off for a while now. The theme was originally created for use on my portfolio site, but i didnt actually get around to installing it. There may be a couple of bugs, so if you spot anything acting wierdly leave a comment on this page and i&#8217;ll check it out! See demo: Download free theme: Images: &#160; Description: The theme can be best described as a blog / portfolio style template. The front page is made up of dynamic content, including a slideshow which is pulled from the posts stored in the wordpress database. Included in the theme are many features such as an inbuilt content form, multiple widget areas and full support. An overview of these features is listed below: In built contact form. Homepage Slider. Multiple page templates. Ajax contact form in footer. A total of 8 widget areas for full customisation of the theme. Regular bug fixes / updates. Just leave a comment if you spot any problems.</p>
 ]]></description>
			<content:encoded><![CDATA[<h2>Free WordPress theme:</h2>
<p>Another<strong> free wordpress theme</strong> today&#8230;Been working on this on and off for a while now. The theme was originally created for use on my portfolio site, but i didnt actually get around to installing it. There may be a couple of bugs, so if you spot anything acting wierdly leave a comment on this page and i&#8217;ll check it out!</p>
<h2>See demo:</h2>
<p><a href="http://weebtutorials.com/testEnvironemnt/" class="gdl-button shortcode-small-button" style="color:#fff; background-color:#efac1b; border-color:#e3a31a; ">BrownPort Theme</a></p>
<h2>Download free theme:</h2>
<p><a href="http://weebtutorials.com/wp-content/uploads/2012/04/brownPort12.zip" class="gdl-button shortcode-small-button" style="color:#fff; background-color:#efac1b; border-color:#e3a31a; ">Download Theme</a></p>
<h2>Images:</h2>
<p><a href="http://weebtutorials.com/wp-content/uploads/2012/03/brown2.png"><img class="wp-image-648 alignnone" title="brown2" src="http://weebtutorials.com/wp-content/uploads/2012/03/brown2-300x183.png" alt="" width="300" height="183" /></a></p>
<h2><a href="http://weebtutorials.com/wp-content/uploads/2012/03/brown3.png"><img class="size-medium wp-image-649 alignnone" title="brown3" src="http://weebtutorials.com/wp-content/uploads/2012/03/brown3-300x183.png" alt="" width="300" height="183" /></a></h2>
<p>&nbsp;</p>
<h2>Description:</h2>
<p>The<strong> theme </strong>can be best described as a blog / portfolio style template. The front page is made up of dynamic content, including a slideshow which is pulled from the posts stored in the wordpress database. Included in the theme are many features such as an inbuilt content form, multiple widget areas and full support. An overview of these features is listed below:</p>
<ol>
<li>In built contact form.</li>
<li>Homepage Slider.</li>
<li>Multiple page templates.</li>
<li>Ajax contact form in footer.</li>
<li>A total of 8 widget areas for full customisation of the theme.</li>
<li>Regular bug fixes / updates. Just leave a comment if you spot any problems.</li>
</ol>
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2012/04/brownport-wordpress-theme/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2012/04/brownport-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDO Connection Class using singleton pattern.</title>
		<link>http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/</link>
		<comments>http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 19:47:54 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PDO]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=631</guid>
		<description><![CDATA[<p>&#160; This post will show you how to create a PDO connection class using the singleton pattern. Before jumping into the code, take a look at the following paragraphs if you are new to PDO or the singleton pattern. What is PDO? PDO stands for PHP data objects, it is an API and can be used as an alternative to the MySQL, or MySQLi extensions.  Using the API it is possible to connect to databases in a consistent way, meaning it is possible to switch between different types of databases easily. For example, switching from a MySQL database to a SQLite can be achieved by changing a single line of code. The API also has a bunch of useful methods. An example being &#8216;prepare()&#8217; and &#8216;execute()&#8217; which make it possible to write prepared statements easily. Check out the php.net page for further info. What is the singleton pattern? A design pattern is normally used as a solution to a common problem, it can be thought of as a template or blueprint on which code can be structured. The singleton pattern is used to ensure there is only one instance of a class, and that global access is possible. Although there are cases when connections to multiple databases will be required it is quite rare. With that said, we can assume that creating multiple instances of the database connection class would be a wasteful use of resources. To prevent this, the following singleton class can be used. The code Below is the class, check the comments for explanations. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 &#60;?php //db connection class using singleton pattern class dbConn{ //variable to hold connection object. protected static $db; //private construct - class cannot be instatiated externally. private function __construct() { try { // assign PDO object to db variable self::$db = new PDO( 'mysql:host=localhost;dbname=DBNAME', 'USERNAME', 'PASSWORD' ); setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch (PDOException $e) { //Output error - would normally log this to error file rather than output to user. echo &#34;Connection Error: &#34; . $e-&#62;getMessage(); } } // get connection function. Static method - accessible without instantiation public static function getConnection() { //Guarantees single instance, if no connection object exists then create one. if (!self::$db) { //new connection object. new dbConn(); } //return connection. return self::$db; } }//end class ?&#62; Further explanation A quick over-view of how the class works: The &#8216;getConnection()&#8217; method is called. This method checks that there is no existing connection, if this is the case then it creates a new instance of the &#8216;dbConn&#8217; class (itself).  Upon creation of this class the constructor is executed which then creates a new instance of the PDO class, this connects to the database. The PDO object is then saved to the &#8216;db&#8217; property. So, that&#8217;s the singleton pattern. It&#8217;s probably the easiest pattern to understand so i wont go into too much detail.  It is worth noting that the constructor is set to private, this means the class cannot be instantiated without using the &#8216;getConnection()&#8217; method. If the constructor was public, then it would be possible to create multiple instances of the class. Example usage 1 2 3 4 5 6 7 &#60;?php //calling static method ( '::' rather than '-&#62;') $db = dbConn::getConnection(); ?&#62;</p>
 ]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>This post will show you how to create a <strong>PDO connection class</strong> using the singleton pattern. Before jumping into the code, take a look at the following paragraphs if you are new to PDO or the singleton pattern.</p>
<h2>What is PDO?</h2>
<p><strong>PDO stands for PHP data objects</strong>, it is an API and can be used as an alternative to the MySQL, or MySQLi extensions.  Using the API it is possible to connect to databases in a consistent way, meaning it is possible to switch between different types of databases easily. For example, switching from a MySQL database to a SQLite can be achieved by changing a single line of code.</p>
<p>The API also has a bunch of useful methods. An example being &#8216;prepare()&#8217; and &#8216;execute()&#8217; which make it possible to write prepared statements easily.</p>
<p>Check out the <a title="MySQL connections" href="http://www.php.net/manual/en/mysqli.overview.php">php.net</a> page for further info.<span id="more-631"></span></p>
<h2>What is the singleton pattern?</h2>
<p>A design pattern is normally used as a <strong>solution to a common problem</strong>, it can be thought of as a template or blueprint on which code can be structured. The singleton pattern is used to ensure there is only<strong> one instance of a class</strong>, and that global access is possible. Although there are cases when connections to multiple databases will be required it is quite rare.</p>
<p>With that said, we can assume that creating multiple instances of the database connection class would be a wasteful use of resources. To prevent this, the following singleton class can be used.</p>
<h2>The code</h2>
<p>Below is the class, check the comments for explanations.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?php</span>

<span class="php-comment">//db connection class using singleton pattern
</span>
<span class="php-keyword">class</span> dbConn<span class="php-brackets">{</span>

<span class="php-comment">//variable to hold connection object.
</span>
<span class="php-keyword">protected</span> <span class="php-keyword">static</span> <span class="php-var">$db</span>;

<span class="php-comment">//private construct - class cannot be instatiated externally.
</span>
<span class="php-keyword">private</span> <span class="php-function">function</span> __construct<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>

<span class="php-keyword">try</span> <span class="php-brackets">{</span>
<span class="php-comment">// assign PDO object to db variable
</span>
self<span class="php-operator">:</span><span class="php-operator">:</span><span class="php-var">$db</span> <span class="php-operator">=</span> <span class="php-keyword">new</span> PDO<span class="php-brackets">(</span> <span class="php-string">'mysql:host=localhost;dbname=DBNAME'</span>, <span class="php-string">'USERNAME'</span>, <span class="php-string">'PASSWORD'</span> <span class="php-brackets">)</span>;
setAttribute<span class="php-brackets">(</span> PDO<span class="php-operator">:</span><span class="php-operator">:</span>ATTR_ERRMODE, PDO<span class="php-operator">:</span><span class="php-operator">:</span>ERRMODE_EXCEPTION <span class="php-brackets">)</span>;
<span class="php-brackets">}</span>
<span class="php-keyword">catch</span> <span class="php-brackets">(</span>PDOException <span class="php-var">$e</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
<span class="php-comment">//Output error - would normally log this to error file rather than output to user.
</span>
<span class="php-keyword">echo</span> <span class="php-string">&quot;Connection Error: &quot;</span> <span class="php-operator">.</span> <span class="php-var">$e</span><span class="php-operator">-</span><span class="php-operator">&gt;</span>getMessage<span class="php-brackets">(</span><span class="php-brackets">)</span>;
<span class="php-brackets">}</span>

<span class="php-brackets">}</span>

<span class="php-comment">// get connection function. Static method - accessible without instantiation
</span>
<span class="php-keyword">public</span> <span class="php-keyword">static</span> <span class="php-function">function</span> getConnection<span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>

<span class="php-comment">//Guarantees single instance, if no connection object exists then create one.
</span>
<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-operator">!</span>self<span class="php-operator">:</span><span class="php-operator">:</span><span class="php-var">$db</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
<span class="php-comment">//new connection object.
</span>
<span class="php-keyword">new</span> dbConn<span class="php-brackets">(</span><span class="php-brackets">)</span>;
<span class="php-brackets">}</span>

<span class="php-comment">//return connection.
</span>
<span class="php-keyword">return</span> self<span class="php-operator">:</span><span class="php-operator">:</span><span class="php-var">$db</span>;
<span class="php-brackets">}</span>

<span class="php-brackets">}</span><span class="php-comment">//end class
</span>

<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<h2>Further explanation</h2>
<p><strong>A quick over-view of how the class works:</strong></p>
<p>The &#8216;getConnection()&#8217; method is called. This method checks that there is no existing connection, if this is the case then it creates a new instance of the &#8216;dbConn&#8217; class (itself).  Upon creation of this class the constructor is executed which then creates a new instance of the PDO class, this connects to the database. The PDO object is then saved to the &#8216;db&#8217; property.</p>
<p>So, that&#8217;s the singleton pattern. It&#8217;s probably the easiest pattern to understand so i wont go into too much detail.  It is worth noting that the constructor is set to private, this means the class cannot be instantiated without using the &#8216;getConnection()&#8217; method. If the constructor was public, then it would be possible to create multiple instances of the class.</p>
<h2>Example usage</h2>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?php</span>
<span class="php-comment">//calling static method ( '::' rather than '-&gt;')
</span>
<span class="php-var">$db</span> <span class="php-operator">=</span> dbConn<span class="php-operator">:</span><span class="php-operator">:</span>getConnection<span class="php-brackets">(</span><span class="php-brackets">)</span>;
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2012/03/pdo-connection-class-using-singleton-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with Responsive web design.</title>
		<link>http://weebtutorials.com/2012/01/getting-started-with-responsive-web-design/</link>
		<comments>http://weebtutorials.com/2012/01/getting-started-with-responsive-web-design/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 18:48:06 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Responsive]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=602</guid>
		<description><![CDATA[<p>I was recently asked to design a responsive template for a client, the concept is new to me so i decided to follow a couple of tutorials and write one of my own. So, what is a responsive website? Well, it&#8217;s a website that has a dynamic layout &#8211; those viewing the site on a normal desktop pc (1024&#215;768 for example) might see a standard layout, while those browsing on an iPhone may see a modified, more minimalistic layout. It is important to consider the different media used to browse the web today. Smartphones, ipods and tablets are ubiquitous and could be used by a significant proportion of your user-base. This tutorial will cover the basics only, showing you how to create a bare-bones responsive web template. Try re-sizing your browser to see the results. Demo Download Step 1 &#8211; HTML for responsive template To get started you will need a HTML template. Simply copy and paste the code provided below, or alternatively download the code using the button above. The template is using a HTML 5 doctype, and contains a few simple sections. First is the header, then the content, followed by the sidebar and finally the footer. If you are unable to follow this code it is probably a good idea to check out some beginner HTML tutorials first of all. &#160; Step 2 &#8211; Style the page using CSS As with the HTML, there is very little here that needs explaining. The majority of the code is simply applying backgrounds, colours, borders etc. The clearfix rule probably needs a little explaining, take a look at webtoolkit.info for further info. Step 3 &#8211; Make the template responsive. Using media queries it is possible to make the theme responsive. Lets look at the first example: This piece of code will only apply to those using a higher resolution, and that&#8217;s how media queries work &#8211; they make it possible to check a certain condition and then run a specific piece of code based on the result. In this case, the code is applied when the browser is at least 1300px wide. You may have noticed it is only a very simply change, the width is simply increased on the wrapper DIV. When there is less screen space available it becomes necessary to sometimes make further changes. An example of this is provided below. The rule above is applied to the website when the browser has a width of up to 330px. At such a dimension horizontal space is obviously minimal and should be used wisely. For this reason it seems wise to remove, or at least move the sidebar. As the content and sidebar containers are floated to the left, all we need to do is alter the width so that there is not enough space for them to sit side-by-side. By doing this, the sidebar will move below the content. In this example both the content and sidebar DIVs are set to span the entire available width of their parents, minus the space needed for padding. Full stylesheet for reference: For some commonly used media-query widths, check out smipple.net.</p>
 ]]></description>
			<content:encoded><![CDATA[<p>I was recently asked to design a <strong>responsive</strong> template for a client, the concept is new to me so i decided to follow a couple of tutorials and write one of my own. So, what is a <strong>responsive website</strong>? Well, it&#8217;s a website that has a dynamic layout &#8211; those viewing the site on a normal desktop pc (1024&#215;768 for example) might see a standard layout, while those browsing on an iPhone may see a modified, more minimalistic layout.</p>
<p>It is important to consider the different media used to browse the web today. Smartphones, ipods and tablets are ubiquitous and could be used by a significant proportion of your user-base.</p>
<p>This tutorial will cover the basics only, showing you how to create a bare-bones responsive web template. Try re-sizing your browser to see the results.</p>
<h2>Demo</h2>
<p><a href="http://weebtutorials.com/examples/reponsiveTemplate" class="gdl-button shortcode-small-button" style="color:#fff; background-color:#efac1b; border-color:#e3a31a; ">Demo</a></p>
<h2>Download</h2>
<p><a href="http://weebtutorials.com/examples/reponsiveTemplate/reponsiveTemplate.zip" class="gdl-button shortcode-small-button" style="color:#fff; background-color:#efac1b; border-color:#e3a31a; ">Download</a></p>
<h2><span id="more-602"></span>Step 1 &#8211; HTML for responsive template</h2>
<p>To get started you will need a HTML template. Simply copy and paste the code provided below, or alternatively download the code using the button above.</p>
<p>The template is using a HTML 5 doctype, and contains a few simple sections. First is the header, then the content, followed by the sidebar and finally the footer. If you are unable to follow this code it is probably a good idea to check out some beginner HTML tutorials first of all.</p><pre class="crayon-plain-tag">&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
	&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;
	&amp;lt;link href=&quot;stylesheet.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot;&amp;gt;

	&amp;lt;!-- Prevent elements from being automatically re-sized on apple iphones, ipad etc --&amp;gt;
	&amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width; initial-scale=1.0; maximum-scale=1.0;&quot;&amp;gt;

	&amp;lt;title&amp;gt;Responsive Web template&amp;lt;/title&amp;gt;

&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

	&amp;lt;div id=&quot;wrapper&quot; class=&quot;clearfix&quot;&amp;gt;
		&amp;lt;header&amp;gt;

			&amp;lt;h1&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Weeb Tutorials.com Responsive template&amp;lt;/a&amp;gt;&amp;lt;/h1&amp;gt;

		&amp;lt;/header&amp;gt;

		&amp;lt;div id=&quot;content&quot;&amp;gt;

			&amp;lt;h2&amp;gt;Lorem Ipsum&amp;lt;/h2&amp;gt;

			&amp;lt;p&amp;gt;
				Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
			&amp;lt;/p&amp;gt;

			&amp;lt;img src=&quot;tech-sect.jpg&quot; alt=&quot;sample&quot; /&amp;gt;

		&amp;lt;/div&amp;gt;

		&amp;lt;div id=&quot;sidebar&quot;&amp;gt;

			&amp;lt;h2&amp;gt;Recent Posts&amp;lt;/h2&amp;gt;

			&amp;lt;ul&amp;gt;
				&amp;lt;li&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt; A sample tutorial &amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt; A sample tutorial &amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt; A sample tutorial &amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt; A sample tutorial &amp;lt;/li&amp;gt;
				&amp;lt;li&amp;gt; &amp;lt;a href=&quot;#&quot;&amp;gt; A sample tutorial &amp;lt;/li&amp;gt;
			&amp;lt;/ul&amp;gt;

		&amp;lt;/div&amp;gt;

		&amp;lt;footer&amp;gt;Tutorial by &amp;lt;a href=&quot;http://www.weebtutorials.com&quot;&amp;gt; Weeb tutorials&amp;lt;/a&amp;gt;&amp;lt;/footer&amp;gt;
	&amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;</pre><p>&nbsp;</p>
<h2>Step 2 &#8211; Style the page using CSS</h2>
<p>As with the HTML, there is very little here that needs explaining. The majority of the code is simply applying backgrounds, colours, borders etc. The clearfix rule probably needs a little explaining, take a look at <a title="clearfix" href="http://www.webtoolkit.info/css-clearfix.html">webtoolkit.info </a>for further info.</p><pre class="crayon-plain-tag">body{
	font-family:&quot;Myriad Pro&quot;, &quot;Tahoma&quot;;
	font-size:100%;
	color:#444;
}     

/* Content elements */
p{
	margin:18px 0;
	font-size:1em;
}
h1 {
	font-size:1.5em;
}
h2{
	font-size:1.2em;
	margin-top:20px;
}
/* Site structure */
#wrapper{
	background:#fff;
	border:1px #ddd solid;
	width:960px;
	margin:0 auto;
}  

header {
	padding:1%;
}
#content {
	float:left;
	width:72%;
	padding:1%;
}

#sidebar {
	float:left;
	width:24%;
	padding:1%;
	background: #e4f1f4;
}

footer {
	padding:1%;
	width:98%;
	clear:both;
	background:#efefef;
	text-align:center;
}

/* Fixes */
.clearfix:after {
	content: &quot;.&quot;;
	display: block;
	clear: both;
	visibility: hidden;
	line-height: 0;
	height: 0;
}</pre><p></p>
<h2>Step 3 &#8211; Make the template responsive.</h2>
<p>Using media queries it is possible to make the theme responsive. Lets look at the first example:</p><pre class="crayon-plain-tag">/* Larger Monitors / Resolutions */
@media screen and (min-width: 1300px) {

	#wrapper{
		width:1200px;
	}  

}</pre><p>This piece of code will only apply to those using a higher resolution, and that&#8217;s how media queries work &#8211; they make it possible to check a certain condition and then run a specific piece of code based on the result. In this case, the code is applied when the browser is at least 1300px wide.</p>
<p>You may have noticed it is only a very simply change, the width is simply increased on the wrapper DIV. When there is less screen space available it becomes necessary to sometimes make further changes. An example of this is provided below.</p><pre class="crayon-plain-tag">/* iPhone - Potrait */
@media screen and (max-width: 330px) {

	body{
		font-size:90%;
	}     

	#wrapper{
		background:#fff;
		border:1px #ddd solid;
		width:290px;
		margin:0 auto;
	}  

	#content {
		width:98%;
	}

	#sidebar {
		width:98%;
	}

}</pre><p>The rule above is applied to the website when the browser has a width of up to 330px. At such a dimension horizontal space is obviously minimal and should be used wisely. For this reason it seems wise to remove, or at least move the sidebar.</p>
<p>As the content and sidebar containers are floated to the left, all we need to do is alter the width so that there is not enough space for them to sit side-by-side. By doing this, the sidebar will move below the content. In this example both the content and sidebar DIVs are set to span the entire available width of their parents, minus the space needed for padding.</p>
<p>Full stylesheet for reference:<br />
<pre class="crayon-plain-tag">body{
	font-family:&quot;Myriad Pro&quot;, &quot;Tahoma&quot;;
	font-size:100%;
	color:#444;
}     

/* Content elements */
p{
	margin:18px 0;
	font-size:1em;
}
h1 {
	font-size:1.5em;
}
h2{
	font-size:1.2em;
	margin-top:20px;
}
/* Site structure */
#wrapper{
	background:#fff;
	border:1px #ddd solid;
	width:960px;
	margin:0 auto;
}  

header {
	padding:1%;
}
#content {
	float:left;
	width:72%;
	padding:1%;
}

#sidebar {
	float:left;
	width:24%;
	padding:1%;
	background: #e4f1f4;
}

footer {
	padding:1%;
	width:98%;
	clear:both;
	background:#efefef;
	text-align:center;
}

/* Fixes */
.clearfix:after {
	content: &quot;.&quot;;
	display: block;
	clear: both;
	visibility: hidden;
	line-height: 0;
	height: 0;
}

/* Responsive Code */

/* Larger Monitors / Resolutions */
@media screen and (min-width: 1300px) {

	#wrapper{
		width:1200px;
	}  

} 

/* iPad - Potrait */
@media screen and (max-width: 768px) {

	body{
		font-size:90%;
	}     

	#wrapper{
		background:#fff;
		border:1px #ddd solid;
		width:728px;
		margin:0 auto;
	}  

} 

/*--------------------Smart phones--------------------*/

/* iPhone - Landscape */
@media screen and (max-width: 480px) {

	#wrapper{
		background:#fff;
		border:1px #ddd solid;
		width:450px;
		margin:0 auto;
	}  

	#content {
		width:98%;
	}

	#sidebar {
		width:98%;
	}

} 

/* iPhone - Potrait */
@media screen and (max-width: 330px) {

	body{
		font-size:90%;
	}     

	#wrapper{
		background:#fff;
		border:1px #ddd solid;
		width:290px;
		margin:0 auto;
	}  

	#content {
		width:98%;
	}

	#sidebar {
		width:98%;
	}

} 

/*--------------------End Smart phones--------------------*/</pre><br />
For some commonly used media-query widths, check out <a title="media queries" href="http://www.smipple.net/snippet/joost.kiens/Common%20@media%20queries">smipple.net</a>.
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2012/01/getting-started-with-responsive-web-design/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2012/01/getting-started-with-responsive-web-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What to look for in a wordpress theme</title>
		<link>http://weebtutorials.com/2011/12/what-to-look-for-in-a-wordpress-theme/</link>
		<comments>http://weebtutorials.com/2011/12/what-to-look-for-in-a-wordpress-theme/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 20:11:25 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=563</guid>
		<description><![CDATA[<p>If you are thinking about creating, or buying,  a wordpress theme you are looking at the right post. I&#8217;m currently in the process of creating a new wordpress theme for my portfolio site, and this got me thinking about what i can do to make the theme as useful as possible. The following page describes a number of things that separates a good wordpress theme from a bad one. The below items are listed in no particular order. Multiple page templates What are they? Page templates define how information is displayed on your wordpress site, and what&#8217;s quite useful about them is that you can set a different template for each and every page. This gives you the ability to control and configure your pages without writing a single piece of code (if you have the right theme anyway). Page templates are made up of HTML, CSS and Javascript. Basically the same as a normal website page, but modified to be compatible with wordpress. Finally, remember that all wordpress pages are based on page templates. This includes blog posts, normal pages, archive pages and the home page. Why is it important? Simply put, the more page templates a theme has the more control you have over your site. For example, a theme that comes only with a single default layout &#8211; say a right-hand column for your content with a sidebar to the left, doesn&#8217;t leave much room for configuration. What if you needed the full page width for content and had no need for a sidebar? An example of a theme with different page templates, you can see how it could be useful: Left sidebar Full width with banner Documentation What is it? Well this one is pretty obvious, but the a wordpress theme should come with documentation detailing how to configure and use the theme. This is for the benefit of the end user. Why is it important? Whether you are looking to buy a wordpress theme, or create one, you should pay some attention to the idea of documentation. Let&#8217;s face it, a wordpress theme is going to consist of, and contain, various different functions / functionalities. Although configuring the majority of these may seem straight-forward it is not always the case. This is especially important for those who are considering buying a wordpress theme, without documentation you may end up hiring a web developer just to install the theme. So, what type of things should the documentation contain? Below are some common entities and suggestions. How to configure common elements &#8211; such as header image, feedburner link etc. Description of widget areas and how to add content to these. How to use theme options page ( if the theme has one) e.g. include social links, alter sidebar or footer etc. How to configure any slideshows or other functionality built into the theme. Description of page templates included and examples of what they may be used for. I think you can get the idea from that list, the documentation should really provide the end user with everything they need to install and configure the theme. Short-codes What are they? Short-codes allow the end user to add complex elements to a page or post, without actually writing the code themselves. They can be used to add buttons, columns, and even slideshows to a page. A really simple example of how they work is below. Lets say you want to add a blue background to a paragraph to make it stand out, you would need the following: [codesyntax lang="html4strict"] [/codesyntax] And the CSS: [codesyntax lang="css"] [/codesyntax] However, if the developer had implemented a shortcode to do this as part of the theme, it would be as simple as the example below: [highlight] This is a highlighted element [/highlight] Obviously, this is a really simple example used to illustrate the idea. However, you should now understand how useful shortcodes can be. Why is it important? Well, as mentioned earlier, they give more power to the end user. By providing the ability to add buttons, highlights, columns and other elements to the page the user has more control. However, it is worth mentioning that short-codes do have there down-side and should be used cautiously. Imagine if you wanted to change theme after adding short-codes to all your pages, unless the new theme supported the short-codes they simply wouldn&#8217;t work. Theme options page What is it? A theme options page is usually used to provide the user with some control over the look and feel of their theme, as well as some of the functions. Through use of a simple interface users are able to alter such things as the color scheme, location of objects, logo images, icons etc. Of course this is just the tip of the iceberg. Why is it important? Well, this is pretty obvious. The better the theme options page is, the more you can do with your theme. With a good options page you can modify aspects of your theme that would normally require technical knowledge, i.e changing the color scheme or the number of columns a page may have. Support What is it? Some theme authors will offer post purchase support with their wordpress themes, it is always worth checking that a theme comes with support before purchase. Why? Well, there is a good chance that after buying the theme you will run into one, or more problems. Of course, most common problems will be covered in the documentation, but on the off chance that you run into an unusual problem it is wise to purchase a theme with support. Why is it important? Simple, without support you will need to pay a Web developer to fix any bugs the theme may have. Unless, of course, you can fix the bug yourself. Browser compatibility What is it? A browser compatible theme is a theme which works across multiple browsers. The more browsers it works on, the bigger its potential user base. When creating, or purchasing a [...]</p>
 ]]></description>
			<content:encoded><![CDATA[<p>If you are thinking about <strong>creating, or buying,  a wordpress theme</strong> you are looking at the right post. I&#8217;m currently in the process of creating a new <strong>wordpress theme</strong> for my <strong></strong>portfolio site, and this got me thinking about what i can do to make the theme as useful as possible.</p>
<p>The following page describes a number of things that separates a good wordpress theme from a bad one. The below items are listed in no particular order.</p>
<h2>Multiple page te<strong><a href="http://weebtutorials.com/wp-content/uploads/2011/10/page.png"><img class="alignleft size-full wp-image-573" title="page" src="http://weebtutorials.com/wp-content/uploads/2011/10/page.png" alt="page" width="287" height="181" /></a></strong>mplates</h2>
<p><strong>What are they?</strong><strong></strong></p>
<p>Page templates define how information is displayed on your wordpress site, and what&#8217;s quite useful about them is that you can set a different template for each and every page. This gives you the ability to control and configure your pages without writing a single piece of code (<em>if you have the right theme</em> <em>anyway</em>). Page templates are made up of HTML, CSS and Jav<strong></strong>ascript. Basically the same as a normal website page, but modified to be compatible with wordpress.</p>
<p>Finally, remember that all wordpress pages are based on page templates. This includes blog posts, normal pages, archive pages and the home page.</p>
<p><span id="more-563"></span></p>
<p><strong>Why is it important?</strong></p>
<p>Simply put, the more page templates a theme has the more control you have over your site. For example, a theme that comes only with a single default layout &#8211; say a right-hand column for your content with a sidebar to the left, doesn&#8217;t leave much room for configuration. What if you needed the full page width for content and had no need for a sidebar?</p>
<p>An example of a theme with different page templates, you can see how it could be useful:</p>
<p><a title="http://themeforest.net/item/salutation-wordpress-buddypress-theme/full_screen_preview/548199" href="http://themeforest.net/item/salutation-wordpress-buddypress-theme/full_screen_preview/548199">Left sidebar</a></p>
<p><a title="http://themeforest.net/item/salutation-wordpress-buddypress-theme/full_screen_preview/548199" href="http://themeforest.net/item/salutation-wordpress-buddypress-theme/full_screen_preview/548199">Full width with banner</a></p>
<h2>Documentation<strong><a href="http://weebtutorials.com/wp-content/uploads/2011/10/documentation.jpg"><img class="alignleft size-full wp-image-580" title="Theme documentation" src="http://weebtutorials.com/wp-content/uploads/2011/10/documentation.jpg" alt="Theme documentation" width="287" height="181" /></a></strong></h2>
<p><strong>What is it?</strong></p>
<p>Well this one is pretty obvious, but the a wordpress theme should come with documentation detailing how to configure and use the theme. This is for the benefit of the end user.</p>
<p><strong>Why is it important?</strong></p>
<p>Whether you are looking to buy a wordpress theme, or create one, you should pay some attention to the idea of documentation. Let&#8217;s face it, a wordpress theme is going to consist of, and contain, various different functions / functionalities. Although configuring the majority of these may seem straight-forward it is not always the case. This is especially important for those who are considering buying a wordpress theme, without documentation you may end up hiring a web developer just to install the theme.</p>
<p>So, what type of things should the documentation contain? Below are some common entities and suggestions.</p>
<ul>
<li>How to configure common elements &#8211; such as header image, feedburner link etc.</li>
<li>Description of widget areas and how to add content to these.</li>
<li>How to use theme options page ( if the theme has one) e.g. include social links, alter sidebar or footer etc.</li>
<li>How to configure any slideshows or other functionality built into the theme.</li>
<li>Description of page templates included and examples of what they may be used for.</li>
</ul>
<p>I think you can get the idea from that list, the documentation should really provide the end user with everything they need to install and configure the theme.</p>
<h2><a href="http://weebtutorials.com/wp-content/uploads/2011/10/shortcode.png"><img class="alignleft size-full wp-image-587" title="shortcode" src="http://weebtutorials.com/wp-content/uploads/2011/10/shortcode.png" alt="shortcode" width="287" height="181" /></a>Short-codes</h2>
<p><strong>What are they?</strong></p>
<p>Short-codes allow the end user to add complex elements to a page or post, without actually writing the code themselves.</p>
<p>They can be used to add buttons, columns, and even slideshows to a page. A really simple example of how they work is below.</p>
<p>Lets say you want to add a blue background to a paragraph to make it stand out, you would need the following:</p>
<p>[codesyntax lang="html4strict"]</p><pre class="crayon-plain-tag">&amp;lt;div id=&quot;highlight&quot;&amp;gt; This is highlighted using CSS &amp;lt;/div&amp;gt;</pre><p>[/codesyntax]</p>
<p>And the CSS:</p>
<p>[codesyntax lang="css"]</p><pre class="crayon-plain-tag">#highlight {
background:blue;
}</pre><p>[/codesyntax]</p>
<p>However, if the developer had implemented a shortcode to do this as part of the theme, it would be as simple as the example below:</p>
<p><strong>[highlight] This is a highlighted element [/highlight]</strong></p>
<p>Obviously, this is a really simple example used to illustrate the idea. However, you should now understand how useful shortcodes can be.</p>
<p><strong>Why is it important?</strong></p>
<p>Well, as mentioned earlier, they give more power to the end user. By providing the ability to add buttons, highlights, columns and other elements to the page <strong></strong>the user has more control.</p>
<p>However, it is worth mentioning that short-codes do have there down-side and should be used cautiously. Imagine if you wanted to change theme after adding short-codes to all your pages, unless the new theme supported the short-codes they simply wouldn&#8217;t work.</p>
<h2><a href="http://weebtutorials.com/wp-content/uploads/2011/12/themeOptions.png"><img class="alignleft size-full wp-image-597" title="themeOptions" src="http://weebtutorials.com/wp-content/uploads/2011/12/themeOptions.png" alt="themeOptions" width="287" height="181" /></a>Theme options page</h2>
<p><strong>What is it?</strong><strong></strong></p>
<p>A theme options page is usually used to provide the user with some control over the look and feel of their theme, as well as some of the functions. Through use of a simple interface users are able to alter such things as the color scheme, location of objects, logo images, icons etc. Of course this is just the tip of the iceberg.</p>
<p><strong>Why is it important?</strong></p>
<p>Well, this is pretty obvious. The better the theme options page is, the more you can do with your theme. With a good options page you can modify aspects of your theme that would normally require technical knowledge, i.e changing the color scheme or the number of columns a page may have.</p>
<h2>Support</h2>
<p><strong>What is it?</strong></p>
<p>Some theme authors will offer post purchase support with their wordpress themes, it is always worth checking that a theme comes with support before purchase. Why? Well, there is a good chance that after buying the theme you will run into one, or more problems. Of course, most common problems will be covered in the documentation, but on the off chance that you run into an unusual problem it is wise to purchase a theme with support.</p>
<p><strong>Why is it important?</strong></p>
<p>Simple, without support you will need to pay a Web developer to fix any bugs the theme may have. Unless, of course, you can fix the bug yourself.</p>
<h2>Browser compatibility</h2>
<p><strong>What is it?</strong></p>
<p>A browser compatible theme is a theme which works across multiple browsers. The more browsers it works on, the bigger its potential user base. When creating, or purchasing a theme this is definitelysomething you should be considering. Most theme stores clearly display which browsers a particular theme is compatible with &#8211; a good selection of browsers would usually be IE7+, FF3.6+, Safari, Chrome and Opera. These are the most popular browsers.</p>
<p><strong>Why is it important?</strong></p>
<p>Internet users today surf the web using a range of web browsers, each of these have their own problems, quirks and bugs. If a theme has not been coded in a browser compatible manner, then it simply may not work for a portion of your user base.  The future of the web seems to be mobile, so it is probably worth checking that a theme is mobile compatible also. There are plug-ins that help with this, such as WP-Touch.</p>
<p>Thanks for reading, if you think anything needs adding to the list let me know in the comments section below.
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/12/what-to-look-for-in-a-wordpress-theme/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/12/what-to-look-for-in-a-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Style a spacious grey form using CSS3</title>
		<link>http://weebtutorials.com/2011/10/style-a-spacious-grey-form-using-css3/</link>
		<comments>http://weebtutorials.com/2011/10/style-a-spacious-grey-form-using-css3/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 10:32:12 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Forms]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=541</guid>
		<description><![CDATA[<p>This tutorial will show you how to create a stylish grey form using CSS and a couple of simple images. It wont take long to complete and beginners with a basic understanding of CSS should be able to follow. To add some effects, such as rounded corners, or drop-shadows, CSS3 will be utilised. These means that the form styling will only work properly in modern browsers. A couple of external sources were used to produce the images,  a link to these will be included -  so you will also learn of a couple of valuable source sites too. Demo Download Step 1 &#8211; Download images for the form. Before starting you will need to download a couple of images, you can grab these below. One image is for the form background, the other is the icon found on the right-hand side of the form. Link: http://weebtutorials.com/wp-content/uploads/2011/10/formimages.zip Background pattern source: http://subtlepatterns.com/ Icon Source: http://www.shapes4free.com/ Step 2 &#8211; The HTML. As the purpose of this tutorial is to discuss the stylnig of a form, rather than the full creation i wont go over the HTML in much detail. However, you can still find the code below. &#160; As you can see the HTML pretty much consists of a few paragraph elements, each one containing either a text input, a textarea or a submit button. Its pretty simple code, but if you are unfamiliar with this stuff take a look at the W3C forms page. Step 2a &#8211; Add google fonts link to HTML head section. The form will be utilising some custom fonts via the google fonts API. All you need to do is add the following code to the HEAD section of the HTML document. You can then refer to the fonts in the CSS file. Find out more about google fonts. Step 3 &#8211; Styling the HTML form using CSS. Style the form: Changing the display property to &#8216;inline-block&#8217; means the form will be a block element, but will expand to fit the elements inside of it, rather than span the full width of its parent container. Notice the padding property, the third value is 0px. This means the bottom of the form has 0px has padding, the reason this has been done is that the paragraph elements will have 30px padding on the bottom so the form itself doesnt actually need it. The position property is set to relative. This allows us to position any child element as absolute, giving us full control over its location. Box-shadow property accepts 4 vlaues. These are, in order, horizontal offset,  vertical offset, blur radius and color. Style the header section: As mentioned earlier, the paragraph elements will have 30px padding added to the bottom. The same goes for the header element, this keeps the spacing consistent. Change the font-family value to use the custom &#8216;Rochester&#8217; font supplied by the google fonts API. Using the contactIMG class the image added to the HTML can be positioned. An element which uses absolute positioning, is positioned relative to the first parent container which is positioned as relative. In this case the image should be move to the top right hand side. This is done by using the top, and right properties. [codesyntax lang="css"] [/codesyntax] Style the paragraph and input elements: Nothing much to explain on the &#8216;P&#8217; element. The font has been changed, padding added etc. The form inputs, and the text area have had their display property changed to block. This is used to push the elements on to a new line, below the text contained within the paragraph. Everything else on there is pretty straightfoward, or has already been explained. [codesyntax lang="css"] [/codesyntax] Style the submit button. Now, you&#8217;re probably about to look at the code below and pass out. Don&#8217;t worry though the code was created by using a CSS3 generator. The first section, which is wrapped within a comment ( taken from colorzilla) was taken from the following site: http://www.colorzilla.com/gradient-editor/ Its a CSS3 gradient generator which produces the necessary code for all modern browsers. Highly recommended. Following on from that is some pretty basic CSS, a border has been added and rounded corners have been implemented using border-radius. Just below that an inner shadow is added by using the box shadow property. The code for adding an inner shadow is exactly the same as for an outer shadow, the only difference being the word &#8216;inset&#8217; is added. The text shadow was again implemented using a CSS3 generator. I can never remember the code for IE(filter property) so normally just use a generator. You can find a link to the one i used below. CSS3 Generator Notice the width of the submit button is 452px, where as the other inputs are 430px. This is because the submit button does  not have 10px of padding at either side, unlike the input elements. The extra 2px accounts for the box shadow added to the inputs. The final section of the code is used to implement a hover effect to the button. Again the colorzilla generator was used. The cursoer property simply changes the mouse cursor when the button is hovered. [codesyntax lang="css"] [/codesyntax] Hope you enjoyed the tutorial, and thanks for reading. &#160;</p>
 ]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to create a <strong>stylish grey form</strong> using CSS and a couple of simple images. It wont take long to complete and beginners with a basic understanding of CSS should be able to follow.</p>
<p>To add some effects, such as rounded corners, or drop-shadows, CSS3 will be utilised. These means that the form styling will only work properly in modern browsers.</p>
<p>A couple of external sources were used to produce the images,  a link to these will be included -  so you will also learn of a couple of valuable source sites too.</p>
<div class="postButtonWrap"><a class="postFeatureButton" title="CSS3 Dropdown menu" href="http://weebtutorials.com/examples/spaciousForm/a.html">Demo</a> <a class="postFeatureButton" title="CSS3 dropdown menu" href="http://weebtutorials.com/wp-content/uploads/2011/10/spaciousForm.zip">Download</a></div>
<h2><span id="more-541"></span>Step 1 &#8211; Download images for the form.</h2>
<p>Before starting you will need to download a couple of images, you can grab these below. One image is for the form background, the other is the icon found on the right-hand side of the form.</p>
<p><strong>Link:</strong></p>
<p><a title="Form images" href="http://weebtutorials.com/wp-content/uploads/2011/10/formimages.zip">http://weebtutorials.com/wp-content/uploads/2011/10/formimages.zip</a></p>
<blockquote><p>Background pattern source:</p>
<p><a title="http://subtlepatterns.com/" href="http://subtlepatterns.com/">http://subtlepatterns.com/</a></p>
<p>Icon Source:</p>
<p><a title="http://www.shapes4free.com/" href="http://www.shapes4free.com/">http://www.shapes4free.com/</a></p></blockquote>
<h2>Step 2 &#8211; The HTML.</h2>
<p>As the purpose of this tutorial is to discuss the stylnig of a form, rather than the full creation i wont go over the HTML in much detail. However, you can still find the code below.</p><pre class="crayon-plain-tag">&amp;lt;form class=&quot;stylishForm1&quot; method=&quot;post&quot; action=&quot;script.php&quot;&amp;gt;
&amp;lt;h2&amp;gt; Contact us &amp;lt;/h2&amp;gt;
&amp;lt;img src=&quot;images/contactIcon.png&quot; alt=&quot;contact&quot; class=&quot;contactImg&quot;/&amp;gt;

&amp;lt;p&amp;gt; Your Email:
&amp;lt;input type=&quot;text&quot; name=&quot;userMail&quot; class=&quot;formInput&quot;/&amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt; Your Name:
&amp;lt;input type=&quot;text&quot; name=&quot;userName&quot; class=&quot;formInput&quot;/&amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt; Your Question :
&amp;lt;textarea rows=&quot;1&quot; cols=&quot;1&quot;&amp;gt;
&amp;lt;/textarea&amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;
&amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;formSubmit&quot;/&amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;/form&amp;gt;</pre><p>&nbsp;</p>
<p>As you can see the HTML pretty much consists of a few paragraph elements, each one containing either a text input, a textarea or a submit button. Its pretty simple code, but if you are unfamiliar with this stuff take a look at the <a title="w3schools" href="http://www.w3schools.com/html/html_forms.asp">W3C forms page</a>.</p>
<h2>Step 2a &#8211; Add google fonts link to HTML head section.</h2>
<p>The form will be utilising some custom fonts via the google fonts API. All you need to do is add the following code to the HEAD section of the HTML document. You can then refer to the fonts in the CSS file.</p>
<p><a title="google fonts" href="http://www.google.com/webfonts#ChoosePlace:select">Find out more about google fonts</a>.</p><pre class="crayon-plain-tag">&amp;lt;head&amp;gt;
&amp;lt;link href=&quot;sylishForm1.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;/&amp;gt;
&amp;lt;title&amp;gt; A Spacious CSS3 Form &amp;lt;/title&amp;gt;
&amp;lt;link href='http://fonts.googleapis.com/css?family=Open+Sans|Rochester' rel='stylesheet' type='text/css'&amp;gt;
&amp;lt;/head&amp;gt;</pre><p></p>
<h2>Step 3 &#8211; Styling the HTML form using CSS.</h2>
<p><strong>Style the form:</strong></p>
<p>Changing the display property to &#8216;inline-block&#8217; means the form will be a block element, but will expand to fit the elements inside of it, rather than span the full width of its parent container.</p>
<p>Notice the padding property, the third value is 0px. This means the bottom of the form has 0px has padding, the reason this has been done is that the paragraph elements will have 30px padding on the bottom so the form itself doesnt actually need it.</p>
<p>The position property is set to relative. This allows us to position any child element as absolute, giving us full control over its location.</p>
<p>Box-shadow property accepts 4 vlaues. These are, in order, horizontal offset,  vertical offset, blur radius and color.</p><pre class="crayon-plain-tag">.stylishForm1 {
border:thin solid #eaeaea;
display:inline-block;
padding:30px 30px 0px 30px;
-moz-box-shadow: 2px 2px 3px #f2f2f2;
-webkit-box-shadow:  2px 2px 3px #f2f2f2;
box-shadow: 2px 2px 3px #f2f2f2;
background:url(images/background.jpg);
position:relative;
}</pre><p><strong>Style the header section:</strong></p>
<p>As mentioned earlier, the paragraph elements will have 30px padding added to the bottom. The same goes for the header element, this keeps the spacing consistent.</p>
<p>Change the font-family value to use the custom &#8216;Rochester&#8217; font supplied by the google fonts API.</p>
<p>Using the contactIMG class the image added to the HTML can be positioned. An element which uses absolute positioning, is positioned relative to the first parent container which is positioned as relative. In this case the image should be move to the top right hand side. This is done by using the top, and right properties.</p>
<p>[codesyntax lang="css"]</p><pre class="crayon-plain-tag">.stylishForm1 h2{
margin:0;
margin-bottom:30px;
font-family: 'Rochester', cursive;
font-size:30px;
color:#494949;
}
.contactImg {
position:absolute;
right:30px;
top:35px;
}</pre><p>[/codesyntax]</p>
<p><strong>Style the paragraph and input elements:</strong></p>
<p>Nothing much to explain on the &#8216;P&#8217; element. The font has been changed, padding added etc.</p>
<p>The form inputs, and the text area have had their display property changed to block. This is used to push the elements on to a new line, below the text contained within the paragraph. Everything else on there is pretty straightfoward, or has already been explained.</p>
<p><strong></strong>[codesyntax lang="css"]</p><pre class="crayon-plain-tag">.stylishForm1 p{
margin:0;
margin-bottom:30px;
font-family: 'Open Sans', sans-serif;
color:#7a7a7a;
font-size:15px;
}
.stylishForm1 input, .stylishForm1 textarea{
display:block;
margin-top:10px;
width:430px;
padding:10px;
-moz-box-shadow: 2px 2px 3px #e3e3e3;
-webkit-box-shadow: 2px 2px 3px #e3e3e3;
box-shadow: 2px 2px 3px #e3e3e3;
border:1px solid #e9e9e9;
}
.stylishForm1 textarea{
height:130px;
}</pre><p>[/codesyntax]</p>
<p><strong>Style the submit button.</strong><br />
Now, you&#8217;re probably about to look at the code below and pass out. Don&#8217;t worry though the code was created by using a CSS3 generator. The first section, which is wrapped within a comment ( taken from colorzilla) was taken from the following site:</p>
<p><a title="http://www.colorzilla.com" href="http://www.colorzilla.com/gradient-editor/">http://www.colorzilla.com/gradient-editor/</a></p>
<p>Its a CSS3 gradient generator which produces the necessary code for all modern browsers. Highly recommended.</p>
<p>Following on from that is some pretty basic CSS, a border has been added and rounded corners have been implemented using border-radius. Just below that an inner shadow is added by using the box shadow property. The code for adding an inner shadow is exactly the same as for an outer shadow, the only difference being the word &#8216;inset&#8217; is added.</p>
<p>The text shadow was again implemented using a CSS3 generator. I can never remember the code for IE(filter property) so normally just use a generator. You can find a link to the one i used below.</p>
<p><a title="http://css3generator.com/" href="http://css3generator.com/">CSS3 Generator</a></p>
<p>Notice the width of the submit button is 452px, where as the other inputs are 430px. This is because the submit button does  not have 10px of padding at either side, unlike the input elements. The extra 2px accounts for the box shadow added to the inputs.</p>
<p>The final section of the code is used to implement a hover effect to the button. Again the colorzilla generator was used. The cursoer property simply changes the mouse cursor when the button is hovered.</p>
<p>[codesyntax lang="css"]</p><pre class="crayon-plain-tag">.stylishForm1 .formSubmit{
/*Taken from http://www.colorzilla.com/gradient-editor CSS3 Generator*/
background: #7db8e2; /* Old browsers */
background: -moz-linear-gradient(top, #7db8e2 0%, #75aed6 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7db8e2), color-stop(100%,#75aed6)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #7db8e2 0%,#75aed6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #7db8e2 0%,#75aed6 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #7db8e2 0%,#75aed6 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7db8e2', endColorstr='#75aed6',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #7db8e2 0%,#75aed6 100%); /* W3C */
/*End Taken from CSS3 Generator*/

border-radius:8px;
-moz-border-radius:8px;
-webkit-border-radius:8px;
border:1px solid #75aed6;

box-shadow:inset 0px 0px 2px #dcebf1;
-webkit-box-shadow: inset 0px 0px 2px #dcebf1;
-moz-box-shadow: inset 0px 0px 2px #dcebf1;

/*Taken from http://css3generator.com/ */
text-shadow: -1px -1px 0px #5f90b0;
filter: dropshadow(color=#5f90b0, offx=-1, offy=-1);
/*End Taken from CSS3 Generator*/

color:#fff;
font-family: 'Open Sans', sans-serif;
text-transform:uppercase;
font-size:16px;
width:452px;
}

.stylishForm1 .formSubmit:hover {
/*Taken from http://www.colorzilla.com/gradient-editor CSS3 Generator*/
background: #80bde5; /* Old browsers */
background: -moz-linear-gradient(top, #80bde5 0%, #78b3db 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#80bde5), color-stop(100%,#78b3db)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #80bde5 0%,#78b3db 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #80bde5 0%,#78b3db 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #80bde5 0%,#78b3db 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80bde5', endColorstr='#78b3db',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #80bde5 0%,#78b3db 100%); /* W3C */
/*End Taken from CSS3 Generator*/

cursor:pointer;
}</pre><p>[/codesyntax]</p>
<p>Hope you enjoyed the tutorial, and thanks for reading.</p>
<p>&nbsp;
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/10/style-a-spacious-grey-form-using-css3/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/10/style-a-spacious-grey-form-using-css3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beginner javascript: How to use arrays and functions. Includes task.</title>
		<link>http://weebtutorials.com/2011/09/beginner-javascript-how-to-use-arrays-and-functions-includes-task/</link>
		<comments>http://weebtutorials.com/2011/09/beginner-javascript-how-to-use-arrays-and-functions-includes-task/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 19:31:24 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=507</guid>
		<description><![CDATA[<p>This tutorial is aimed at beginners who are just starting to learn Javascript or any other programming language. The tutorial will consist of a couple of paragraphs explaining what a function is, what an array is and show an example of how they can be used. There will also be a small programming task near the end to help you improve your skills, so make sure you read carefully! Lets get started. Part 1: What is an array As a programmer you will need to use arrays regularly. They are similar to variables in that they are used to store a value of some description. However, unlike a variable an array can hold multiple values. And they do so in a structured format. Each value within an array is referred to as an array element and has an index, or ID,  number associated with it. You can access these individual values by using the index assigned to them. As a final note, remember that the indexing is zero-based, meaning that the index starts at 0 rather than 1. Below is some simple code which shows how to create an array, then assign some values to it. An example of how you could use this data: Part 2: What is a function In programming terms a function is a named piece of code which performs a specific task, such as multiplying a number or many other calculations.  The code contained within a function will only run when called, or when triggered by an event. You can pass values (known as parameters, or arguments)  into functions, which can then be used to carry out calculations before being returned. It&#8217;s a simple concept to understand, and i dont believe it requires any more explanation. How to create a function in javascript: And a function that accepts parameters: Part 3: Programming task Create a function called &#8216;dayName&#8217; that accepts a number and returns the day of the week based on that number. Details are below Day 1 &#8211; Monday, Day 2 &#8211; Tuesday, Day 3- Wednesday and so on. The function should first of all create an array. For the purpose of this tutorial you should then store the day names in this array. Use the alert function to display the result once complete. It&#8217;s a pretty simple problem, but it should help you remember what you have learned. If you like the format of this tutorial please leave a comment and i will consider writing more like this. The solution is hidden below and can be expanded when you are ready</p>
 ]]></description>
			<content:encoded><![CDATA[<p>This tutorial is aimed at <strong>beginners</strong> who are just starting to<strong> learn Javascript</strong> or any other programming language. The tutorial will consist of a couple of paragraphs explaining what a function is, what an array is and show an example of how they can be used.</p>
<p>There will also be a s<strong>mall programming task</strong> near the end to help you improve your skills, so make sure you read carefully! Lets get started.</p>
<h2>Part 1: What is an array</h2>
<p>As a programmer you will need to use arrays regularly. They are similar to variables in that they are used to store a value of some description. However, unlike a variable an array can hold multiple values. And they do so in a structured format.</p>
<p>Each value within an array is referred to as an array element and has an index, or ID,  number associated with it. You can access these individual values by using the index assigned to them. As a final note, remember that the indexing is zero-based, meaning that the index starts at 0 rather than 1.</p>
<p><span id="more-507"></span>Below is some simple code which shows how to create an array, then assign some values to it.</p><pre class="crayon-plain-tag">var classMates=new Array();

classMates[0]=&quot;Dave&quot;;
classMates[1]=&quot;Sam&quot;;
classMates[2]=&quot;John&quot;;
classMates[3]=&quot;Kate&quot;;</pre><p>An example of how you could use this data:</p><pre class="crayon-plain-tag">alert(classMates[3]);</pre><p></p>
<h2>Part 2: What is a function</h2>
<p>In programming terms a function is a named piece of code which performs a specific task, such as multiplying a number or many other calculations.  The code contained within a function will only run when called, or when triggered by an event. You can pass values (known as parameters, or arguments)  into functions, which can then be used to carry out calculations before being returned.</p>
<p>It&#8217;s a simple concept to understand, and i dont believe it requires any more explanation.</p>
<p>How to create a function in javascript:</p><pre class="crayon-plain-tag">function alertMsg()
{
alert(&quot;Hello&quot;);
}</pre><p>And a function that accepts parameters:</p><pre class="crayon-plain-tag">function multiply(a,b)
{
return a*b;
}

alert(multiply(5,10));</pre><p></p>
<h2>Part 3: Programming task</h2>
<p>Create a function called &#8216;dayName&#8217; that accepts a number and returns the day of the week based on that number. Details are below</p>
<ol>
<li><strong>Day 1</strong> &#8211; Monday, <strong>Day 2</strong> &#8211; Tuesday, <strong>Day 3</strong>- Wednesday and so on.</li>
<li>The function should first of all create an array.</li>
<li>For the purpose of this tutorial you should then store the day names in this array.</li>
<li>Use the alert function to display the result once complete.</li>
</ol>
<p>It&#8217;s a pretty simple problem, but it should help you remember what you have learned. If you like the format of this tutorial please leave a comment and i will consider writing more like this.</p>
<p><strong><em>The solution is hidden below and can be expanded when you are ready</em></strong></p>
<ul class='gdl-toggle-box'>
<li>
<h2 class='toggle-box-head title-color gdl-title'><span class='toggle-box-head-image'></span>Solution</h2>
<div class='toggle-box-content'>
<pre class="crayon-plain-tag">function dayName(day)
{
var daynames=new Array(); 

daynames[1]=&quot;Monday&quot;;
daynames[2]=&quot;Tuesday&quot;;
daynames[3]=&quot;Wednesday&quot;;
daynames[4]=&quot;Thursday&quot;;
daynames[5]=&quot;Friday&quot;;
daynames[6]=&quot;Saturday&quot;;
daynames[7]=&quot;Sunday&quot;;

return daynames[day];
}

alert(dayName(3));</pre>
</div>
</li>
</ul>
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/09/beginner-javascript-how-to-use-arrays-and-functions-includes-task/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/09/beginner-javascript-how-to-use-arrays-and-functions-includes-task/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Free wordpress portfolio theme</title>
		<link>http://weebtutorials.com/2011/09/free-wordpress-portfolio-theme/</link>
		<comments>http://weebtutorials.com/2011/09/free-wordpress-portfolio-theme/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 08:20:05 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=501</guid>
		<description><![CDATA[<p>I was recently hired by a newly launched company to create a wordpress portfolio theme. The hiring company was Tech-Sect Web solutions, who offer services such as CMS development, PSD to xHTML, Logo design and more! If your looking for a website consider checking them out&#8230; Quick preview: Get the free wordpress theme. Anyway, the theme is given away totally free on their website. You can find a link below. http://www.tech-sect.com/wordpress-themes &#8211; Link temporarily disabled as tech-sect site was hacked Theme features W3C Compliant Easily configurable front page Portfolio page. Blog page. Browser compatible (IE7+, FF3+, Opera 10+) Multiple widget areas Drop-down CSS navigation jQuery slideshow on front page. Theme preview: You can see a working example of the theme by following the link below: http://weebtutorials.com/testEnvironment/</p>
 ]]></description>
			<content:encoded><![CDATA[<p>I was recently hired by a newly launched company to create a wordpress portfolio theme. The hiring company was Tech-Sect Web solutions, who offer services such as CMS development, PSD to xHTML, Logo design and more! If your looking for a website consider checking them out&#8230;</p>
<p><strong>Quick preview:</strong></p>
<p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/tech-sect.jpg"><img class="size-medium wp-image-503 alignnone" title="tech-sect theme" src="http://weebtutorials.com/wp-content/uploads/2011/09/tech-sect-300x157.jpg" alt="tech-sect theme" width="300" height="157" /></a></p>
<h2>Get the free wordpress theme.</h2>
<p>Anyway, the theme is given away totally free on their website. You can find a link below.<span id="more-501"></span></p>
<p><a title="wordpress-themes" href="#">http://www.tech-sect.com/wordpress-themes &#8211; Link temporarily disabled as tech-sect site was hacked</a></p>
<h2>Theme features</h2>
<ol>
<li>W3C Compliant</li>
<li>Easily configurable front page</li>
<li>Portfolio page.</li>
<li>Blog page.</li>
<li>Browser compatible (IE7+, FF3+, Opera 10+)</li>
<li>Multiple widget areas</li>
<li>Drop-down CSS navigation</li>
<li>jQuery slideshow on front page.</li>
</ol>
<h2>Theme preview:</h2>
<p>You can see a working example of the theme by following the link below:</p>
<p><a title="Free theme preview" href="http://weebtutorials.com/testEnvironment/">http://weebtutorials.com/testEnvironment/</a>
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/09/free-wordpress-portfolio-theme/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/09/free-wordpress-portfolio-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to debug scripts in IE7</title>
		<link>http://weebtutorials.com/2011/09/how-to-debug-scripts-in-ie7/</link>
		<comments>http://weebtutorials.com/2011/09/how-to-debug-scripts-in-ie7/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 09:34:15 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=496</guid>
		<description><![CDATA[<p>So, i just finished up a project on which i had quite a few problems. The majority of which were IE7 script errors, total nightmare! I have never really had to debug in IE7 before so was unsure how to go about it. I usually use IETester for any compatibility tests, but the script was simply causing the program to crash. After realising i was going to need an alternative test environment i quickly ran to google! And thats where i found this: Micosoft VPC image Microsoft have a number of virtual PC&#8217;s available for download from the Windows Virtual PC VHD page. Each comes with a different version of IE installed and ready to use. After installing this and running the site however i realised it wasnt much use! I was simply receiving a generic &#8220;A script has caused an error on this page&#8221; message and then had to stop the script. This method of testing would be good for your basic HTML/CSS browser compatibility checks though! IE8 Browser mode After some more google bashing i found out about IE8 browser mode. This basically allows you to run IE8 as if it were IE7. Very handy for me, as i have IE8 installed on my windows 7 machine. To access browser mode simply open IE8 and press &#8216;F12&#8242;. At the top of the pop-up screen that opens you should now see &#8216;Browser mode: IE8&#8242;. Simply click this button and change to IE7 mode. Now, refresh the page and an errors should display in the console. Easy as that, all you have to do now is fix the actual problem! I&#8217;m not 100% sure, but i would think IE9 also has browser mode for those that dont have IE8 installed.</p>
 ]]></description>
			<content:encoded><![CDATA[<p>So, i just finished up a project on which i had quite a few problems. The majority of which were IE7 script errors, total nightmare! I have never really had to<strong> debug in IE7</strong> before so was unsure how to go about it.</p>
<p>I usually use IETester for any compatibility tests, but the script was simply causing the program to crash. After realising i was going to need an alternative test environment i quickly ran to google! And thats where i found this:</p>
<h2>Micosoft VPC image</h2>
<p>Microsoft have a number of virtual PC&#8217;s available for download from the <a href="http://www.microsoft.com/download/en/details.aspx?id=11575">Windows Virtual PC VHD</a> page. Each comes with a different version of IE installed and ready to use.</p>
<p>After installing this and running the site however i realised it wasnt much use! I was simply receiving a generic &#8220;A script has caused an error on this page&#8221; message and then had to stop the script. This method of testing would be good for your basic HTML/CSS browser compatibility checks though!</p>
<h2><span id="more-496"></span>IE8 Browser mode</h2>
<p>After some more google bashing i found out about IE8 browser mode. This basically allows you to run IE8 as if it were IE7. Very handy for me, as i have IE8 installed on my windows 7 machine.</p>
<p>To access browser mode simply open IE8 and press &#8216;F12&#8242;. At the top of the pop-up screen that opens you should now see &#8216;Browser mode: IE8&#8242;. Simply click this button and change to IE7 mode.</p>
<p>Now, refresh the page and an errors should display in the console. Easy as that, all you have to do now is fix the actual problem!</p>
<p>I&#8217;m not 100% sure, but i would think IE9 also has browser mode for those that dont have IE8 installed.
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/09/how-to-debug-scripts-in-ie7/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/09/how-to-debug-scripts-in-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross browser CSS3 drop-down navigation menu.</title>
		<link>http://weebtutorials.com/2011/09/cross-browser-css3-navigation-menu/</link>
		<comments>http://weebtutorials.com/2011/09/cross-browser-css3-navigation-menu/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 15:59:28 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Lists/Navigation]]></category>

		<guid isPermaLink="false">http://weebtutorials.com/?p=452</guid>
		<description><![CDATA[<p>This tutorial will show you how to create a browser compatible navigation menu using HTML and CSS3. The navigation will be built using our drop-down menu template. On that note i would like to mention that the primary purpose of this tutorial is to show how the template can and should be used. If you are looking for a tutorial showing each and every step of the drop-down process you may want to look elsewhere. The navigation menu has been testing in IE7+, Firefox 3.6+, Chrome, Opera and Safari. Demo Download Step 1 &#8211; Download required files for menu. Below are all the files required for this tutorial. 1a &#8211; The navigation template. First of all you will need our drop-down menu template, you can download the template below. Browser compatible drop-down navigation menu template. 1b &#8211; PIE.htc and required images. Just so you know, PIE.htc allows Internet explorer 6-8 render CSS3 properties. You should extract it to the same directory as your CSS file. The two images are simply background images, save them in a folder named &#8216;Images&#8217;. Use the link below to download these files. PIE.htc and required images. If you would like to know more about &#8216;PIE.htc&#8217;, go ahead and visit www.css3pie.com. There is some good information on there and its worth a look! 1c &#8211; Extract. Extract the navigation template files first of all. Then, as mentioned above, extract the pie.htc file into the same folder as your css file and extract the images into an &#8216;images&#8217; folder. Step 2 &#8211; Edit the CSS. Open the CSS file ready for editing. The first thing you will need to change is the background styling of the menu, this is applied to the &#8216;UL&#8217; element and has an ID of &#8216;#navMain&#8217;. Below is the current code, followed by the new code. We will use this format throughout the tutorial. Old code: New Code: Whats changed: First of all  the bottom-border has been removed and the color has been changed. Once we add a shadow we will no longer require a bottom border, and it can sometimes have a negative effect on the way the drop-down menu works &#8211; so for that reason i find it better to just remove it(in this case). Secondly we have changed the background to use the image provided, no explanation required there. Finally an inner glow has been added using the box-shadow property. By using the &#8216;inset&#8217; keyword the shadow will be added inside the element, rather than outside. Box shadow accepts 5 values, the following should give you a better idea of how the box-shadow property works: box-shadow: Horizontal offset, Vertical offset, Blur radius, Spread, colour. As a final note, the behaviour property allows us to attach a script to a CSS selector. You can read more about it at www.css3.com. Step 2.1 &#8211; CSS: Container The next step is to add an outer shadow, you will need to add this to the wrapper &#8216;DIV&#8217;(#container) since you have already added a shadow to the &#8216;UL&#8217; element. Old Code: New Code: Whats changed: Nothing much, a subtle border has been added to the bottom and left hand sides of the menu. Step 2.2 &#8211; CSS: List items The list items are to be updated next. The current item class will have a different background, borders will be added, text color changed etc. Old code: New code: Whats changed: First of all, two borders have been added. One to the list item(light), and one to the anchor(dark). This gives a nice, realistic lighting effect and fits perfectly on a navigation menu such as this. The text has an embossed effect which is added using the text-shadow property. The code for this property is similar to that of the box-shadow property, a brief explanation can be found below. box-shadow: Horizontal offset, Vertical offset, Blur radius, color. Some other minor changes have been made, such as increasing the padding both vertically and horizontally. Also, the font size has been notched up a little and the color has been changed. Finally, the background of the current list item has been changed to use the image which you should have downloaded earlier. Step 2.3 &#8211; CSS: Drop-down menu The following changes will be pretty much finish the navigation menu off. The styling of the dropdown menu will be changed and the positioning will need adjusting slightly. Old code: New code: Whats changed: The majority of the changes are purely cosmetic. The background color has changed, along with the font and borders. The most important changes though are to the positioning. Using the &#8216;top&#8217; property the dropdown list has been properly positioned to meet the increased padding of the menu. You may also have noticed the the &#8216;.gecko&#8217; and &#8216;.ff3_6&#8242; rules have been removed. These are browser specific rules for the old navigation menu and are no longer required. Step 3 &#8211; Finish up! The navigation menu should be pretty much complete now, you may notice that the hover colors are still off. The hover effect is handled by a jquery script, you can change these in your HTML document. Old code: New code: Whats changed: Simple hex color code change, no explanation required. Hopefully that was easy enough to follow and you now have a good idea how fast, and easy, it is to create a dropdown navigation menu using our template. Thanks for reading.</p>
 ]]></description>
			<content:encoded><![CDATA[<p>This tutorial will show you how to <strong>create a browser compatible navigation menu</strong> using <strong>HTML and CSS3</strong>. The navigation will be built using our <a title="Cross browser dropdown menu navigation template" href="http://weebtutorials.com/2011/09/cross-browser-drop-down-navigation-framework-template/">drop-down menu template</a>.</p>
<p>On that note i would like to mention that the primary purpose of this tutorial is to show how the template can and should be used. If you are looking for a tutorial showing each and every step of the drop-down process you may want to look elsewhere.</p>
<p>The navigation menu has been testing in IE7+, Firefox 3.6+, Chrome, Opera and Safari.</p>
<h2 class="postButtonWrap">Demo</h2>
<div class="postButtonWrap"><a href="http://weebtutorials.com/examples/cleanGreyNav/" class="gdl-button shortcode-medium-button" style="color:#fff; background-color:#6b6ba9; border-color:#6666a1; ">Demo</a></div>
<div class="postButtonWrap">
<h2>Download</h2>
</div>
<div class="postButtonWrap"><a href="http://weebtutorials.com/examples/cleanGreyNav/cleanGreyNav.zip" class="gdl-button shortcode-medium-button" style="color:#fff; background-color:#6b6ba9; border-color:#6666a1; ">Download</a></p>
</div>
<h2>Step 1 &#8211; Download required files for menu.</h2>
<p>Below are all the files required for this tutorial.</p>
<h3>1a &#8211; The navigation template.</h3>
<p>First of all you will need our drop-down menu template, you can download the template below.</p>
<p><a href="http://weebtutorials.com/2011/09/cross-browser-drop-down-navigation-framework-template/">Browser compatible drop-down navigation menu template.</a></p>
<h3><span id="more-452"></span>1b &#8211; PIE.htc and required images.</h3>
<p>Just so you know, PIE.htc <strong>allows Internet explorer 6-8 render CSS3 properties</strong>. You should extract it to the same directory as your CSS file. The two images are simply background images, save them in a folder named &#8216;Images&#8217;. Use the link below to download these files.</p>
<p><a href="http://weebtutorials.com/examples/cleanGreyNav/cleanGreyNavRequiredFiles.zip">PIE.htc and required images.</a></p>
<p><em>If you would like to know more about &#8216;PIE.htc&#8217;, go ahead and visit <a href="http://css3pie.com/">www.css3pie.com</a>. There is some good information on there and its worth a look!</em></p>
<h3>1c &#8211; Extract.</h3>
<p>Extract the navigation template files first of all. Then, as mentioned above, extract the pie.htc file into the same folder as your css file and extract the images into an &#8216;images&#8217; folder.</p>
<h2>Step 2 &#8211; Edit the CSS.</h2>
<p>Open the CSS file ready for editing. The first thing you will need to change is the background styling of the menu, this is applied to the &#8216;UL&#8217; element and has an ID of &#8216;#navMain&#8217;.</p>
<p>Below is the current code, followed by the new code. We will use this format throughout the tutorial.</p>
<p><strong>Old code:</strong></p><pre class="crayon-plain-tag">#navMain{
list-style:none;
font-family:tahoma;
font-size:12px;
border:1px #595959 solid;
float:left;
width:940px;
margin:0;
padding:0;
background:#f6f6f6;
}</pre><p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/oldnavcontainer.png"><img class="alignnone size-full wp-image-467" title="oldnavcontainer" src="http://weebtutorials.com/wp-content/uploads/2011/09/oldnavcontainer.png" alt="oldnavcontainer" width="439" height="59" /></a></p>
<p><strong>New Code:</strong></p><pre class="crayon-plain-tag">#navMain{
list-style:none;
font-family:tahoma;
font-size:12px;
border-top:1px #e8e7e7 solid;
border-left:1px #e8e7e7 solid;
border-right:1px #e8e7e7 solid;
float:left;
width:940px;
margin:0;
padding:0;
background:url(images/navBG.png) repeat-x #f2f1f1;
-webkit-box-shadow: inset 2px 2px 2px 2px #fafafa;
-moz-box-shadow: inset 2px 2px 2px 2px #fafafa;
box-shadow: inset 0px 0px 3px 2px #fafafa;
behavior: url(PIE.htc);
}</pre><p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/newnavcontainer1.png"><img class="alignnone size-full wp-image-468" title="newnavcontainer" src="http://weebtutorials.com/wp-content/uploads/2011/09/newnavcontainer1.png" alt="newnavcontainer" width="439" height="59" /></a></p>
<p><strong>Whats changed:</strong></p>
<p>First of all  the bottom-border has been removed and the color has been changed. Once we add a shadow we will no longer require a bottom border, and it can sometimes have a negative effect on the way the drop-down menu works &#8211; so for that reason i find it better to just remove it(in this case).</p>
<p>Secondly we have changed the background to use the image provided, no explanation required there. Finally an inner glow has been added using the box-shadow property. By using the &#8216;inset&#8217; keyword the shadow will be added inside the element, rather than outside.</p>
<p>Box shadow accepts 5 values, the following should give you a better idea of how the box-shadow property works:</p>
<p>box-shadow: Horizontal offset, Vertical offset, Blur radius, Spread, colour.</p>
<p>As a final note, the behaviour property allows us to attach a script to a CSS selector. You can read more about it at <a href="http://www.css3.com/css-behavior/">www.css3.com</a>.</p>
<h2>Step 2.1 &#8211; CSS: Container</h2>
<p>The next step is to add an outer shadow, you will need to add this to the wrapper &#8216;DIV&#8217;(#container) since you have already added a shadow to the &#8216;UL&#8217; element.</p>
<p><strong>Old Code:</strong></p><pre class="crayon-plain-tag">#container {
width:940px;
margin:0 auto;
}</pre><p><strong>New Code:</strong></p><pre class="crayon-plain-tag">#container {
width:940px;
margin:0 auto;
-webkit-box-shadow: 2px 2px 2px 2px #e6e5e5;
-moz-box-shadow: 2px 2px 2px 2px #e6e5e5;
box-shadow: 2px 2px 2px 0px #e6e5e5;
behavior: url(PIE.htc);
}</pre><p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/navigationmenushadow.png"><img class="alignnone size-full wp-image-473" title="navigationmenushadow" src="http://weebtutorials.com/wp-content/uploads/2011/09/navigationmenushadow.png" alt="navigationmenushadow" width="439" height="59" /></a></p>
<p><strong>Whats changed:</strong></p>
<p>Nothing much, a subtle border has been added to the bottom and left hand sides of the menu.</p>
<h2>Step 2.2 &#8211; CSS: List items</h2>
<p>The list items are to be updated next. The current item class will have a different background, borders will be added, text color changed etc.</p>
<p><strong>Old code:</strong></p><pre class="crayon-plain-tag">#navMain &amp;gt; li{
float:left;
position:relative;
}
#navMain &amp;gt; li &amp;gt; a{
color:#1b2e28;
float:left;
text-decoration:none;
padding:11px 12px;
}
#navMain .currentPage a{
background:#d3d3d3;
}</pre><p><strong>New code:</strong></p><pre class="crayon-plain-tag">#navMain &amp;gt; li{
float:left;
position:relative;
border-right:1px solid #fff;
}
#navMain &amp;gt; li &amp;gt; a{
color:#adacac;
float:left;
text-decoration:none;
padding:13px 14px;
margin:0;
text-shadow: 0px 1px 0px #fff;
font-size:13px;
border-right:1px solid #e5e4e4;
}
#navMain .currentPage a{
background:url(images/currentBG.png) repeat-x;
}</pre><p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/navmenuclean.png"><img class="alignnone size-full wp-image-476" title="navmenuclean" src="http://weebtutorials.com/wp-content/uploads/2011/09/navmenuclean.png" alt="navmenuclean" width="439" height="59" /></a></p>
<p><strong>Whats changed:</strong></p>
<p><strong></strong>First of all, two borders have been added. One to the list item(light), and one to the anchor(dark). This gives a nice, realistic lighting effect and fits perfectly on a navigation menu such as this.</p>
<p>The text has an embossed effect which is added using the text-shadow property. The code for this property is similar to that of the box-shadow property, a brief explanation can be found below.</p>
<p>box-shadow: Horizontal offset, Vertical offset, Blur radius, color.</p>
<p>Some other minor changes have been made, such as increasing the padding both vertically and horizontally. Also, the font size has been notched up a little and the color has been changed.</p>
<p>Finally, the background of the current list item has been changed to use the image which you should have downloaded earlier.</p>
<h2>Step 2.3 &#8211; CSS: Drop-down menu</h2>
<p>The following changes will be pretty much finish the navigation menu off. The styling of the dropdown menu will be changed and the positioning will need adjusting slightly.</p>
<p><strong>Old code:</strong></p><pre class="crayon-plain-tag">#navMain ul {
display:none;
position:absolute;
list-style:none;
left:0;
padding:0;
margin:0;
border-left:1px solid #595959;
border-right:1px solid #595959;
background:#dfecee;
}
#navMain ul li a{
color:#1b2e28;
text-decoration:none;
display:block;
padding:6px 7px;
border-bottom:1px solid #595959;
}
#navMain li:hover ul {
display:block;
top:36px;
min-width:200px;
}
.gecko #navMain li:hover ul {
top:38px;
}
.ff3_6 #navMain li:hover ul {
top:36px;
}</pre><p><strong>New code:</strong></p><pre class="crayon-plain-tag">#navMain ul {
display:none;
position:absolute;
list-style:none;
left:0;
padding:0;
margin:0;
border-left:1px solid #e8e7e7;
border-right:1px solid #e8e7e7;
background:#f7f6f6;
border-top:1px solid #e8e7e7;
}
#navMain ul li a{
color:#adacac;
text-decoration:none;
display:block;
padding:6px 7px;
border-bottom:1px solid #e8e7e7;
text-shadow: 0px 1px 0px #fff;
}
#navMain li:hover ul {
display:block;
top:42px;
left:-1px;
min-width:200px;
overflow:hidden;
}</pre><p><a href="http://weebtutorials.com/wp-content/uploads/2011/09/navigationmenuDrop.png"><img class="alignnone size-full wp-image-478" title="navigationmenuDrop" src="http://weebtutorials.com/wp-content/uploads/2011/09/navigationmenuDrop.png" alt="navigationmenuDrop" width="454" height="212" /></a></p>
<p><strong>Whats changed:</strong></p>
<p><strong></strong>The majority of the changes are purely cosmetic. The background color has changed, along with the font and borders. The most important changes though are to the positioning. Using the &#8216;top&#8217; property the dropdown list has been properly positioned to meet the increased padding of the menu.</p>
<p>You may also have noticed the the &#8216;.gecko&#8217; and &#8216;.ff3_6&#8242; rules have been removed. These are browser specific rules for the old navigation menu and are no longer required.</p>
<h2>Step 3 &#8211; Finish up!</h2>
<p>The navigation menu should be pretty much complete now, you may notice that the hover colors are still off. The hover effect is handled by a jquery script, you can change these in your HTML document.</p>
<p><strong>Old code:</strong></p><pre class="crayon-plain-tag">$(document).ready(function(){

    $(&quot;#container ul li a&quot;).hover(function() {
    $(this).animate({ color: &quot;#1c99da&quot; }, 800);
    }, function() {
  $(this).animate({ color: &quot;#1b2e28&quot; }, 100);
    });

  });</pre><p><strong>New code:</strong></p><pre class="crayon-plain-tag">&nbsp;$(document).ready(function(){

&nbsp;&nbsp;&nbsp; $(&quot;#container ul li a&quot;).hover(function() {
&nbsp;&nbsp;&nbsp; $(this).animate({ color: &quot;#7d7c7c&quot; }, 800);
&nbsp;&nbsp;&nbsp; }, function() {
&nbsp; $(this).animate({ color: &quot;#adacac&quot; }, 100);
&nbsp;&nbsp;&nbsp; });

&nbsp; });</pre><p><strong></strong><strong>Whats changed:</strong></p>
<p>Simple hex color code change, no explanation required.</p>
<p>Hopefully that was easy enough to follow and you now have a good idea how fast, and easy, it is to create a dropdown navigation menu using our template. Thanks for reading.
<div name="googleone_share_1" style="position:relative;z-index:5;"><g:plusone size="standard" count="1" href="http://weebtutorials.com/2011/09/cross-browser-css3-navigation-menu/"></g:plusone></div>
]]></content:encoded>
			<wfw:commentRss>http://weebtutorials.com/2011/09/cross-browser-css3-navigation-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

