<?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>Linux-Girl.com &#187; Code</title>
	<atom:link href="http://www.linux-girl.com/category/php-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linux-girl.com</link>
	<description>The web according to girl.</description>
	<lastBuildDate>Sun, 28 Mar 2010 15:44:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Sed sed bash &#8211; Writing Simple Bash Scripts</title>
		<link>http://www.linux-girl.com/php-code/sed-sed-bash-writing-simple-bash-scripts/</link>
		<comments>http://www.linux-girl.com/php-code/sed-sed-bash-writing-simple-bash-scripts/#comments</comments>
		<pubDate>Fri, 29 May 2009 21:09:32 +0000</pubDate>
		<dc:creator>Asia</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.linux-girl.com/?p=116</guid>
		<description><![CDATA[I manage a lot of websites and servers, and there&#8217;s nothing more time consuming than fulfilling the request of a random client who wants to make changes to their website or add a new web page. Thankfully I happen to be a Linux Network Administrator and have access to every delicious part of many Linux<a href="http://www.linux-girl.com/php-code/sed-sed-bash-writing-simple-bash-scripts/"><br/> read more..</a>]]></description>
			<content:encoded><![CDATA[<p>I manage a lot of websites and servers, and there&#8217;s nothing more time consuming than fulfilling the request of a random client who wants to make changes to their website or add a new web page. Thankfully I happen to be a Linux Network Administrator and have access to every delicious part of many Linux servers to assist me in making this process easy and stress free. </p>
<p>Sure! I can hire some guy out of India to manage these menial tasks. But why? With some simple bash scripting and a little bit of Sed knowledge &#8211; I can create multiple web pages within a minute. Here&#8217;s my little secret:</p>
<p>With some simple bash scripting, I create a simple template copied from a content page on the website. Replace content with specific tags (i.e. Change the page title to _TITLE_) this way I can determine parts of that page I want to overwrite with my bash script. Once I have every part of the template tagged, I write my bash script.</p>
<p>#/bin/bash<br />
echo Page Title<br />
read TITLE<br />
echo File Name<br />
read FILENAME</p>
<p>#copy over the template<br />
cp template.php $FILENAME<br />
echo Writing $FILENAME Done.</p>
<p>#replace those tags<br />
sed -i &#8220;s/_TITLE_/$TITLE&#8221; $FILENAME<br />
echo Writing new title to $FILENAME done</p>
<p>echo New Web Page $FILENAME created<br />
echo Done.</p>
<p>save the file<br />
chmod +x your script<br />
./run your script</p>
<p>That&#8217;s it&#8230; You can see how easy it is to utilize the above script to create new web pages quick and easy. It saves me a ton of time with older websites. Hope you like it!</p>
<p><a href="http://www.amazon.com/Canonical-890655001213-Ubuntu-8-10/dp/3937514775%3FSubscriptionId%3D02E5W5871AJF7PMMMS82%26tag%3Dlancas0d-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D3937514775"><img src="http://ecx.images-amazon.com/images/I/41F7FsVEUuL._SL160_.jpg" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux-girl.com/php-code/sed-sed-bash-writing-simple-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Power of Vim and Fast Search Friendly HTML and Code</title>
		<link>http://www.linux-girl.com/php-code/the-power-of-vim-and-fast-search-friendly-html-and-code/</link>
		<comments>http://www.linux-girl.com/php-code/the-power-of-vim-and-fast-search-friendly-html-and-code/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 18:50:03 +0000</pubDate>
		<dc:creator>Asia</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.linux-girl.com/the-power-of-vim-and-fast-search-friendly-html-and-code/</guid>
		<description><![CDATA[I&#8217;ve been a fan of Vim since the mid 90&#8242;s, it all started out of pure frustration with PERL and CGI Scripts. I knew HTML &#8211; but who didn&#8217;t? It was the easiest thing to learn, but ugh PERL and CGI Scripting was just a nightmare. I gained my first client, and had it not<a href="http://www.linux-girl.com/php-code/the-power-of-vim-and-fast-search-friendly-html-and-code/"><br/> read more..</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a fan of Vim since the mid 90&#8242;s, it all started out of pure frustration with PERL and CGI Scripts. I knew HTML &#8211; but who didn&#8217;t? It was the easiest thing to learn, but ugh PERL and CGI Scripting was just a nightmare. I gained my first client, and had it not been for pre-scripted CGI&#8217;s by other developers and some patience, I would never have made it through to today. CGI Scripting was a whole different language, one that required a lot of patience and logical thinking &#8211; but the downloads, text edits on notepad, upload, change permissions, log reviews, notepad to make changes, FTP again &#8211; recycle, rinse, repeat. It drove me insane and much worse, it took forever to debug anything.</p>
<p>After moving to Hawaii back in 2000, I was just learning the basics of Linux Server Management and had very little knowledge of Vim or it&#8217;s existence. But I could certainly find my way &#8220;somewhat&#8221; around a Linux Box &#8211; go me! I landed a web developers job at a travel company &#8211; <a href="http://travel-hawaii.com/">Travel Hawaii </a>, my job was to assist the owner and lead programmer with web graphics and design &#8211; mostly HTML and basic CGI installations. I started working alongside Chris Bopp, the lead programmer, Bopp (as I call him) is perhaps one of the most sane creatures there are in this world. Here&#8217;s a guy who exerts the geek persona to the nth degree. The man could solve any programming issue that was directed to him, you name it &#8211; he had the answer &#8211; or would find it within minutes.</p>
<p>Chris taught me everything I didn&#8217;t know about Linux, I still occasionally run back to Chris for assistance, mostly because, he&#8217;s just that smart! During this time, Dreamweaver had entered the market, <a href="http://www.daggle.com">Danny Sullivan</a> had begun his first or second SEO conference back in the old days when <a href="http://www.searchenginewatch.com">Search Engine Watch</a> was king. I remember the day John, the owner at Travel Hawaii handed me a big white binder he had gotten from one of Danny&#8217;s conferences &#8211; It was my bible I was told. Every secret there was to landing #1 listings on search engines was found in that binder &#8211; ah the good old days. I utilized Dreamweaver for everything &#8211; basic HTML the WYSIWYG interface was phenomenal. But again the delays of FTP, change permissions, errors in code with no real way to determine what line in the code was producing the actual errors. It reported line 26 but if you utilized SSI or PHP includes, there just wasn&#8217;t a way to really find the errors, so frustration continued.</p>
<p>Then Bopp introduced me to Vim and even today I wonder, how the hell did I get through the past without it. For those of you who still utilize basic notepad and other fancy doohickies to mark up your code &#8211; I pity you!! Vim is the answer to every coders dream. What used to take me 4 hours, now takes me 30 minutes. The simple find and replace commands, easy access to the shell itself, full utilization of primary keyboard keys and the best darn WYSIWYG  &#8220;your browser&#8221; makes it unbeatable for developers. With my little experience using &#8220;less&#8221; and &#8220;more&#8221; and with the power of &#8220;grep&#8221; and &#8220;fgrep&#8221; learning Vim was easy.</p>
<p>PHP Code became easier to manage, with the ability to quickly find beginning and ending brackets of code ( { and } ). CGI Scripts were similarly easier to debug, a simple refresh of the browser would help me determine where the errors were in the code. Whether I needed to delve further into the server such as permissions or was I missing a simple quotation mark. Regardless of the problem it took mere seconds to fix and I was well on my way to my next project.</p>
<p>The best thing about Vim is the formatting, I&#8217;m able to format code and HTML with simple commands and eventually these commands came as easy to me as typing &#8220;ASDF JKL;&#8221;. CSS Stylesheets are easier to compose and HTML became less of a hindrance with my Vim skills &#8211; anything code, even the new AJAX and JavaScript libraries are easy to debug through Vim. Scriptkiddies &#8211; can stick to dreamweaver and frontpage, I&#8217;m going to keep my old school Vim and produce more work in less time. That way I can do what I enjoy doing most, shop to my hearts content.</p>
<p>To give you an idea of how fast I work with Vim and SSH &#8211; last week I redid a entire website of 100,000+ webpages with new CSS and some additional code. I had the entire site completely upgraded and redone with fresh CSS stylesheets, new Google Sitemaps, new code to render MySQL queries faster and all under 4  work hours.</p>
<p>My design team sends me a brand new PSD file, and I am able to write up the CSS, HTML and supporting PHP scripts, as well as JavaScript all within minutes. Now, Dreamweaver can do this as well &#8211; but you will still have to clean out that code to make it search friendly. My way, is simple and easy and the changes are made directly to the server and web host environment with no hiccups to stop the progress. I can minimize mark up to work with different browsers on the fly and never miss a beat. I don&#8217;t work on test directories, everything is done and pushed live within seconds. Can you say the same with your current style of code? I never trust software that promises to make Search Friendly Websites, I do however trust the simplicity of basic text editing through Vim. Happy Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux-girl.com/php-code/the-power-of-vim-and-fast-search-friendly-html-and-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax: PHP and Dojo Sending and Receiving Form Data</title>
		<link>http://www.linux-girl.com/php-code/ajax-php-and-dojo-sending-and-receiving-form-data/</link>
		<comments>http://www.linux-girl.com/php-code/ajax-php-and-dojo-sending-and-receiving-form-data/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 16:33:54 +0000</pubDate>
		<dc:creator>lani</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.linux-girl.com/ajax-php-and-dojo-sending-and-receiving-form-data/</guid>
		<description><![CDATA[Messing around with Dojo has been great fun, sometimes frustrating with the latest 0.9 Dojo release and the lack of documentation. But, after much picking at my script, I was able to create simple forms, send them and receive information through Dojo&#8217;s xhrGet function. Include the following code within the &#60;head> and &#60;/head> tags of<a href="http://www.linux-girl.com/php-code/ajax-php-and-dojo-sending-and-receiving-form-data/"><br/> read more..</a>]]></description>
			<content:encoded><![CDATA[<p>Messing around with Dojo has been great fun, sometimes frustrating with the latest 0.9 Dojo release and the lack of documentation. But, after much picking at my script, I was able to create simple forms, send them and receive information through Dojo&#8217;s xhrGet function. </p>
<p>Include the following code within the &lt;head> and &lt;/head> tags of your document. </p>
<p>&lt;code><br />
&lt;script type=&#8221;text/javascript&#8221; src=&#8221;/path to dojo/dojo.js&#8221; djConfig=&#8221;parseOnLoad:true&#8221;>&lt;/script><br />
&lt;/code></p>
<p>Include the form widgets you would like to use. I have the basics below:</p>
<p>&lt;code><br />
&lt;script type=&#8221;text/javascript&#8221;><br />
    dojo.require(&#8220;dijit.form.TextBox&#8221;);<br />
    dojo.require(&#8220;dijit.form.CheckBox&#8221;);<br />
    dojo.require(&#8220;dijit.form.Button&#8221;);<br />
&lt;/code></p>
<p>Don&#8217;t forget the parser</p>
<p>&lt;code><br />
    dojo.require(&#8220;dojo.parser&#8221;);<br />
&lt;/code></p>
<p>Now for our main function<br />
&lt;code><br />
    function getFormData() {<br />
        var kw = {<br />
          url: &#8220;/path to your php page handler/pagename.php&#8221;, //Explicit Path &#8211; leaving out the leading / seemed to break the code<br />
          load: function(data){<br />
          dojo.byId(&#8216;formdata&#8217;).innerHTML = data; // where do you want your data to be returned.<br />
          },<br />
          error: function(data){<br />
          alert(&#8220;An error occurred: &#8221; + data);  //in case of error<br />
        },<br />
        timeout: 2000,<br />
        form: &#8220;login&#8221; //what form<br />
       };<br />
        dojo.xhrGet(kw);<br />
    }<br />
&lt;/code></p>
<p>A Simple Form:</p>
<p>&lt;code><br />
&lt;div id=&#8221;formdata&#8221;><br />
&lt;form name=&#8221;login&#8221; id=&#8221;login&#8221; method=&#8221;GET&#8221;><br />
&lt;label for &#8220;user_name&#8221;>User Name&lt;/label><br />
&lt;input id=&#8221;user_name&#8221; type=&#8221;text&#8221; name=&#8221;user_name&#8221;<br />
                    dojoType=&#8221;dijit.form.TextBox&#8221; /></p>
<p>&lt;label for &#8220;password&#8221;>Password&lt;/label><br />
&lt;input id=&#8221;password&#8221; type=&#8221;password&#8221; name=&#8221;password&#8221;<br />
                    dojoType=&#8221;dijit.form.TextBox&#8221; /></p>
<p>&lt;button dojoType=&#8221;dijit.form.Button&#8221; onclick=&#8221;sendFormData()&#8221;><br />
                    Submit<br />
                    &lt;/button><br />
&lt;/form><br />
&lt;/div><br />
&lt;/code></p>
<p>Create your PHP Page:</p>
<p>&lt;code><br />
&lt;?<br />
echo &#8220;Hello &#8220;.$_REQUEST[user_name].&#8221;. Your password is: &#8220;.$_REQUEST[password].&#8221;;<br />
?><br />
&lt;/code><br />
Complete your form and click submit. </p>
<p><a href="http://linux-girl.com/code/sendform.php" target="_BLANK">Demo Script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux-girl.com/php-code/ajax-php-and-dojo-sending-and-receiving-form-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expanding the AJAX and PHP 30 Second Tutorial Code</title>
		<link>http://www.linux-girl.com/php-code/expanding-the-ajax-code/</link>
		<comments>http://www.linux-girl.com/php-code/expanding-the-ajax-code/#comments</comments>
		<pubDate>Mon, 16 Oct 2006 13:40:15 +0000</pubDate>
		<dc:creator>lani</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.linux-girl.com/2006/10/16/expanding-the-ajax-and-php-30-minute-tutorial-code/</guid>
		<description><![CDATA[Recently I uploaded an online golf course teetime booking center for a client. The system, allows users to visualize their tee time itinerary as they progress through their booking. A visitor simply selects a golf course and tee time as well as the number of rounds they wish to purchase, add it to their itinerary<a href="http://www.linux-girl.com/php-code/expanding-the-ajax-code/"><br/> read more..</a>]]></description>
			<content:encoded><![CDATA[<p>Recently I uploaded an online <a target="_blank" href="https://www.lasvegasgolfadventures.com/las_vegas_tee_times.php">golf course teetime booking center</a> for a client. The system, allows users to visualize their tee time itinerary as they progress through their booking. A visitor simply selects a golf course and tee time as well as the number of rounds they wish to purchase, add it to their itinerary and continue on, whether they wish to add more <a target="_blank" href="http://www.lasvegasgolfadventures.com/golf_courses.php">golf courses</a> or just <a target="_blank" href="https://www.lasvegasgolfadventures.com/las_vegas_tee_times.php">book their tee times</a>.</p>
<p>When it comes to PHP and Perl I can probably code just about any web software out there, but in this case, I wanted to add some AJAX and JavaScript fun and build a nice little web gadget and so entered my AJAX research. I browsed through several websites offering AJAX and PHP tutorials, and finally found one called the &#8220;<a target="_blank" href="http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html">30 Second AJAX Tutorial</a>&#8220;, I&#8217;m pretty sure that almost everyone has attempted this tutorial themselves. The tuturial was pretty basic, and offered the AJAX and JavaScript as well as supporting PHP code but, beware, copy the AJAX direct from the demo code, as the code copy on the tutorial itself isn&#8217;t working.</p>
<p>I sat for a few minutes, looking through the magic code. It was such a neat little gadget, and I wondered about the many possible gadgets and fun I could create. I received a call from a client that same morning, who asked if I could redo their online booking engine for <a target="_blank" href="https://www.lasvegasgolfadventures.com/las_vegas_tee_times.php">Las Vegas Golf Tee Times</a>. Alright a new project!</p>
<p>I began my little gadget by first researching a bit more on the IE and FireFox issues behind AJAX, and found additional AJAX code that supported both browsers &#8211; google at work. (Love it!)</p>
<p>function createXMLHttpRequest() {<br />
var ua; if(window.XMLHttpRequest) {<br />
try { ua = new XMLHttpRequest(); }<br />
catch(e) { ua = false; }<br />
} else if(window.ActiveXObject) {<br />
try { ua = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />
} catch(e) { ua = false; } }<br />
return ua;<br />
}</p>
<p>Chucked out the 30 second tutorial XMLHttpRequest function and replaced it with the one above.  Okay, so now I have my cross-browser AJAX connection and some additional code. I needed more&#8230; So I pulled out the php booking class I had for the previous booking system, and created a new php page to utilize these classes and return the response through AJAX.  Here&#8217;s a snippet of the booking engine class:</p>
<p>class bookings {<br />
function dbc() {<br />
$cnx=mysql_connect(blah, blah,blah);<br />
$sdb=mysql_select_db(blah,$cnx);<br />
}<br />
#The magic PHP get rate sql query<br />
function getRate($item) {<br />
$this->dbc();<br />
$arrs[name]=$arrs[rate]=array();<br />
$sql = &#8220;select golfCourse, rate from table where id=&#8217;&#8221;.$item.&#8221;&#8216;&#8221;;<br />
$dbi = mysql_query($sql) or die(mysql_error());<br />
$r = mysql_fetch_object($dbi);<br />
array_push($arrs[name],$r->golfCourse);<br />
array_push($arrs[rate],$r->rate);<br />
return $arrs;<br />
}<br />
#Add in some simple PHP Session assignments<br />
function recordSessions($vars) {<br />
if(!$_SESSION[mycart]) {<br />
$_SESSION[mycart] = array();<br />
}<br />
list($item,$sdate,$edate,$nbr) = explode(&#8220;|&#8221;,$vars);<br />
$itemarray=$this->getRate($item);<br />
$string = $itemarray[name][0].&#8221;|&#8221;.$itemarray[rate][0].&#8221;|&#8221;.$teetime.&#8221;|&#8221;.$date.&#8221;|&#8221;.$qty;<br />
array_push($_SESSION[mycart],$string);<br />
}<br />
#Let&#8217;s add in more simple functions<br />
function getTotal($nbr,$rate) {<br />
return $nbr*$rate;<br />
}<br />
}</p>
<p>I won&#8217;t get complicated on the PHP code this is just the basics to get you started. I now have my simple booking engine class set up in PHP and I can now connect to the server through both IE and Firefox, now I need to do more magic and get this thing rolling.</p>
<p>I went back to the 30 second ajax tutorial and added in the rest of the JavaScript and AJAX functions to my .js file, if you notice, I didn&#8217;t use the 30 second tutorial code in it&#8217;s whole, I have this issue with using JavaScript and prefer to do all parsing in PHP, all I want JS to do, is return and print the string to my web page and nothing  more</p>
<p>//create the connection<br />
var req = createXMLHttpRequest();<br />
//send the request to the server PHP file<br />
function sndReq() {<br />
var action = getElementById(&#8216;golfCourse&#8217;).value;<br />
var action = action + &#8216;|&#8217;+getElementById(&#8216;date&#8217;).value;<br />
var action = action + &#8216;|&#8217;+getElementById(&#8216;teetime&#8217;).value;<br />
var action = action + &#8216;| +getElementById(&#8216;golfers&#8217;).value;<br />
req.open(&#8216;get&#8217;, &#8216;phpRequestPage.php?action=&#8217;+action);<br />
req.onreadystatechange = handleResponse;<br />
req.send(null);<br />
}<br />
//handle the response from the server<br />
function handleResponse() {<br />
if(req.readyState == 4){<br />
var response = req.responseText;<br />
document.getElementById(&#8216;itinerary&#8217;).innerHTML = response;<br />
}</p>
<p>That&#8217;s all the code I needed (sans the security and validation.) I built a simple webform requesting the user to select a golf course, the date and time and the number of tee-times he will need. Aside the form (Think CSS 2 columns) I initiated a div tag and assigned it an ID &#8220;itinerary&#8221;.</p>
<p>&lt;div id=&#8221;itinerary&#8221;></p>
<p>&#8230;gave the form a method of &#8220;get&#8221;</p>
<p>&lt;form method=&#8221;get&#8221;></p>
<p>&#8230;assigned the select drop boxes with ID&#8217;s I need the JavaScript to pull from using getElementByID()</p>
<p>&lt;select id=&#8221;golfCourse&#8221;> (example. do the same for all your form elements id=&#8221;whatever&#8221;)</p>
<p>The submit button is simply a button</p>
<p>&lt;input type=&#8221;button&#8221; name=&#8221;book_button&#8221; value=&#8221;add to itinerary&#8221; id=&#8221;book_button&#8221;<br />
onclick=&#8221;javascript:sndReq();&#8221; /></p>
<p>Great! I now have working AJAX, JavaScript and a PHP Class to handle things on the back end, it&#8217;s now time to pull them alltogether. So I open a new document and named it phpRequestPage.php and worked in some lines:</p>
<p>#call up the PHP Class<br />
$go = new class bookings;<br />
$go ->recordSessions($_REQUEST[action]); #all the parsing done and session created</p>
<p>Some  basic looping thrugh the sessions</p>
<p>for($i=0; $i     list($item,$rate,$teetime,$date,$qty) = explode(&#8220;|&#8221;,$_SESSION[mycart][$i]);<br />
echo &#8220;&lt;div class=&#8217;itinHeader&#8217;>$golfCourse&lt;/div>\n&#8221;;<br />
echo &#8220;&lt;div class=&#8217;itin&#8217;>Date: $date&lt;/div>\n&#8221;;<br />
echo &#8220;&lt;div class=&#8217;itin&#8217;>TeeTime: $teetime&lt;/div>\n&#8221;;<br />
echo &#8220;&lt;div class=&#8217;itin&#8217;>Rounds: $qty&lt;/div>\n&#8221;;<br />
echo &#8220;&lt;div class=&#8217;itin&#8217;>Total: &#8220;.$go->getTotal($qty,$rate).&#8221;&lt;/div>\n&#8221;;<br />
echo &#8220;&lt;div class=&#8217;clearFix&#8217;>&lt;br/>&lt;/div>\n&#8221;;<br />
}</p>
<p>PHP page returns the above echo&#8217;s to that AJAX, JavaScript function sndReq() which pushes the response to handleResponse() and the magic appears inside the Itinerary div tag.</p>
<p>Using the above scenario&#8217;s you can easily build this booking engine yourself, add in a few more PHP functions to handle deletions and edits support it with more JavaScript and you are all set to go. If you need some help getting through parts of the above code, just drop me a line, I&#8217;ll be happy to point you in the right direction. But please, do not attempt the above without some basic PHP and JavaScript knowledge!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux-girl.com/php-code/expanding-the-ajax-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software and Snippets</title>
		<link>http://www.linux-girl.com/php-code/hello-world/</link>
		<comments>http://www.linux-girl.com/php-code/hello-world/#comments</comments>
		<pubDate>Tue, 19 Sep 2006 15:29:17 +0000</pubDate>
		<dc:creator>lani</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[For web developers who are seeking a way to add a flash photo slide show, this software is exceptional. It&#8217;s PHP based and easy to set up. You can set up your slides to transition in various ways, use zoom and motion to add more interactivity. The website offers complete tutorials as well as sample<a href="http://www.linux-girl.com/php-code/hello-world/"><br/> read more..</a>]]></description>
			<content:encoded><![CDATA[<p>For web developers who are seeking a way to add a flash photo slide show, this software is exceptional. It&#8217;s PHP based and easy to set up. You can set up your slides to transition in various ways, use zoom and motion to add more interactivity. The website offers complete tutorials as well as sample code &#8211; I suggest using it as you might miss some of the really neat things this software can do.  <a href="http://www.maani.us/slideshow/" target="_blank">click here for PHP/SWF Slideshow</a>.</p>
<p>Here&#8217;s a neat little snippet, I often use this php code to display images in one specific width and calculate the height in proportion to the width. Works great with jpg&#8217;s but rendering is a bit off with gif&#8217;s.  I use it to expand images or to display thumbnails.</p>
<p>Here&#8217;s an example of where I use it &#8211; <a href="http://www.lasvegasgolfadventures.com/golf_courses.php" target="_blank">Las Vegas Golf Adventures</a> - click on any of the golf courses and over to the right are the photos &#8211; these photos are larger or smaller than the width of 200, but for a more uniform look throughout the website, I use the snippet below and render all images at a width of 200.</p>
<p><!--p<br-->$abswidth = &#8220;150&#8243;; //set the maximum width of the image<br />
$image = &#8220;/path/to/image&#8221;; //the exact path to the image you want to resize<br />
$size = getimagesize($image);<br />
$calc = $size[0]/$abswidth;<br />
$height=floor($size[1] / $calc);</p>
<p>echo &#8220;<img height="1" alt="..." src="http://www.linux-girl.com/$image" width="1" />&#038;lt img src=&#8217;$image&#8217; width=&#8217;$abswidth&#8217; height=&#8217;$height&#8217; alt=&#8221;>&#8221;;<br />
?></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux-girl.com/php-code/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
