<?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>Random Musings&#187; drupal</title> <atom:link href="http://www.nslms.com/category/software/drupal/feed/" rel="self" type="application/rss+xml" /><link>http://www.nslms.com</link> <description></description> <lastBuildDate>Wed, 06 Jul 2011 20:47:34 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>Web development environment &#8211; &#8220;On The Go&#8221;</title><link>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/#comments</comments> <pubDate>Tue, 07 Apr 2009 19:56:52 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[drupal]]></category> <category><![CDATA[php]]></category> <category><![CDATA[Software Development]]></category> <category><![CDATA[cygwin]]></category> <category><![CDATA[eclipse]]></category> <category><![CDATA[freeagent go]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[portable]]></category> <category><![CDATA[seagate]]></category> <category><![CDATA[web development]]></category> <category><![CDATA[webdev]]></category> <category><![CDATA[xampp]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=70</guid> <description><![CDATA[Over the past few weeks I&#8217;ve been spending most of my spare time developing a couple of web sites.  These sites are based on the Drupal CMS written in PHP.  And I&#8217;ve taken a bit of a crash course in Drupal module design. When I set out developing these, I faced a challenge that I&#8217;d been aware [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F04%2F07%2Fweb-development-environment-on-the-go%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F04%2F07%2Fweb-development-environment-on-the-go%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>Over the past few weeks I&#8217;ve been spending most of my spare time developing a couple of web sites.  These sites are based on the Drupal CMS written in PHP.  And I&#8217;ve taken a bit of a crash course in Drupal module design.</p><p>When I set out developing these, I faced a challenge that I&#8217;d been aware of, but managed to avoid in the past.  How do I work on these projects in a predictable, constant environment, and still bring my code with me to work on my home machine, work machine, laptop, and anything else I happen to sit down in front of?</p><p>This blog post is about how I&#8217;ve accomplished this so far.  Read more after the break&#8230;</p><h2><span
id="more-70"></span>Portable Storage Device</h2><p>Your first inclination will probably be to install these tools on a USB thumb drive that you can easily store in your pocket.  And you&#8217;d be in good company, this was my first choice too.  However, after getting everything going, I quickly realized that it simply wasn&#8217;t fast enough.  Others have reported different results, and a lot has to do with the particular device, and the file system (NTFS is best).</p><p>That said, I chose to go a different route, with fewer unknowns, and picked up a <a
href="http://freeagent.seagate.com/en-us/hard-drive/portable-hard-drive/Free-Agent.html">Seagate FreeAgent Go 250GB USB harddrive</a>.  I picked it up with a docking port from our local Costco for $80 and it eliminates concerns I had about performance.</p><h2><a
name="File_Structure">File Structure</a></h2><p>Throughout the rest of this article, I&#8217;m going to refer to files in my file structure, so I may as well show it to you so that these references can make sense.  This probably isn&#8217;t the best layout, but it&#8217;s what works for me.</p><ul><li>FreeAgent Go Root<ul><li>ampp<ul><li>lampp</li><li>wampp</li><li>shared<ul><li>htdocs<ul><li>&lt;code&gt;</li></ul></li><li>mysql<ul><li>data<ul><li>&lt;databases&gt;</li></ul></li></ul></li></ul></li></ul></li><li>Portable<ul></ul></li><li>cygwin</li><li>libs<ul><li>java-runtime<ul><li>jre1.6.0_06</li></ul></li></ul></li><li>Program Files<ul></ul></li><li>7-ZipPortable</li><li>eclipse</li><li>FirefoxPortable</li><li>junction</li><li>Rapidsvn</li><li>soapui-2.5.1</li></ul></li></ul><h2>Foundation (AMPP)</h2><p>The first thing we&#8217;re going to needed is a good Apache, MySQL, PHP setup.  For this I did some quick googling and stumbled upon XAMPP.  This is an Apache Friends project that packages all the server side components I need.  You can check them out, and download it over at their <a
href="http://www.apachefriends.org/en/xampp.html">site</a>.</p><p>I just downloaded the zip file, and extracted it to my drive at \ampp\wampp.  If you don&#8217;t unzip this project to the root of your device, you&#8217;ll need to run the &#8220;setup_xampp.bat&#8221; batch script supplied.</p><h2>Shared Source &amp; Database Files</h2><p>For the sake of organization, and the ability to run this system on both Windows and Linux boxes (see notes below about linux), I&#8217;m keeping my htdocs and MySQL database files outside of the normal directory structure of the XAMPP installation.</p><p>See my <a
href="#File_Structure">File Structure</a> above..</p><p>This way all of the web files for my individual websites and projects go in the &#8220;htdocs&#8221; directory, while the database data files go in the &#8220;mysql\data&#8221; directory, making them easy to find.</p><p>Of course, this presents a problem since the XAMPP install won&#8217;t be looking in those directories for the databases and code.  So, to solve this I&#8217;ve written another small batch script which lives in the &#8220;shared&#8221; directory.  This script uses the microsoft system tool <a
href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx">Junction.exe</a> to create links of my shared directories in the location that XAMPP is looking.  The junction.exe file is in an &#8220;Installers&#8221; directory on the drive, though I should probably move it somewhere more logical.  Here&#8217;s the script that deletes old junctions, and creates new ones.  You&#8217;ll want to run this when you move from computer to computer, since the drive letter of the USB drive will likely change, and the junctions are to absolute paths.  I put this file in \ampp\shared and it uses relative paths, so that&#8217;s important.</p><h4>refresh-junctions.bat</h4><p>[text toolbar="false"]for /d %%A in (htdocs\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -d &quot;..\xampp\%%A&quot;<br
/> for /d %%A in (htdocs\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -s &quot;..\xampp\%%A&quot; &quot;%%A&quot;</p><p>for /d %%A in (mysql\data\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -d &quot;..\xampp\%%A&quot;<br
/> for /d %%A in (mysql\data\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -s &quot;..\xampp\%%A&quot; &quot;%%A&quot;<br
/> [/text]</p><p>The requirement here of course is that you always create new sites by creating a directory in \ampp\shared\htdocs, and that any time you create a new database, you must move it&#8217;s directory from \ampp\wampp\mysql\data\&lt;database&gt; to \ampp\shared\mysql\data\&lt;database&gt; then re-run the refresh-junctions.bat script while the MySQL server is not running.  But it&#8217;s a fairly workable solution.</p><h2>Integrated Development Environment (IDE)</h2><p>Okay, so we&#8217;ve got a nice predictable, repeatable hosting environment.  Now to  write some code!</p><p>My personal choice of IDE is Eclipse with the PHP Development Tools (PDT).  Eclipse is by it&#8217;s nature portable since it&#8217;s a Java application, and the installation for the PDT is just to unzip it to a drive.  There are a couple of pitfalls though, and here&#8217;s what I&#8217;ve done to overcome them.</p><p>First, since Eclipse does require the Java runtime you have two choices.</p><ol><li>Make sure that a current JVM is installed on any machine you intend to run your portable environment on.</li><li>Carry a copy of the JVM with you!</li></ol><p>I chose #2, and used instructions found <a
href="http://www.jonlee.ca/how-to-run-eclipse-or-aptana-from-usb-drive/" target="_blank">here</a> to do it.  Basically, store a copy of the JVM on your disk and edit the Eclipse startup batch script to use your portable copy.  In my case, the JVM is in the Portable/libs/java-runtime directory as shown in my <a
href="#File_Structure">File Structure</a> above.</p><p>Secondly, I thought it would be a good idea to just store my workspace on the portable drive as well, so I could keep all my settings with me.  Thus far I haven&#8217;t found an elegant way to do this, since it apparently uses absolute paths for projects.  So instead I keep a workspace on each system I work on that has the settings.  I hope to find a better solution to this, and if I do I&#8217;ll post it here.</p><h2>Portable Firefox Browser &amp; Plugins</h2><p>Alright, so now we&#8217;ve got a web server to show our code, a nice IDE to write code in.  What we need is a predictable way to view it all.  You could install your favorite browser on every computer you interact with, or you could bring it with you!  In my case, Firefox is my very favorite browser so I used <a
href="http://portableapps.com/apps/internet/firefox_portable" target="_blank">Firefox Portable</a> so that I can take it and all my configuration preferences as well as Firefox Add-Ons with me.  My core set of Add-Ons which I find invaluable are..</p><ul><li><a
href="http://getfirebug.com/" target="_blank">Firebug</a></li><li><a
href="https://addons.mozilla.org/en-US/firefox/addon/35" target="_blank">IE View</a></li><li><a
href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer</a></li></ul><h2>Portable *NIX tools with Cygwin</h2><p>So we&#8217;ve written some code in our portable IDE, we&#8217;ve tested it out using our portable web server and Firefox browser and we&#8217;re satisfied with the results, and want to upload them to our production server.  My very favorite method of doing so is over RSYNC so I transfer only what&#8217;s changed, and it&#8217;s secure.  In order to do that, I usually use cygwin.</p><p>On the surface it seems like it&#8217;d be easy to just install cygwin to a directory on your portable drive.  And in part, it is.  You can simply install to that directory, and you&#8217;re all set.  Problem is as soon as you move it to another computer, and that computer assigns your drive a different drive letter, everything breaks down real quick.  Some quick google searching revealed a way to make this work.  I had to make some minor tweaks in order to fit within my <a
href="#File_Structure">File Structure</a> but you can find the inspiration for my changes <a
href="http://www.dam.brown.edu/people/sezer/software/cygwin/" target="_blank">here</a>.</p><p>My changes are to the X.bat and uninstall.bat files.  I instead called them ~cygwin-install-X.bat and ~cygwin-uninstall.bat and put them in the cygwin install directory at Portable\cygwin.  Here they are.</p><h4>~cygwin-install-X.bat</h4><p>[text]for /F %%A in (&#8216;cd&#8217;) do set WD=%%A<br
/> bin\mount -m | bin\sed s/mount/&quot;%WD%\/bin\\/mount&quot;/ &gt; tmp\mount.log<br
/> bin\umount -c<br
/> bin\umount -A<br
/> bin\mount -bfu %WD%/ /<br
/> bin\mount -bfu %WD%/bin /usr/bin<br
/> bin\mount -bfu %WD%/lib /usr/lib</p><p>set path=%path%;%WD%\bin;%WD%\usr\X11R6\bin<br
/> start bin\rxvt.exe -title &quot;&quot; -bg &quot;#fafad2&quot; -fg &quot;#000040&quot; -color10 green4 -color14 brown -fn &quot;Lucida Console-14&quot; -geometry 80&#215;58+0+0 -sl 4000 -sr -tn rxvt -e /bin/bash &#8211;login -i<br
/> set DISPLAY=localhost:0.0<br
/> run usr\X11R6\bin\XWin -multiwindow -emulate3buttons 200<br
/> [/text]</p><h4>~cygwin-uninstall.bat</h4><p>[text]bin\umount -c<br
/> bin\umount -A<br
/> bin\bash  tmp\mount.log<br
/> bin\rm    tmp\mount.log<br
/> [/text]</p><h2>Portable Source Control (SVN)</h2><p>Lastly, you&#8217;ll probably want to submit your changes to some sort of source control.  In my case I&#8217;m using Concurrent Versioning (CVS) or Subversion (SVN) for my source control, and both are handled nicely by the portable version of <a
href="http://portableapps.com/node/13470" target="_blank">RapidSVN</a>.</p><p>So there you have it, my end to end solution for doing web development from a portable flash drive on any windows box you happen to come across.  My original intention was to be able to just plug this drive into any windows OR linux box and work, but I have some kinks to work out with the linux solution.  Watch this space for more on that as I develop it.</p><p>Hopefully this helps you if you&#8217;re trying to setup a nice portable webdev environment!</p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Web%20development%20environment%20-%20%22On%20The%20Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Drupal Flickr Module.  Now with URLs!</title><link>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/#comments</comments> <pubDate>Fri, 27 Mar 2009 17:04:27 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[drupal]]></category> <category><![CDATA[php]]></category> <category><![CDATA[flickr]]></category> <category><![CDATA[flickr.urls.getUserPhotos]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[urls]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=67</guid> <description><![CDATA[Okay, so I&#8217;ve been a bit preoccupied with a couple projects which have slowed my efforts at blogging etc. In both cases, I&#8217;ve been working on websites that leverage the PHP based Drupal CMS.&#160; One of those projects is over at http://www.chasejarvisshoeproject.com.&#160; That site is basically a small community forum for some folks that are [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F03%2F27%2Fdrupal-flickr-module-now-with-urls%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F03%2F27%2Fdrupal-flickr-module-now-with-urls%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>Okay, so I&#8217;ve been a bit preoccupied with a couple projects which have slowed my efforts at blogging etc.</p><p>In both cases, I&#8217;ve been working on websites that leverage the PHP based Drupal CMS.&nbsp; One of those projects is over at <a
href="http://www.chasejarvisshoeproject.com">http://www.chasejarvisshoeproject.com</a>.&nbsp; That site is basically a small community forum for some folks that are sending a pair of shoes around the world, and taking pictures of them in various locations and situations.&nbsp; Pretty cool.&nbsp; The result of this effort is a Flickr photo pool and a good time.</p><p>So, of course a website devoted to a group on Flickr, is going to require some integration with Flickr.&nbsp; Enter the <a
href="http://drupal.org/project/flickr">Drupal Flickr Module</a>.&nbsp; When I&nbsp;started using it, this module was still in either an alpha, or beta (can&#8217;t seem to remember) and has released it&#8217;s 1.0 as of the 25th of March.&nbsp; Throughout the time I&#8217;ve been using it however, there&#8217;ve been a few functions of the Flickr API which I&nbsp;needed, and the module didn&#8217;t support.&nbsp; Those were.</p><ul><li><a
href="http://flickr.com/services/api/flickr.groups.pools.getPhotos.html">flickr.groups.pools.getPhotos</a></li><li><a
href="http://flickr.com/services/api/flickr.urls.getGroup.html">flickr.urls.getGroup</a></li><li><a
href="http://flickr.com/services/api/flickr.urls.getUserPhotos.html">flickr.urls.getUserPhotos</a></li></ul><p>Since the framework of the module did the hard work of making the calls, it was easy to write my own methods which performed these Flickr API&nbsp;functions for me.&nbsp; And as the module developers released new versions, I&nbsp;just copy/pasted my code back into the new file, and went about my business.</p><p>Well when 1.0 was released, I&nbsp;took a closer look.&nbsp; It turns out they&#8217;d implemented the call to get photos from a group pool, but still nothing for the URL&#8217;s.&nbsp; So I&nbsp;figured I&#8217;d contribute and write a patch for the two calls I&nbsp;was still in need of.&nbsp; And that, is what you see here.</p><pre lang="diff">
569,597d568
< }
<
< /**
<  * @param $nsid
<  *   nsid of the group whose pool url will be returned
<  * @return
<  *   The URL portion of the response from the flickr method flickr.urls.getGroup
<  */
< function flickr_urls_get_group($nsid)
< {
<   $response = flickr_request('flickr.urls.getGroup', array('group_id' => $nsid));
< if($response)
<     return $response['group']['url'];
<
<   return FALSE;
< }
<
< /**
<  * @param $nsid
<  *   nsid of the user whose photostream url will be returned
<  * @return unknown_type
<  */
< function flickr_urls_get_user_photos($nsid)
< {
<   $response = flickr_request('flickr.urls.getUserPhotos', array('user_id' => $nsid));
< if($response)
<     return $response['user']['url'];
<
<   return FALSE;
</pre><p>As you can see, pretty basic but I&nbsp;figured I'd contribute.&nbsp; I&nbsp;posted this as a feature request/issue over on the Flickr Module's <a
href="http://drupal.org/node/414096">issue queue</a>, but have yet to receive a response.&nbsp; If nothing else, I&nbsp;can use this to patch the next version.&nbsp; Hopefully it helps someone else as well.</p> </pre><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal%20Flickr%20Module.%20%20Now%20with%20URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
