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

<channel>
	<title>Jason Rowe &#187; PHP</title>
	<atom:link href="http://jasonrowe.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasonrowe.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Aug 2010 23:10:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP Active Tab Menu Pattern</title>
		<link>http://jasonrowe.com/2009/08/15/php-active-tab-menu-pattern/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=php-active-tab-menu-pattern</link>
		<comments>http://jasonrowe.com/2009/08/15/php-active-tab-menu-pattern/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 04:49:09 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=615</guid>
		<description><![CDATA[I was just messing with PHP and made this simple little script to track which menu item is active. It looks at the last URL folder name to make the match. For example, if the URL was &#8220;http://localhost/example/About/&#8221; it would &#8230; <a href="http://jasonrowe.com/2009/08/15/php-active-tab-menu-pattern/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was just messing with PHP and made this simple little script to track which menu item is active. It looks at the last URL folder name to make the match. For example, if the URL was &#8220;http://localhost/example/About/&#8221; it would match &#8220;about&#8221; and write out the needed css. It also works correctly with the URL http://localhost/example/About/index.php by stripping off the index.php value and looking at the folder about.</p>
<pre class="brush: php; ">

&lt; ?php

$folderName = basename($_SERVER[&#039;REQUEST_URI&#039;]);

if(strtoupper($folderName) == &quot;INDEX.PHP&quot;)
{

$folderName = dirname ($_SERVER[&#039;REQUEST_URI&#039;]);
$paths = explode(&#039;/&#039;, $folderName);

foreach($paths as $key =&gt; $value)
{
if(!empty($value))
{
$new_paths[] = $value;
}
}

$last_path = $new_paths[count($new_paths) - 1];
$folderName = $last_path;
}

function getCSSName($str,$folderName)
{
//echo $str;
//echo $folderName;

if ($str == $folderName)
echo &quot;current_page_item&quot;;
}

?&gt;
</pre>
<p>Then a quick example of using it in the html.</p>
<pre class="brush: html; ">

&lt;ul id=&quot;tabs&quot;&gt;
&lt;li class=&quot;home-item &lt;?php getCSSName(&quot;EXAMPLE&quot;, strtoupper($folderName)); ?&gt;&quot;&gt;
&lt;a rel=&quot;nofollow&quot; title=&quot;home&quot; href=&quot;http://localhost/example/&quot;&gt;Home&lt;/a&gt;
&lt;/li&gt;
&lt;li class=&quot;page-item-1 &lt;?php getCSSName(&quot;ABOUT&quot;, strtoupper($folderName)); ?&gt;&quot;&gt;
&lt;a title=&quot;About&quot; href=&quot;http://localhost/example/About/&quot;&gt;About&lt;/a&gt;
&lt;/li&gt;
&lt;li class=&quot;page-item-2 &lt;?php getCSSName(&quot;SERVICES&quot;, strtoupper($folderName)); ?&gt;&quot;&gt;
&lt;a title=&quot;Services&quot; href=&quot;http://localhost/example/services/&quot;&gt;Services&lt;/a&gt;
&lt;/li&gt;
&lt;li class=&quot;page-item-3 &lt;?php getCSSName(&quot;CONTACT&quot;, strtoupper($folderName)); ?&gt;&quot;&gt;
&lt;a title=&quot;Services&quot; href=&quot;http://localhost/example/contact/&quot;&gt;Contact&lt;/a&gt;
&lt;/li&gt;
&lt;li class=&quot;page-item-4 &lt;?php getCSSName(&quot;PICTURES&quot;, strtoupper($folderName)); ?&gt;&quot;&gt;
&lt;a title=&quot;Services&quot; href=&quot;http://localhost/example/pictures/&quot;&gt;Pictures&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 704px; width: 1px; height: 1px;">&lt;ul id=&#8221;tabs&#8221;&gt;<br />
&lt;li class=&#8221;home-item &lt;?php getCSSName(&#8220;AS&#8221;, strtoupper($folderName)); ?&gt;&#8221;&gt;<br />
&lt;a rel=&#8221;nofollow&#8221; title=&#8221;http://localhost/as/&#8221; href=&#8221;http://localhost/as/&#8221;&gt;Home&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li class=&#8221;page-item-1 &lt;?php getCSSName(&#8220;ABOUT&#8221;, strtoupper($folderName)); ?&gt;&#8221;&gt;<br />
&lt;a title=&#8221;About&#8221; href=&#8221;http://localhost/as/About/&#8221;&gt;About&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li class=&#8221;page-item-2 &lt;?php getCSSName(&#8220;SERVICES&#8221;, strtoupper($folderName)); ?&gt;&#8221;&gt;<br />
&lt;a title=&#8221;Services&#8221; href=&#8221;http://localhost/as/services/&#8221;&gt;Services&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li class=&#8221;page-item-3 &lt;?php getCSSName(&#8220;CONTACT&#8221;, strtoupper($folderName)); ?&gt;&#8221;&gt;<br />
&lt;a title=&#8221;Services&#8221; href=&#8221;http://localhost/as/contact/&#8221;&gt;Contact&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li class=&#8221;page-item-4 &lt;?php getCSSName(&#8220;PICTURES&#8221;, strtoupper($folderName)); ?&gt;&#8221;&gt;<br />
&lt;a title=&#8221;Services&#8221; href=&#8221;http://localhost/as/pictures/&#8221;&gt;Pictures&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;li class=&#8221;rss&#8221;&gt;<br />
&lt;a rel=&#8221;nofollow&#8221; title=&#8221;contact information 763-783-0708&#8243; href=&#8221;contact&#8221;&gt;&lt;b&gt;Call Now 763.783.0708&lt;/b&gt;&lt;/a&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2009/08/15/php-active-tab-menu-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP MySql Setup</title>
		<link>http://jasonrowe.com/2007/08/07/php-mysql-setup/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=php-mysql-setup</link>
		<comments>http://jasonrowe.com/2007/08/07/php-mysql-setup/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 04:28:00 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://rowejason.com/?p=98</guid>
		<description><![CDATA[Here is my idiots guid to working with PHP 5, MySql, and Apache on a windows server. This assumes you have downloaded all of the above mentioned apps and have them installed. If not you can get them here: (PHP &#8230; <a href="http://jasonrowe.com/2007/08/07/php-mysql-setup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is my idiots guid to working with PHP 5, MySql, and Apache on a windows server.</p>
<p>This assumes you have downloaded all of the above mentioned apps and have them installed. If not you can get them here: (<a href="http://www.php.net/downloads.php">PHP </a>, <a href="http://dev.mysql.com/downloads/">MySQL</a>)</p>
<p><strong>Configure PHP 5 to start talking to MySql.</strong></p>
<p>UPDATE with php 5.2.6 and Apache 2.2 I had to use these instructions &#8211; <a href="http://www.php.ph/2008/07/16/windows-installing-php-526-on-apache-229-manually/">http://www.php.ph/2008/07/16/windows-installing-php-526-on-apache-229-manually/</a></p>
<ol>
<li>open your php.ini file because you have to add a few entries. (example C:\php\php.ini)</li>
<li>Once open search for Windows Extensions</li>
<li>Then add this line &#8220;extension=php_mysql.dll &#8221; after it and do not put the ignore &#8220;;&#8221; in front of it like the others that might already be in the config</li>
<li>While in the php.ini file search for &#8220;extension_dir&#8221; and make sure it has a correct path. (example:extension_dir = &#8220;c:\php\ext&#8221;)</li>
<li>Double check that mysql is running in your services.</li>
<li>Restart Apache and check the <a href="http://us2.php.net/phpinfo">phpinfo() </a>page to make sure you now have a mysql section before moving on to the next steps.</li>
<li>Restart apache</li>
<li>Now setup a test php script page with the following</li>
</ol>
<pre class="brush: php; ">

&lt; ?php // we connect to example.com and port 3306 which is the default

$link = mysql_connect(&#039;localhost:3306&#039;, &#039;root&#039;, &#039;password&#039;);

if (!$link) { die(&#039;Could not connect: &#039; . mysql_error()); }

echo &#039;Connected successfully&#039;; mysql_close($link);
</pre>
<p>Hopefully you get the following response on the page when you view it. &#8220;Connected successfully&#8221;</p>
<p>Troubleshooting Tips:</p>
<ul>
<li>You can use telnet to see if the service is running. start &gt; run &gt; telnet localhost 3306 should give you some sort of response.</li>
<li>Check (C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf) for the following entries : PHPIniDir &#8220;C:/PHP/&#8221; and LoadModule php5_module &#8220;C:/PHP/php5apache2_2.dll&#8221;</li>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2007/08/07/php-mysql-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
