<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Tiny Threads</title>
	
	<link>http://www.tiny-threads.com</link>
	<description>Sharing what I know and learning what you know about code.</description>
	<lastBuildDate>Wed, 01 Feb 2012 18:48:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TinyThreads" /><feedburner:info uri="tinythreads" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>[PHP] MySQL PDO class</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/xYHudRZOXkY/</link>
		<comments>http://www.tiny-threads.com/blog/2012/02/01/php-mysql-pdo-class/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 18:47:59 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=253</guid>
		<description><![CDATA[I had been wanting to get away from the standard MySQL classes for awhile. I knew they were inherently less secure, but part of moving to something different i meant that I would have to change the way I work &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2012/02/01/php-mysql-pdo-class/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had been wanting to get away from the standard MySQL classes for awhile. I knew they were inherently less secure, but part of moving to something different i meant that I would have to change the way I work with the database.</p>
<p>I wanted security, but I also wanted it to be easier to plug in to applications. So I created a mysql class that connects using PDO and has some protections against injections.</p>
<p>Mind you, this is a work in progress, so if you find a security issue or any other sort of issue, please comment so this can get updated.</p>
<div class="codecolorer-container php mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:450px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br />161<br />162<br />163<br />164<br />165<br />166<br />167<br />168<br />169<br />170<br />171<br />172<br />173<br />174<br />175<br />176<br />177<br />178<br />179<br />180<br />181<br />182<br />183<br />184<br />185<br />186<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #666666; font-style: italic;">// these 4 lines can be moved to a different file if you want to separate them from the class</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_HOST'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your host here'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your db username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your db password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'your database name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> DB<br />
<span style="color: #009900;">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$db</span><span style="color: #339933;">;</span><br />
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
    <span style="color: #666666; font-style: italic;">// initialize connection</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PDO<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mysql:host=&quot;</span><span style="color: #339933;">.</span>DB_HOST<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;dbname=&quot;</span><span style="color: #339933;">.</span>DB_NAME<span style="color: #339933;">,</span> DB_USER<span style="color: #339933;">,</span> DB_PASS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> build_where<span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot; WHERE &quot;</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$c</span><span style="color: #339933;">=</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
            <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$w</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
                <span style="color: #666666; font-style: italic;">// look for any comparitive symbols within the where array value.</span><br />
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'%'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
                    <span style="color: #666666; font-style: italic;">// prep the query for PDO-&gt;prepare</span><br />
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'=%:'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'% &amp;&amp; '</span><span style="color: #339933;">;</span><br />
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$w</span><span style="color: #339933;">;</span><br />
                <span style="color: #009900;">&#125;</span><br />
                <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'&lt;='</span><span style="color: #009900;">&#41;</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&lt;='</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'&gt;='</span><span style="color: #009900;">&#41;</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&gt;='</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'&gt;'</span><span style="color: #009900;">&#41;</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&gt;'</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #009900;">&#41;</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$w</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'!'</span><span style="color: #009900;">&#41;</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'!='</span><span style="color: #339933;">;</span><br />
                    <span style="color: #b1b100;">else</span><br />
                        <span style="color: #000088;">$eq</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">;</span><br />
                    <br />
                    <span style="color: #666666; font-style: italic;">// prep the query for PDO-&gt;prepare</span><br />
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #000088;">$eq</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' &amp;&amp; '</span><span style="color: #339933;">;</span><br />
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$w</span><span style="color: #339933;">;</span><br />
                <span style="color: #009900;">&#125;</span><br />
                <span style="color: #000088;">$c</span><span style="color: #339933;">++;</span><br />
            <span style="color: #009900;">&#125;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #009900;">&#125;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// general query function</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span><span style="color: #000088;">$vals</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #000088;">$sth</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><br />
            <span style="color: #000088;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">else</span><br />
            <span style="color: #000088;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #000088;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span>PDO<span style="color: #339933;">::</span><span style="color: #004000;">FETCH_OBJ</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// select function</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> select<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$vals</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'*'</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #666666; font-style: italic;">// initialize the sql query</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT &quot;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// add all the values to be selected </span><br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
            <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><br />
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$v</span><span style="color: #339933;">.</span><span style="color: #0000ff;">','</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #009900;">&#125;</span><br />
        <span style="color: #b1b100;">else</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$vals</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' FROM '</span><span style="color: #339933;">.</span><span style="color: #000088;">$table</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the WHERE portion of the query</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build_where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #000088;">$ret</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ret</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// insert</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> insert<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #666666; font-style: italic;">// empty the replace array</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;INSERT INTO &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; SET &quot;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the replace array and the query</span><br />
        <span style="color: #000088;">$c</span><span style="color: #339933;">=</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'=:'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$v</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$c</span><span style="color: #339933;">++;</span><br />
        <span style="color: #009900;">&#125;</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// run and return the query</span><br />
        <span style="color: #000088;">$ret</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #000088;">$id</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastInsertId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">else</span><br />
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ret</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// update</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$vals</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #666666; font-style: italic;">// empty the replace array</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UPDATE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; SET &quot;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the replace array and the query</span><br />
        <span style="color: #000088;">$c</span><span style="color: #339933;">=</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">.=</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'=:'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$v</span><span style="color: #339933;">;</span><br />
            <span style="color: #000088;">$c</span><span style="color: #339933;">++;</span><br />
        <span style="color: #009900;">&#125;</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the WHERE portion of the query</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build_where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// run and return the query</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> delete<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #666666; font-style: italic;">// empty the replace array</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;DELETE FROM &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the WHERE portion of the query</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build_where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// run and return the query</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// get the number of records matching the requirements</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// start query</span><br />
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT COUNT(*) FROM &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// build the WHERE portion of the query</span><br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><br />
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">build_where</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// run and return the query</span><br />
        <span style="color: #000088;">$sth</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><br />
            <span style="color: #000088;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vals</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// return the row count</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$sth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rowCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <br />
    <span style="color: #666666; font-style: italic;">// gets value of requested column</span><br />
    <span style="color: #000000; font-weight: bold;">function</span> get_value<span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$val</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
        <span style="color: #666666; font-style: italic;">// run query</span><br />
        <span style="color: #000088;">$o</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$table</span><span style="color: #339933;">,</span><span style="color: #000088;">$val</span><span style="color: #339933;">,</span><span style="color: #000088;">$where</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// convert first object in associative array to array</span><br />
        <span style="color: #000088;">$v</span><span style="color: #339933;">=</span><a href="http://www.php.net/get_object_vars"><span style="color: #990000;">get_object_vars</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$o</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
        <br />
        <span style="color: #666666; font-style: italic;">// return requested value</span><br />
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=xYHudRZOXkY:zj-c1x36AwE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=xYHudRZOXkY:zj-c1x36AwE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=xYHudRZOXkY:zj-c1x36AwE:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/xYHudRZOXkY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2012/02/01/php-mysql-pdo-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2012/02/01/php-mysql-pdo-class/</feedburner:origLink></item>
		<item>
		<title>[Browser] Window Resizer for Google Chrome</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/m0565JCtYBA/</link>
		<comments>http://www.tiny-threads.com/blog/2012/01/31/browser-window-resizer-google-chrome/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 20:02:48 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Browser Plugins]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=250</guid>
		<description><![CDATA[I have recently started trying to build web apps and one thing I have to take into account are the dimensions for mobile devices. I could try to guesstimate, or I could use Window Resizer. <a class="more-link" href="http://www.tiny-threads.com/blog/2012/01/31/browser-window-resizer-google-chrome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tiny-threads.com/wp-content/uploads/2012/01/window-resizer.jpg" ><img class="alignright size-medium wp-image-251" title="Window Resizer for Chrome" src="http://www.tiny-threads.com/wp-content/uploads/2012/01/window-resizer-300x225.jpg" alt="Window Resizer for Chrome" width="300" height="225" /></a>I have recently started trying to build web apps and one thing I have to take into account are the dimensions for mobile devices. I could try to guesstimate, or I could use <a href="https://chrome.google.com/webstore/detail/kkelicaakdanhinjdeammmilcgefonfh" title="Window Resizer for Chrome"  target="_blank">Window Resizer</a>.</p>
<p>This little extension has made a world of difference in the ease of designing mobile web pages. I enter in my custom sizes if they aren&#8217;t already there and away I go! I 100% recommend this extension if you use Chrome.</p>
<p>If you use Firefox, I&#8217;d recommend <a href="https://addons.mozilla.org/en-US/firefox/addon/firesizer/" title="Firesizer for Firefox"  target="_blank">Firesizer</a>. Simple and unobtrusive. There is also <a href="http://www.yellowpipe.com/yis/tools/window_resizer/" title="Browser Window Resizer"  target="_blank">Browser Window Resizer</a> for IE, but since their Firefox plugin is now unsupported, I hesitate to recommend it, but I am posting it here for anyone who wants to try it. If you do try it, let me know how it goes.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=m0565JCtYBA:gnb3CDKnqHM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=m0565JCtYBA:gnb3CDKnqHM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=m0565JCtYBA:gnb3CDKnqHM:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/m0565JCtYBA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2012/01/31/browser-window-resizer-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2012/01/31/browser-window-resizer-google-chrome/</feedburner:origLink></item>
		<item>
		<title>Stop SOPA and PIPA: Useful links and info</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/2txdfa0-52o/</link>
		<comments>http://www.tiny-threads.com/blog/2012/01/18/stop-sopa-pipa-links-info/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 14:35:09 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Blog Info]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=248</guid>
		<description><![CDATA[I want to point out, for those of you who don&#8217;t already know, that the big problem with these bills is not the piracy issue. It&#8217;s that they are so poorly and broadly written that they can be abused too &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2012/01/18/stop-sopa-pipa-links-info/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I want to point out, for those of you who don&#8217;t already know, that the big problem with these bills is not the piracy issue. It&#8217;s that they are so poorly and broadly written that they can be abused too easily.</p>
<p>If a large company feels a smaller company has infringed on it&#8217;s copyright, and it fills out the paperwork correctly, the smaller company is then blocked on the web and has to defend itself. That means it&#8217;s up to the smaller company to hire the lawyers and get the defense going. For a lot of small businesses that is a death sentence.</p>
<p>These bills will stifle innovation and growth because of the constant fear of being torn down. Honestly, it deters me from starting any sort of new website. Heaven forbid I link to a website that could cause me to be in violation.</p>
<p>Thanks for your time and for reading this far. If you didn&#8217;t just please go sign <a target="_blank" href="https://www.google.com/landing/takeaction/" title="End Piracy, Not Liberty" >the petition</a>.</p>
<p>Other useful links (some info may be a little outdated now):<br />
<a target="_blank" href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act" >http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act</a><br />
<a href="http://news.cnet.com/8301-31921_3-57329001-281/how-sopa-would-affect-you-faq/">http://news.cnet.com/8301-31921_3-57329001-281/how-sopa-would-affect-you-faq/<br />
</a><a target="_blank" href="http://mashable.com/2012/01/16/white-house-sopa-petition/" >http://mashable.com/2012/01/16/white-house-sopa-petition/</a><a href="http://news.cnet.com/8301-31921_3-57329001-281/how-sopa-would-affect-you-faq/"><br />
</a><a href="http://act2.freepress.net/sign/media_sopa">http://act2.freepress.net/sign/media_sopa<br />
</a><a target="_blank" href="http://www.stumbleupon.com/su/2zhuoc/list25.com/25-things-you-need-to-know-about-sopa/" >http://www.stumbleupon.com/su/2zhuoc/list25.com/25-things-you-need-to-know-about-sopa/</a><a target="_blank" href="http://act2.freepress.net/sign/media_sopa" > </a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=2txdfa0-52o:twqVHW0pyAA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=2txdfa0-52o:twqVHW0pyAA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=2txdfa0-52o:twqVHW0pyAA:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/2txdfa0-52o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2012/01/18/stop-sopa-pipa-links-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2012/01/18/stop-sopa-pipa-links-info/</feedburner:origLink></item>
		<item>
		<title>[jQuery] jQuery UI MultiSelect Widget</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/7ym255oKzac/</link>
		<comments>http://www.tiny-threads.com/blog/2011/10/26/jquery-jquery-ui-multiselect-widget/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 17:37:27 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Libraries]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=247</guid>
		<description><![CDATA[So like many UI developers, I am always looking for new and useful jQuery plugins that I can use to simplify forms and make things easier for the end user. <a class="more-link" href="http://www.tiny-threads.com/blog/2011/10/26/jquery-jquery-ui-multiselect-widget/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So like many UI developers, I am always looking for new and useful jQuery plugins that I can use to simplify forms and make things easier for the end user. One particular case had me trying to figure out how to make multiple selection possible in a limited space.</p>
<p>The answer came in the form of Eric Hynds&#8217; <a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/" title="jQuery UI MultiSelect Widget"  target="_blank">jQuery UI MultiSelect Widget</a>. This plugin packs so much into such a little area. It replaces the default multiple select tag with a jQuery UI styled combo box. That was really all I needed, but this little plugin packed in much more.</p>
<p>Eric out did himself and created a supporting plugin that helps to filter the content within the combo box. This added to the user friendliness that my project needed.</p>
<p>I think my only gripe is that there is no way to set an fixed width. While the minWidth property is wonderful, there is no way to keep the selection from growing larger. My suggestion would be to have a fixed width with the combo box able to be larger than the initial width of the selection box.</p>
<p>If you are looking for a great plugin that you can use in place of long checkbox lists or multiple select boxes, I highly recommend this one.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7ym255oKzac:qD4tbh6YxPI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7ym255oKzac:qD4tbh6YxPI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7ym255oKzac:qD4tbh6YxPI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/7ym255oKzac" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/10/26/jquery-jquery-ui-multiselect-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/10/26/jquery-jquery-ui-multiselect-widget/</feedburner:origLink></item>
		<item>
		<title>[WordPress] Plugin: Multiple Galleries</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/r7w3ens6XWM/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/30/wordpress-plugin-multiple-galleries/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 19:47:22 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=245</guid>
		<description><![CDATA[So a few weeks ago I made a post about a plugin I found that helped to reign in a bit of WordPress&#8217;s default gallery habits. Today I found an even better solution Multiple Galleries is so much better in &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/30/wordpress-plugin-multiple-galleries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So a few weeks ago I made a post about a plugin I found that helped to reign in a bit of WordPress&#8217;s default gallery habits. Today I found an even better solution</p>
<p><a href="http://wordpress.org/extend/plugins/multiple-galleries/" title="Multiple Galleries"  target="_blank">Multiple Galleries</a> is so much better in the fact that you can have multiple galleries for each post. That and it&#8217;s a lot easier to opt out of having an image in the gallery.</p>
<p>I have no complaints about this plugin, it just works well.  Check it out if you want to have multiple galleries in your blog posts or pages and don&#8217;t care about having fancy lightboxes.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=r7w3ens6XWM:RTKjIENhmpM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=r7w3ens6XWM:RTKjIENhmpM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=r7w3ens6XWM:RTKjIENhmpM:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/r7w3ens6XWM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/30/wordpress-plugin-multiple-galleries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/30/wordpress-plugin-multiple-galleries/</feedburner:origLink></item>
		<item>
		<title>[WordPress] Plugin: WordPress Gallery Hack</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/HCpEU8N8znA/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/20/wordpress-plugin-wordpress-gallery-hack/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 17:24:36 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=243</guid>
		<description><![CDATA[I rarely use the built in WordPress gallery feature, but having started a family blog with my wife, I found that it is more likely that I will use it in the future. Only problem? No way to distinguish between &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/20/wordpress-plugin-wordpress-gallery-hack/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I rarely use the built in WordPress gallery feature, but having started a family blog with my wife, I found that it is more likely that I will use it in the future.</p>
<p>Only problem? No way to distinguish between images I have in the gallery and ones I want separate.</p>
<p>While researching my next move, I found that this was a known issue with WordPress and has yet to be addressed. Until that day, however, there is <a href="http://scottrasher.com/wordpress-plugin-for-excluding-gallery-pictures-for-adding-to-post/" title="Wordpress Gallery Hack 1.2"  target="_blank">WordPress Gallery Hack</a>. It&#8217;s not in the codex, so don&#8217;t try looking there.</p>
<p>This plugin adds a little link withing each gallery image that allows you to remove it from the gallery. It will still show up when you edit the gallery, but it will not be displayed in your post or page. This can be confusing when you first try it out, but once you get it, it&#8217;s worth it.</p>
<p>Now I don&#8217;t always use galleries, but when I do, I use Wordpress Gallery Hack</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=HCpEU8N8znA:moplMHAmAxs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=HCpEU8N8znA:moplMHAmAxs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=HCpEU8N8znA:moplMHAmAxs:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/HCpEU8N8znA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/20/wordpress-plugin-wordpress-gallery-hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/20/wordpress-plugin-wordpress-gallery-hack/</feedburner:origLink></item>
		<item>
		<title>[WordPress] Plugin: Admin Login As Different User</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/fEiiOCMaK8c/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/16/wordpress-plugin-admin-login-user/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 20:05:52 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=238</guid>
		<description><![CDATA[When I have to debug a plugin, it sometimes requires that I use different accounts to make sure everything is working. This also means that in the live setting, if a user has an issue that I can&#8217;t replicate, I &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/16/wordpress-plugin-admin-login-user/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tiny-threads.com/wp-content/uploads/2011/09/screenshot-1.png" ><img class="alignright size-medium wp-image-239" title="screenshot-1" src="http://www.tiny-threads.com/wp-content/uploads/2011/09/screenshot-1-300x254.png" alt="" width="300" height="254" /></a>When I have to debug a plugin, it sometimes requires that I use different accounts to make sure everything is working. This also means that in the live setting, if a user has an issue that I can&#8217;t replicate, I have to login under there account. So how do I do that without changing their password each time? With a plugin!</p>
<p>I found Admin Login As Different User while searching through Google for a plugin to do exactly what the title implies. It&#8217;s so simple to use that I&#8217;m not sure I need to explain.</p>
<p>Install and activate the plugin, go to the plugin page under tools, and pick who you want to login as. Simple as that.</p>
<p>The plugin has saved me a lot of time and headaches since it&#8217;s an instant switch over to their profile. I think the only thing that I would change is to provide a link to switch back to your original account.</p>
<p>Small gripes aside, this is a wonderful plugin that any admin should seriously consider adding to their arsenal.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=fEiiOCMaK8c:Xj7taTf5AWE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=fEiiOCMaK8c:Xj7taTf5AWE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=fEiiOCMaK8c:Xj7taTf5AWE:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/fEiiOCMaK8c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/16/wordpress-plugin-admin-login-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/16/wordpress-plugin-admin-login-user/</feedburner:origLink></item>
		<item>
		<title>[Intro] Intro to HTML: How to build your first page</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/7-91p7PUA3U/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/13/intro-intro-html-build-page/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 21:25:40 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Informative]]></category>
		<category><![CDATA[Intro Series]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=233</guid>
		<description><![CDATA[So now that we&#8217;ve been introduced to what HTML is, we can begin to create our first page! First thing first. Create a new file ending with .html or .htm and save it. This will be the starting file for &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/13/intro-intro-html-build-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tiny-threads.com/wp-content/uploads/2011/09/267437_7416.jpg" ><img src="http://www.tiny-threads.com/wp-content/uploads/2011/09/267437_7416-300x200.jpg" alt="" title="267437_7416" width="300" height="200" class="alignright size-medium wp-image-236" /></a>So now that we&#8217;ve been introduced to what HTML is, we can begin to create our first page!</p>
<p>First thing first. Create a new file ending with .html or .htm and save it. This will be the starting file for all your learning. Once you have the file, open it in your notepad or another <a href="http://notepad-plus-plus.org/" title="Notepad++"  target="_blank">editor</a>-<a href="http://www.flos-freeware.ch/notepad2.html" title="Notepad2"  target="_blank">of</a> <a href="http://www.pspad.com/" title="PSPad"  target="_blank">choice</a>and we can begin.</p>
<p>Every HTML page has a very basic layout that is necessary to properly render your content. Knowing how to form the page will affect everything.</p>
<h4><strong>Where to start?</strong></h4>
<p>To start, you need to choose your doctype. Do you want frames? No frames? Strict rules or relaxed rules? These are things you need to think about when choosing your doctype.</p>
<p>The doctype you pick will determine how the browser interacts with your HTML, and how it displays it. You can review the different kinds of doctypes over at <a href="http://www.w3schools.com/tags/tag_doctype.asp" title="HTML doctype declaration"  target="_blank">w3schools.com</a>.</p>
<p>For the beginner, I would recommend using XHTML 1.0 Transitional doctype. I recommend this because it will help ease the transition to CSS later on as some browsers don&#8217;t like to use HTML 4.01 with css properly (I&#8217;m looking at you, IE).</p>
<p>So open up your file and enter this on the first line:</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span></div></td></tr></tbody></table></div>
<h4><strong>Building the basic structure</strong></h4>
<p>So you have your doctype. Now what? Why we build, of course!</p>
<p>Every HTML page, regardless of doctype has to have three tags: html, body, and head. While some people will tell you that you can, and that&#8217;s correct, it is never a good idea to leave them out, and that may mess up things down the road.</p>
<p>Ok, we have the three tags. How do we make them work? Very simple. Start off by entering both the opening and closing html tags. Put them right after the doctype.</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>After this, you want to add your body and head tags. The head tag gives the browser information about your webpage itself and the body tag provides the actual content. The go inside your html tags, so it looks something like this:</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>You will always have at least this much in every HTML file you ever make. Ever.</p>
<h4><strong>Ok, so I have my structure, but how do I display stuff?</strong></h4>
<p><a href="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634515256868593750.png" ><img class="alignright size-full wp-image-234" title="Capture634515256868593750" src="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634515256868593750.png" alt="" width="275" height="223" /></a>With the basic structure out of the way, we can get into making your web page display some content. Let&#8217;s give the page a title so that when you look at the browser window title bar it will tell you what it says.</p>
<p>To do this, we use the title tag. The title tag is added inside of the head tag. Once there, you can put whatever text you want in there, and it will show up in the browser&#8217;s title bar.</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>My Title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Save the file and open it in a browser and you should be able to see your title!</p>
<p><a href="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634515272767968750.png" ><img class="alignright size-full wp-image-235" title="Capture634515272767968750" src="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634515272767968750.png" style="border: 1px solid #000000;" alt="" width="269" height="177" /></a>Now for the content. It&#8217;s very simple. All the content goes between the body tags.</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>My Title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span>Hello World!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>That&#8217;s all you have to do! Now you can start entering all the tags and content you want!</p>
<h4><strong>In Closing&#8230;</strong></h4>
<p>Having covered the very basic beginning structure of our HTML page, we are now ready to move onto the next part of creating our web page, which will be adding more tags to the mix!  It&#8217;s about to get real. Does anyone say that anymore?</p>
<p>As with the last post, if you find there is anything missing or inaccurate, then please let me know in the comments!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7-91p7PUA3U:pVWJEwf6JYw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7-91p7PUA3U:pVWJEwf6JYw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=7-91p7PUA3U:pVWJEwf6JYw:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/7-91p7PUA3U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/13/intro-intro-html-build-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/13/intro-intro-html-build-page/</feedburner:origLink></item>
		<item>
		<title>[WordPress] Plugin: Simple Modal</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/laOYwW2U_4c/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/09/wordpress-plugin-simple-modal/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 19:51:08 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Simple Modal]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=231</guid>
		<description><![CDATA[I have just created my first publicly available WordPress plugin. I call it Simple Modal. I had looked for a plugin that would provide me with a simple shortcode I could use to implement a straight forward modal dialog box, &#8230; <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/09/wordpress-plugin-simple-modal/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have just created my first publicly available WordPress plugin. I call it Simple Modal.</p>
<p>I had looked for a plugin that would provide me with a simple shortcode I could use to implement a straight forward modal dialog box, and when I couldn&#8217;t find on that met my needs, I made my own.</p>
<p>Check out the <a href="http://www.tiny-threads.com/simple-modal/"  title="Simple Modal" target="_blank">project page</a> for more details.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=laOYwW2U_4c:ciTsiQf3Qjc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=laOYwW2U_4c:ciTsiQf3Qjc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=laOYwW2U_4c:ciTsiQf3Qjc:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/laOYwW2U_4c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/09/wordpress-plugin-simple-modal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/09/wordpress-plugin-simple-modal/</feedburner:origLink></item>
		<item>
		<title>[Intro] Intro to HTML: what is it?</title>
		<link>http://feedproxy.google.com/~r/TinyThreads/~3/zNnEDIhg0Q4/</link>
		<comments>http://www.tiny-threads.com/blog/2011/09/01/beginner-setup-html-page/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 00:54:17 +0000</pubDate>
		<dc:creator>Steve Koehler</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Informative]]></category>
		<category><![CDATA[Intro Series]]></category>

		<guid isPermaLink="false">http://www.tiny-threads.com/?p=225</guid>
		<description><![CDATA[You have reached a point in your life where one of two things has happened. You either are curious about how to edit HTML or you are required to edit it because of work or school.

Have no fear. I am starting a series dedicated to covering the basic ins and outs of web programming, starting with HTML! <a class="more-link" href="http://www.tiny-threads.com/blog/2011/09/01/beginner-setup-html-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You have reached a point in your life where one of two things has happened. You either are curious about how to edit HTML or you are required to edit it because of work or school.</p>
<p>Have no fear. I am starting a series dedicated to covering the basic ins and outs of web programming, starting with HTML!</p>
<p>Let&#8217;s dive right in.</p>
<h4><strong>What HTML is</strong></h4>
<p>If you have ever done a &#8220;view source&#8221; on a webpage, you have probably seen something like this:</p>
<p><a href="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634504853116875000.png" ><img class="alignnone size-full wp-image-226" title="Capture634504853116875000" src="http://www.tiny-threads.com/wp-content/uploads/2011/09/Capture634504853116875000.png" alt="" width="403" height="296" /></a></p>
<p>It is also possible that viewing that code made your head explode.</p>
<p>After piecing your head back together, you can start dissecting the structure and you may begin to see that the text follows a pattern.</p>
<p><a target="_blank" href="http://www.sxc.hu/browse.phtml?f=profile&amp;l=chriki7274" ><img class="alignright size-full wp-image-227" title="Image by chriki7274" src="http://www.tiny-threads.com/wp-content/uploads/2011/09/russianDolls.jpg" alt="Image by chriki7274" width="300" height="200" /></a>HTML is a language of tags that are nested within one another. To help you visualize, it&#8217;s kind of like those Russian dolls. The top to each doll is an open tag and the bottom is a closing tag. If you open up a doll, you find more dolls (tags).</p>
<p>With HTML, however, you can nest more than just one tag at a time. You can nest as many as you&#8217;d like.</p>
<h4><strong>What HTML isn&#8217;t</strong></h4>
<p>HTML is sometimes referred to as a programming language. This is an incorrect statement. HTML is actually a markup language. In fact, it stands for Hyper Text Markup Language.</p>
<p>Markup languages are more for storing simple data and formatting rules whereas a programming language is used to execute commands and manipulate data. In the case of HTML, the language is used to tell a web browser how to display the content.</p>
<h4><strong>How HTML works</strong></h4>
<p>As I said, HTML tells the browser how to display content.  This is done by the different types of tags and their placement on a page.</p>
<p>HTML is read from the top down and, as such, content is typically rendered using the top down. So if you have an image tag before a paragraph tag in your code, the image will render before the paragraph. Alternatively, if you were to move that image tag after the paragraph, it would show up after the paragraph on the rendered page.</p>
<p>Along with the placement, tags have attributes that you can use to manipulate how things are rendered. Tags largely control placement and browser interpretation and attributes control the look and feel of a tag.</p>
<h4><strong>Tags</strong></h4>
<p>As I previously stated, tags are used to nest and display objects as well as place them on the page, but what exactly is a tag?</p>
<p>A tag is a piece of the markup language that dictates browser behavior. For instance, a &#8220;p&#8221; tag indicates you would like to use a paragraph, and an &#8220;img&#8221; or image tag indicates that you would like to display an image on your web page.</p>
<p>All tags are encased inbetween the greater-than(&gt;) and less-than(&lt;) symbols. If the browser ever sees a raw greater-than or less-than symbol, it automatically assumes it&#8217;s a tag. </p>
<p>Every tag has an open and closed version, though some are combined. What this means is that some tags allow additional content to be nested within, but not all tags nest. To use our earlier example, the &#8220;p&#8221; tag allows content to be embedded within it where the &#8220;img&#8221; tag does not. These are written differently:</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Because the p tag has opening and closing tags, you can put stuff in it!<br />
<br />
This is my content<br />
<br />
Image tags can't do that since they self close with a slash<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat_pic.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Notice the p tag has opening and closing tags while the image tag ends with a slash. The image tag is what is known as a self-closing tags. While any tag could potentially be a self closing tag, I have yet to find a reason to use a self closing tag beyond the &#8220;img&#8221;, &#8220;br&#8221;, &#8220;link&#8221;, &#8220;input&#8221;, and &#8220;hr&#8221; tags. I know there are more self closing tags, but those 5 are the most common.</p>
<h4><strong>Attributes</strong></h4>
<p>If you look closely at the image tag in the example I laid out above, you will see an attribute at work. The image tag uses the &#8220;src&#8221; attribute to tell the browser where to find the image that you want to display. So when you have &lt;img src=&#8221;cat_pic.jpg&#8221; /&gt;, the browser looks for cat_pic.jpg in the same folder as your html file.</p>
<p>All tags have some attributes, the most useful of which is the style attribute, which I will cover in a later post. These attributes help to modify how the tag looks and acts.</p>
<p>Attributes are always included as part of the tag and are found between the greater-than and less-than symbols. You assign values to each attribute by saying the attribute = &#8220;something&#8221;. The values must always be contained in either single or double quotes.</p>
<h4><strong>In Closing&#8230;</strong></h4>
<p>That is HTML in a nutshell. In the next installments I plan to cover actual HTML code. Further past that I plan on introducing CSS, HTML5 and Javascript. Should be a good ride for all you newbies out there. For all your code masters, correct anything I say that may be wrong. I&#8217;d rather have this accurate than having too much pride to admit I&#8217;m wrong.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/TinyThreads?a=zNnEDIhg0Q4:SfAT9Bn3D1Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=zNnEDIhg0Q4:SfAT9Bn3D1Q:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/TinyThreads?a=zNnEDIhg0Q4:SfAT9Bn3D1Q:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/TinyThreads?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/TinyThreads/~4/zNnEDIhg0Q4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.tiny-threads.com/blog/2011/09/01/beginner-setup-html-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.tiny-threads.com/blog/2011/09/01/beginner-setup-html-page/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 2.586 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-02-01 17:46:14 -->

