<?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>Public MindDrupal</title>
	<atom:link href="http://publicmind.in/blog/category/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://publicmind.in/blog</link>
	<description>Simple and Sophisticated</description>
	<lastBuildDate>Thu, 13 May 2010 23:32:50 +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>Facebook: Bug with URL encoding</title>
		<link>http://publicmind.in/blog/facebook-bug-with-url-encoding/</link>
		<comments>http://publicmind.in/blog/facebook-bug-with-url-encoding/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 05:33:48 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Nitin's Blog]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbsl]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=548</guid>
		<description><![CDATA[Today, while I was working on the URL encoding for the recently released Facebook-style Links module, I realized a bug with Link Attachments feature on Facebook. Before I explain, let us reproduce it: Try to attach the following link on Facebook: http://google.com/search?q=blenders%26pride. This URL actually queries Google for &#8216;blenders&#038;pride&#8217;. Facebook converts/encodes the above URL to [...]]]></description>
			<content:encoded><![CDATA[<p>Today, while I was working on the URL encoding for the recently released <a href="http://publicmind.in/blog/drupal-facebook-link">Facebook-style Links</a> module, I realized a bug with Link Attachments feature on Facebook. Before I explain, let us reproduce it:</p>
<p>Try to attach the following link on Facebook: <a href="http://google.com/search?q=blenders%26pride">http://google.com/search?q=blenders%26pride</a>. This URL actually queries Google for &#8216;blenders&#038;pride&#8217;. Facebook converts/encodes the above URL to <a href="http://google.com/search?q=blenders&#038;pride">http://google.com/search?q=blenders&#038;pride </a> which is not the same as above and queries Google for just &#8216;blenders&#8217;.</p>
<p>So, why Facebook does this? Probably Facebook tries to encode the URL to remove the characters which are not allowed by RFC 3986 and replaces them with their percent encoding. But there are certain characters which should not be encoded, such as &#8216;/&#8217;, &#8216;?&#8217;, &#8216;#&#8217;, &#8216;@&#8217; which are the reserved characters and used as delimiters in the URL. So, it decodes these characters and converts their encoding to the original character which gives rise to the problem. Let us see an example:<br />
<span id="more-548"></span><br />
&#8216;<a href="http://google.com/search?q= %2B">http://google.com/search?q= %2B</a>&#8216; is first encoded to replace unwanted character with their percent encoding, turns into &#8216;http%3A%2F%2Fgoogle.com%2Fsearch%3Fq%3D%20%2B&#8217;. (Note: I assume that already encoded characters are not encoded again in order to reproduce the bug, i.e.%2B does not gets converted to %252B). Then, the reserved characters (/,:,?,=,@,+) must be decoded again, therefore it gets converted to &#8216;<a href="http://google.com/search?q=%20+">http://google.com/search?q=%20+</a>&#8216; which as we see is not the same. It ideally should have been &#8216;http://google.com/search?q=%20%2B&#8217;.</p>
<p>I have already reported it in the bugs on Facebook. I will like to hear your views on URL encoding. Do you consider this as bug? Why does such URLs are not properly formatted at source making lives of developers difficult? Why does URLs with spaces and other disallowed characters exists?</p>
<p>Enjoy.</p>
<p><strong>Related Resources:</strong></p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Percent-encoding">http://en.wikipedia.org/wiki/Percent-encoding</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/facebook-bug-with-url-encoding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drupal: Tutorial for Feeds Image Grabber</title>
		<link>http://publicmind.in/blog/tutorial-for-feeds-image-grabber/</link>
		<comments>http://publicmind.in/blog/tutorial-for-feeds-image-grabber/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 04:45:43 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[fig]]></category>
		<category><![CDATA[imagegrabber]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=529</guid>
		<description><![CDATA[Feeds Image Grabber (FIG) was released on 3rd March, and currently supports the following features: Automatically downloads and attaches image to the node created by Feeds module. Configurable XPath of the desired image location on the webpage of the feed item on per feed basis (using element&#8217;s id or CSS class). Support for FileField Paths module. [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --><a href="http://drupal.org/project/feeds_imagegrabber">Feeds Image Grabber</a> (FIG) was released on 3rd March, and currently supports the following features:</p>
<ol>
<li>Automatically downloads and attaches image to the node created by Feeds module.</li>
<li>Configurable XPath of the desired image location on the webpage of the feed item on per feed basis (using element&#8217;s id or CSS class).</li>
<li>Support for <a href="http://drupal.org/project/filefield_paths">FileField Paths</a> module.</li>
<li>Configurable maximum image size.</li>
<li>Configurable minimum and maximum image resolutions.</li>
</ol>
<p>In this post, I will briefly demonstrate how to configure the settings for FIG to efficiently grab images for feed items.<br />
<span id="more-529"></span><br />
<strong>Image Field Settings:</strong></p>
<p>Feeds module will create nodes from feed-items of content type as chosen in the FeedsNodeProcessor settings. FIG will store the image grabbed in an image field attached to the node of this content type. Therefore, you must add an image field to this content type. For example, if the content type of feed-items is <em>story</em>, you need to go to <em>admin &gt; content types &gt; story &gt; manage fields</em> and add a field of type <em>File</em> and widget <em>Image</em>. (<a href="http://drupal.org/node/609628">http://drupal.org/node/609628</a>)</p>
<p>Configure the settings of the image field, such as extensions, minimum and maximum resolution, maximum size, etc. While grabbing the image, FIG will automatically take into consideration the settings of the image field to which the downloaded image will be mapped.</p>
<p><strong>Mapping Settings:</strong></p>
<p>Now, you must go to the mapping settings for the <em>Node Processor</em> of the <em>Feed Importer </em>and map <em>Item URL (Link) </em>to one of the available imagefields which are appended by &#8220;<em>(FIG)</em>&#8220;.</p>
<div id="attachment_530" class="wp-caption aligncenter" style="width: 692px"><a href="http://publicmind.in/blog/wp-content/uploads/2010/03/target-mappings.jpg"><img class="size-full wp-image-530" title="target-mappings" src="http://publicmind.in/blog/wp-content/uploads/2010/03/target-mappings.jpg" alt="Mapping Settings" width="682" height="427" /></a><p class="wp-caption-text">Mapping for Node Processor</p></div>
<p><strong>Feeds Image Grabber Settings:</strong></p>
<p>After enabling FIG and configuring the above settings, you will see the following additional form whenever you create or edit a feed.</p>
<div id="attachment_532" class="wp-caption aligncenter" style="width: 762px"><a href="http://publicmind.in/blog/wp-content/uploads/2010/03/fig-form.jpg"><img class="size-full wp-image-532 " title="fig-form" src="http://publicmind.in/blog/wp-content/uploads/2010/03/fig-form.jpg" alt="fig-form" width="752" height="453" /></a><p class="wp-caption-text">FIG config form</p></div>
<p>Here is a brief explanation of the available fields:</p>
<ol>
<li>Enable Feeds Image Grabber: As the description says, check this box if you want FIG to download images of the feed items created by this feed.</li>
<li>Search for an image between the tag identified by: It has been explained before <a href="http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber/#tag-options" target="_blank">here</a>.</li>
<li>Feeling Lucky: FIG will select the first image between the tag if the &#8220;yes&#8221; is selected, else will search for all the images to find the largest image between the tag.</li>
<li>Execution time: FIG will take the selected percentage of maximum PHP execution time to grab image for each feed item. If images are not grabbed for some feed, try increasing this percentage to decrease errors due to network timeouts.</li>
</ol>
<p>That is all. Once you click on import, you will get the feed item nodes along with the images. If images are not grabbed, here is a list of possible reasons,</p>
<ol>
<li>Timeout, try increasing the Execution time.</li>
<li>Malformed HTML source.</li>
<li>Validation failures (due to maximum size, minimum resolution, etc).</li>
</ol>
<p>I am working on better error logging and reporting, so that you can know the reasons for sure.</p>
<p>Enjoy.</p>
<p><strong>Related Posts:</strong></p>
<ul>
<li>Feeds Image Grabber:  <a href="http://publicmind.in/blog/drupal-feeds-image-grabber" target="_blank">http://publicmind.in/blog/drupal-feeds-image-grabber</a></li>
<li>FIG project page (Download): <a href="http://drupal.org/project/feeds_imagegrabber" target="_blank">http://drupal.org/project/feeds_imagegrabber</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/tutorial-for-feeds-image-grabber/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Drupal: Facebook-style Links</title>
		<link>http://publicmind.in/blog/drupal-facebook-link/</link>
		<comments>http://publicmind.in/blog/drupal-facebook-link/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 13:43:52 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[fbsl]]></category>
		<category><![CDATA[fbss]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=475</guid>
		<description><![CDATA[Facebook-style Links (FBSL) provides the ability for users to attach and submit links along with their Facebook-style Statuses. Combined with Facebook-style Statuses (FBSS), the FBSL module provides an attach link form that loads via AHAH. Users can then attach a link with an (optional) thumbnail, title and description to their status. In the nutshell, it [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --><a href="http://drupal.org/project/facebook_link">Facebook-style Links</a> (FBSL) provides the ability for users to attach and submit links along with their Facebook-style Statuses. Combined with <a href="http://drupal.org/project/facebook_status">Facebook-style Statuses</a> (FBSS), the FBSL module provides an attach link form that loads via <a href="http://en.wikipedia.org/wiki/AHAH">AHAH</a>. Users can then <em>attach</em> a link with an (optional) thumbnail, title and description to their status. In the nutshell, it imitates the link attachment feature on Facebook.</p>
<div id="attachment_484" class="wp-caption aligncenter" style="width: 617px"><a href="http://publicmind.in/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-25-at-1.54.50-PM.png"><img class="size-full wp-image-484" title="Screenshot of FBSL on LondonFuse.ca" src="http://publicmind.in/blog/wp-content/uploads/2010/02/Screen-shot-2010-02-25-at-1.54.50-PM.png" alt="screenshot-londonfuse" width="607" height="284" /></a><p class="wp-caption-text">Screenshot of FBSL on LondonFuse.ca</p></div><br />
<span id="more-475"></span><br />
FBSL also provides token support for modules such as <a href="http://drupal.org/project/activity">Activity 2.x</a>. The themed image, title, description and status among other tokens are offered. The FBSS statuses which have a attached link, have their own separate Activity Publisher Templates.</p>
<p>FBSL is designed to be used quite intuitively, this screenshot shows the FBSL status form as themed by Thomas Cermak on <a href="http://londonfuse.ca">LondonFuse</a>.</p>
<p><div id="attachment_491" class="wp-caption aligncenter" style="width: 637px"><a href="http://publicmind.in/blog/wp-content/uploads/2010/02/sreenshot2.png"><img class="size-full wp-image-491" title="screenshot2" src="http://publicmind.in/blog/wp-content/uploads/2010/02/sreenshot2.png" alt="screenshot-facebook-link" width="627" height="76" /></a><p class="wp-caption-text">FBSL status update form</p></div>
<p>FBSL can be used out of the box, though you can customize it from the settings page. All other information (installation, usage, and changelog) can be found inside the packaged module which is available for download <a href="http://drupal.org/project/facebook_link">here</a>.</p>
<p>This module has been sponsored by Thomas Cermak of <a href="http://londonfuse.ca">LondonFuse</a>.</p>
<p><strong>Resources:</strong></p>
<ul>
<li>Project Page (Download): <a href="http://drupal.org/project/facebook_link">http://drupal.org/project/facebook_link</a></li>
</ul>
<p><strong>Note</strong>: Feature and Support requests should be made through the <a href="http://drupal.org/project/facebook_link">Facebook-style Links</a> Forum. I may not be able to answer them here.</p>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/drupal-facebook-link/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drupal: Feeds Image Grabber</title>
		<link>http://publicmind.in/blog/drupal-feeds-image-grabber/</link>
		<comments>http://publicmind.in/blog/drupal-feeds-image-grabber/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 09:50:13 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[imagegrabber]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=474</guid>
		<description><![CDATA[Feeds Image Grabber (FIG) is the successor project for FeedAPI ImageGrabber to support the Feeds module. FIG parses the Item URL of each feed-item, downloads the appropriate image from the post and maps it to an image field in the node created by Feeds module for that feed-item. [Google Reader (with thumbnails) can be imitated [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --><a href="http://drupal.org/project/feeds_imagegrabber">Feeds Image Grabber</a> (FIG) is the successor project for <a href="http://publicmind.in/blog/feedapi-imagegrabber">FeedAPI ImageGrabber</a> to support the <a href="http://drupal.org/project/feeds">Feeds</a> module. FIG parses the Item URL of each feed-item, downloads the appropriate image from the post and maps it to an image field in the node created by Feeds module for that feed-item.</p>
<p>[Google Reader (with thumbnails) can be imitated on a Drupal site by using Feeds, Feeds Image Grabber, FileField, ImageField, ImageCache, ImageAPI and Views module].</p>
<p><span id="more-474"></span> <strong>How it works</strong><br />
A classic method of mimicking the behavior of Feeds Image Grabber would be to do the same thing manually. Let us go through the procedure if you were to do it manually:</p>
<ol>
<li>Refresh the feed to create nodes for feed items (using FeedsNodeProcessor).</li>
<li>For each feed-item, go to their respective webpage and save the image to display.</li>
<li>Upload the image to CCK image field for each feed item.</li>
</ol>
<p>Feeds Image Grabber automates the last 2 steps of the three step process described. <a href="http://drupal.org/project/imagecache">Imagecache</a> module can be used to create thumbnail of the image retrieved which can be attached to the node.</p>
<p><strong>What&#8217;s in the box</strong><br />
On 3rd March, first version of FIG was released. As of today, FIG supports following features:</p>
<ol>
<li>Automatically downloads and attaches image to the node created by Feeds module.</li>
<li>Configurable XPath of the desired image location on the webpage of the feed item on per feed basis (using element&#8217;s id or CSS class).</li>
<li>Support for <a href="http://drupal.org/project/filefield_paths">FileField Paths</a> module.</li>
<li>Configurable maximum image size.</li>
<li>Configurable minimum and maximum image resolutions.</li>
</ol>
<p><strong>Get involved</strong><br />
You can get involved by doing any of the following:</p>
<ol>
<li>write about this module, so that other folks can find it.</li>
<li>report bugs in the <a href="http://drupal.org/node/add/project-issue/feeds_imagegrabber">issue queue</a>.</li>
<li>help in the <a href="http://drupal.org/project/issues/search/feeds_imagegrabber?categories[]=support">support forums</a> of the module.</li>
<li>buy me a Beer <img src='http://publicmind.in/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
</ol>
<p><strong>Resources: </strong></p>
<ul>
<li>Project Page (Download): <a href="http://drupal.org/project/feeds_imagegrabber">http://drupal.org/project/feeds_imagegrabber</a></li>
<li>Tutorials: <a href="http://publicmind.in/blog/tutorial-for-feeds-image-grabber">http://publicmind.in/blog/tutorial-for-feeds-image-grabber</a></li>
</ul>
<p><strong>Note</strong>: Feature and Support requests should be made through the <a href="http://drupal.org/project/feeds_imagegrabber" target="_blank">Feeds Image Grabber</a> Forum. I may not be able to answer them here.</p>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/drupal-feeds-image-grabber/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>&#8220;What is Drupal?&#8221;, for newbies</title>
		<link>http://publicmind.in/blog/what-is-drupal-for-newbies/</link>
		<comments>http://publicmind.in/blog/what-is-drupal-for-newbies/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 22:55:16 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=432</guid>
		<description><![CDATA[I often come across this question from my friends and peers and most of the time I deflect it by saying &#8220;it lets you create your website easily, why don&#8217;t you look up on Wikipedia?&#8221;. Few days ago, one of my friends pointed me that most of the articles start with &#8220;Drupal is a Content Management [...]]]></description>
			<content:encoded><![CDATA[<p>I often come across this question from my friends and peers and most of the time I deflect it by saying &#8220;it lets you create your website easily, why don&#8217;t you look up on Wikipedia?&#8221;. Few days ago, one of my friends pointed me that most of the articles start with &#8220;Drupal is a Content Management System(CMS) &#8230;&#8221; which becomes pretty much confusing when one has no idea about what a CMS is. In this post, I have tried to explain what a CMS is and why we need it and how Drupal stands out among various other available CMSs.</p>
<p>Let us say you need to create a webpage for your website. Ideally, it would mean you create HTML content that will be delivered to someone who requests it through their web browser. Eventually you grow big and decide to add 100 more pages to your website and therefore create 100 more HTML pages. But then you realize that there is a lot of duplicate content. The footer which contains the copyright information is essentially the same on all pages, therefore if you ever need to edit it then it would mean to edit these 101 pages. This will be a lot of redundant work.<br />
<span id="more-432"></span><br />
The main problem with the HTML pages is that they are static, they can not be changed based on what user requests. Thats why we need to have two different pages, even if they are almost similar and just differ by a single line. But then we also need to send the HTML content to the web browsers. That is where scripting languages such as PHP, ASP, JSP come as a savior. These languages are capable of creating dynamic content. The data is usually stored in the database and whenever a request comes for a page, HTML content will be created from this data on-the-fly and will be sent back to the requesting user. Now, you just need to store that copyright information just once, hence changing it becomes much easier.</p>
<p>Now, you also want to control which users have permission to access certain portion of the website and you create a login page for that part of the website, store cookies and write other code to maintain the session for the user. You might also want to publish a webpage on the fly, i.e.  save content to the database right from the user browser. You need some kind of access control mechanism and believe me it will be a hell lot of work to do.</p>
<p>That is where web-based Content Management System come into picture. They take out all the programming part from the publishing part of your website. You just need to write the content that has to be published on your website, make some settings on how it will be displayed, whether anyone or only authenticated users can see that content and you are done (of course, this is overly simplified but believe me once you know this everything will look so obvious to you).</p>
<p>With a CMS, one can easily create a website which :</p>
<ol>
<li>allows large number of people to contribute and share data.</li>
<li>easily manages user access control lists.</li>
<li>have reduced duplicate content.</li>
</ol>
<p>Drupal is one of the several available CMS is the market which is written in PHP and uses MySQL or PostgreSQL as database to store the website content. Drupal is released under GNU General Public License.</p>
<p><strong>What can you achieve with Drupal?</strong></p>
<p>You can easily create and manage,</p>
<ul>
<li>personal homepage</li>
<li>company website</li>
<li>blog</li>
<li>shopping websites (just like Ebay or Amazon)</li>
<li>Social networking sites like Twitter or Facebook</li>
</ul>
<p>With Drupal, you can create any kind of website, Imagination is the limit. Just FYI, White House uses Drupal to manage its official website: <a href="http://whitehouse.gov">whitehouse.gov</a></p>
<p>As with every other product, there are several other alternatives to Drupal such as Joomla, TYPO3, Nucleus, WordPress, etc. You can find the whole list of available CMS here: <a href="http://en.wikipedia.org/wiki/List_of_content_management_systems" target="_blank">List of Content Management Systems</a>. But what makes Drupal stand out is :</p>
<ol>
<li>its ease of use</li>
<li>a large community of developers which keeps everything secure and up to date.</li>
<li>a large pool of modules and themes. A module in Drupal lets you do things which aren&#8217;t supported by default in Drupal.</li>
</ol>
<p>Here is a small 1 minute video on &#8220;What is Drupal&#8221;, this video has already won six Telly awards:</p>
<p><object width="425" height="349"><param name="movie" value="http://www.youtube.com/v/rF1X12PE6PY&#038;rel=0&#038;border=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/rF1X12PE6PY&#038;rel=0&#038;border=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="349"></embed></object></p>
<p><strong>Drupal Website Hosting</strong></p>
<p><strong></strong>There are a lot of web hosting providers in the market and I know you will research well before buying anything. Most of them provide a one-click Drupal installation which saves you a lot of trouble while installing Drupal. I recommend you to look for such a web host, well all is up to you anyway.</p>
<p>You are now ready to eat up the Wikipedia article on Drupal. You can visit official Drupal website to look for great tutorials and downloads. Here are a few important links:</p>
<p>Official Drupal website: <a href="http://drupal.org">http://drupal.org</a><br />
Modules Resource: <a href="http://drupal.org/project/modules">http://drupal.org/project/modules</a><br />
Themes Resource: <a href="http://drupal.org/project/themes">http://drupal.org/project/themes</a><br />
Wikipedia article: <a href="http://en.wikipedia.org/wiki/Drupal">http://en.wikipedia.org/wiki/Drupal</a></p>
<p>Do not forget to vote for this post on DZone or Digg if you liked it, or you can leave a comment or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/what-is-drupal-for-newbies/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP: Select HTML elements with more than one css class using XPath</title>
		<link>http://publicmind.in/blog/html-elements-with-more-than-one-css-class/</link>
		<comments>http://publicmind.in/blog/html-elements-with-more-than-one-css-class/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 22:39:43 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=309</guid>
		<description><![CDATA[Recently, while working on my project FeedAPI ImageGrabber I came across the issue where I had to select HTML elements by a given css class. The HTML element can have a single CSS class: 1&#60;div class=&#34;foo&#34;&#62;&#60;/div&#62; or multiple CSS classes associated with it. 1&#60;div class=&#34;foo exp tar&#34;&#62;&#60;/div&#62; Now if you want to select the HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, while working on my project <a href="http://publicmind.in/blog/feedapi-imagegrabber">FeedAPI ImageGrabber</a> I came across the issue where I had to select HTML elements by a given css class. The HTML element can have a single CSS class:</p>
<div class="codecolorer-container php default" 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;foo&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>or multiple CSS classes associated with it.</p>
<div class="codecolorer-container php default" 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;foo exp tar&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>Now if you want to select the HTML elements with class &#8220;foo&#8221;, this div element would be one of them.<br />
<span id="more-309"></span><br />
As, I do not have much experience with XPath, I started to search for a solution. After a lot of search and discussion on Drupal development mailing lists, I arrived at the following XPath :</p>
<div class="codecolorer-container php default" 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #666666; font-style: italic;">//*[@class and contains(concat(' ',normalize-space(@class),' '),' $classname ')]</span></div></td></tr></tbody></table></div>
<p>The <strong>normalize-space</strong> function replaces all continuous tabs and whitespaces with a single whitespace character. Then, we concatenate the resulting string with two white-spaces, one in the start and other at the last. At last, we search for</p>
<div class="codecolorer-container php default" 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="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$classname</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span></div></td></tr></tbody></table></div>
<p>in the final string.</p>
<p>I hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/html-elements-with-more-than-one-css-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial for FeedAPI Image Grabber</title>
		<link>http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber/</link>
		<comments>http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 10:39:59 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[feedapi]]></category>
		<category><![CDATA[imagegrabber]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=257</guid>
		<description><![CDATA[Updates: Feeds Image Grabber has been released to support the new Feeds module. (3 march 2010) Tutorial for Feeds Image Grabber (FIG) published. (6 march 2010) Demonstration Website is available here. (6 march 2010) I get a lot of requests for this, so here is a tutorial explaining the 3 W&#8217;s (What, Why and How) [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<div class="download"><strong>Updates:</strong></p>
<ul>
<li><a href="http://publicmind.in/blog/drupal-feeds-image-grabber">Feeds Image Grabber</a> has been released to support the new Feeds module. (3 march 2010)</li>
<li><a href="http://publicmind.in/blog/tutorial-for-feeds-image-grabber">Tutorial for Feeds Image Grabber</a> (FIG) published. (6 march 2010)</li>
<li><strong>Demonstration Website</strong> is available <a href="http://publicmind.in/feedapi_imagegrabber/demonstration">here</a>. (6 march 2010)</li>
</ul>
</div>
<p>I get a lot of requests for this, so here is a tutorial explaining the 3 W&#8217;s (What, Why and How) of FeedAPI ImageGrabber.</p>
<p><strong>Motivation</strong></p>
<div id="attachment_258" class="wp-caption aligncenter" style="width: 580px"><img class="size-full wp-image-258   " title="google_reader" src="http://publicmind.in/blog/wp-content/uploads/2009/09/google_reader.jpg" alt="a feed item from google reader" width="570" height="95" /><p class="wp-caption-text">a feed item from google reader</p></div>
<p>This is a screenshot of a news item from my Google Reader. Anyone who has a moderate knowledge about the feeds would know that the image on the left in the above news-item is actually not published with the feed.</p>
<p class="note">In other words, If you refresh any feed on your Drupal website using FeedAPI, you won&#8217;t get the image in the posts, unless they are published along with the feed which is quite rare.</p>
<p>The purpose of FeedAPI Imagegrabber is to make the feed more informative as well as interesting for the user. As, we all know that “comics are much better than novels”, this module appends the feed-item with an appropriate image from its content URL. The goal of the FeedAPI ImageGrabber is to mimic the thumbnail display of Google Reader for the feeds on your Drupal website.</p>
<p class="download">As soon as you refresh the feed, ImageGrabber automatically attaches an appropriate image from the original article to the feed-item node on your website. You don&#8217;t even have to press an extra button!!</p>
<p><span id="more-257"></span><br />
<strong>How it works</strong><br />
A classic method of mimicking the behavior of FeedAPI Imagegrabber will be to do the same thing manually. Let us go through the procedure if you were to do it manually:</p>
<ol>
<li>Refresh the feed.</li>
<li>For each feed-item, go to their respective original URL and save the image to display.</li>
<li>For each node, crop the image, convert it into a thumbnail and then upload it in an CCK imagefield.</li>
</ol>
<p>FeedAPI Imagegrabber automates the last 2 steps of the three step process described. You just need to refresh the feed and the ImageGrabber do the rest for you. The most difficult part which only humans can do is to select an appropriate image,  for which I am constantly improving on the heuristics.</p>
<p><strong>Download and Install</strong><br />
Download the latest release of FeedAPI ImageGrabber, compatible with your Drupal release, from the project page. Uncompress the folder in your site&#8217;s module directory and enable it from the admin/module page.</p>
<p class="download">You are now ready to create new feeds with ImageGrabber enabled.</p>
<p>Next, you must install the following modules to get going:</p>
<ul>
<li>Imagefield</li>
<li>Filefield</li>
<li>CCK</li>
</ul>
<p>You must then decide the content type for your feed-items for a particular feed and add CCK imagefields to that content type, before proceeding.</p>
<p><a name="tag-options"><strong>Form User Interface</strong></a><br />
You can enable the ImageGrabber for the feeds you want to download images for. When you add or edit any feed (i.e. feedapi enabled node), you will see the following additional settings for ImageGrabber:</p>
<div id="attachment_267" class="wp-caption aligncenter" style="width: 636px"><img class="size-full wp-image-267" title="feedapi_imagegrabber_interface" src="http://publicmind.in/blog/wp-content/uploads/2009/09/feedapi_imagegrabber_interface.jpg" alt="Form Interface for ImageGrabber" width="626" height="446" /><p class="wp-caption-text">Form Interface for ImageGrabber</p></div>
<p>Here is an detailed explanation of the input fields:</p>
<ol>
<li><strong>Enable ImageGrabber: </strong>Check this box if you want to enable ImageGrabber for this particular feed.</li>
<li><strong>Select image field: </strong>ImageGrabber stores the downloaded image in a cck imagefield. You must select one of the imagefield from the drop-down menu.</li>
<p class="warning alert">If you receive this message &#8220;There are no imagefields associated with the &#8216;abcd&#8217; content type.&#8221; , then you must add imagefield to the content type mentioned or change the content type of the feed-items to the one which has imagefields associated with it.</p>
<li><strong>Search for an image between the tag identified by: </strong><br />
To understand this, consider that the every feed-item associated with a particular feed has the following structure (HTML source code):</p>
<div id="attachment_282" class="wp-caption aligncenter" style="width: 518px"><a href="http://publicmind.in/blog/wp-content/uploads/2009/09/class-example1.jpg"><img class="size-full wp-image-282         " title="html source code" src="http://publicmind.in/blog/wp-content/uploads/2009/09/class-example1.jpg" alt="HTML source code of a feed-item webpage" width="508" height="292" /></a><p class="wp-caption-text">HTML source code of a feed-item webpage</p></div>
<p>For the above example, we know that the images associated with this particular post will always be within the</p>
<div class="codecolorer-container html4strict default" 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 /></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: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span>&gt;</span>...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
tag</div></td></tr></tbody></table></div>
<p>Therefore, for this feed you must select the &#8216;class&#8217; option here and enter &#8216;post&#8217; in the text-field.<br />
Similarly, you must find out one such tag from the feed-items of the feed you want to create, see if it is identified by an id or an class. Then, select the appropriate option and enter the class or id in the text-field below. If you select None, the default tag will be &#8216;body&#8217;.</p>
<p class="download">simple way to find the id or class: Just find out the title of your article in the source code, and start looking for its parent/grandparent tags. Select the nearest parent which has an id or class.</p>
<p>Now ImageGrabber will look for the images just between this tag, hence eliminating the download (and selection) of images in the sidebar or the header advertisement.</li>
<li>Enter the id or class (whatever you selected) in the text-field. Leave it empty if you selected the None option above.</li>
<li><strong>Feeling Lucky: </strong>This has definitely been borrowed from the big devil <strong><a href="http://google.com">Google</a></strong>. It will just select the first image it encounter between the tag specified, if &#8216;feeling lucky&#8217; option is selected. Otherwise, it will select the largest image between the tags. I would personally recommend you to try out the &#8216;feeling lucky&#8217; option as it helps saving a lot of bandwidth!! But if it doesn&#8217;t work for you, select the otherwise.</li>
</ol>
<p>When you are done, just refresh the feed and you will see the images attached to the feed-item nodes.</p>
<p class="download">Note: You can also modify your theme a little to get the Google Reader look in which the image floats on the left of the feed-item.</p>
<p>After refresh, you might get the following warning:</p>
<p class="warning alert">ImageGrabber: PHP execution time limit for system is 30 seconds, due to which images for some feed items couldn&#8217;t be downloaded. Please click on &#8216;Grab Images&#8217; to refresh those feed-items.</p>
<p>If you get such a warning, no need to get afraid, just click on &#8216;Grab Images&#8217; and the remaining feed-items will have their images as well. You may get multiple warnings depending upon your system&#8217;s execution time.</p>
<p>Enjoy grabbing images!!</p>
<p>Do leave a comment about this tutorial. Please make support and feature requests using <a href="http://drupal.org/project/feedapi_imagegrabber">support forums</a> only.</p>
<p><strong>Related Posts:</strong></p>
<ul>
<li><a href="http://publicmind.in/blog/feedapi-imagegrabber">FeedAPI ImageGrabber</a></li>
<li><a href="http://publicmind.in/blog/drupal-feeds-image-grabber">Feeds Image Grabber</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Drupal: FeedAPI Imagegrabber</title>
		<link>http://publicmind.in/blog/feedapi-imagegrabber/</link>
		<comments>http://publicmind.in/blog/feedapi-imagegrabber/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 07:08:10 +0000</pubDate>
		<dc:creator>Nitin</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Intern]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://publicmind.in/blog/?p=105</guid>
		<description><![CDATA[Feeds Image Grabber (FIG) was released on 3rd March 2010, to support the Feeds module. Introduction FeedAPI Imagegrabber is a add-on module for FeedAPI. It consists of a parser which visits the original URL of a new feed item, and retrieves the main image from the post. Once the main image has been retrieved, it [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled -->
<div class="download"><a href="http://publicmind.in/blog/drupal-feeds-image-grabber">Feeds Image Grabber</a> (FIG) was released on 3rd March 2010, to support the <a href="http://drupal.org/project/feeds">Feeds</a> module.
</div>
<p><strong>Introduction</strong></p>
<p><a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">FeedAPI Imagegrabber</a> is a add-on module for <a href="http://drupal.org/project/feedapi" target="_blank">FeedAPI</a>. It consists of a parser which visits the original URL of a new feed item, and retrieves the main image from the post. Once the main image has been retrieved, it is then converted into a thumbnail using the <a href="http://drupal.org/project/imagecache" target="_blank">ImageCache</a> module, and stored in the node created by FeedAPI, inside a CCK field.</p>
<p>The purpose of FeedAPI Imagegrabber is to make the feed more informative as well as interesting for the user. As, we all know that &#8220;comics are much better than novels&#8221;, this module appends the feed-item with an appropriate image from its content URL. The goal of the module is to mimic the thumbnail display of websites such as digg.com. This goal is acheived by using FeedAPI to turn RSS feed-items into nodes, and then using FeedAPI Imagegrabber to append these nodes with an appropriate image from the feed-item&#8217;s webpage.<br />
<span id="more-105"></span><br />
<strong>How it works</strong></p>
<p>A classic method of mimicking the behavior of FeedAPI Imagegrabber will be to do the same thing manually. Let us go through the procedure if you were to do it manually:</p>
<ol>
<li>Refresh the feed.</li>
<li>For each feed-item, go to their respective original URL and save the image to display.</li>
<li>Crop the image, convert it into a thumbnail and then upload it in an CCK Image field.</li>
</ol>
<p>FeedAPI Imagegrabber automates the last 2 steps of the three step process described. It uses cURL to download the images and then crop them using Imagecache. Then the image is stored into the CCK Imagefield. The most difficult part which only humans can do is to select the image,  for which I am constantly improving on the heuristics.</p>
<p><strong>Download and Install</strong></p>
<p>Visit the project page : <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">FeedAPI Imagegrabber</a></p>
<p><strong>Features and Future Releases</strong></p>
<p>Visit the project page : <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">FeedAPI Imagegrabber</a></p>
<p><strong>History</strong></p>
<p>I understand history is boring, but it is only for those who think the other way round. I started working on this module during December 2008.  At the time, when I started working on this module, I had a little or say<em><strong> no idea</strong></em> about Drupal or its API. It took me quite some time to get used to it and start working on the module. In the Initial release, I thought of very simple heuristics and decided to select the largest image available on the web-page. I completed the module in about 1 month and was very happy with my performance, and then a big blow came which delayed the release of FeedAPI Imagegrabber by 2 months. I had to include an external BSD licensed script for converting relative URL&#8217;s to absolute URL&#8217;s but Drupal denied to accept this. They said they allow only GPL licensed code and I started to convince them that both licenses are compatible. Unfortunately, I was unable to convince them and I had to create an external link to that BSD script on sourceforge. And now, the module is released with the hope to enhance the visitor-experience on several websites around the globe.</p>
<p>You may find these posts useful:</p>
<p><a rel="bookmark" href="http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber">Tutorial for FeedAPI ImageGrabber</a><br />
<a class="title" rel="bookmark" href="http://publicmind.in/blog/urltoabsolute/">PHP: Relative URL to Absolute URL</a><br />
<a rel="bookmark" href="http://magicalsilverdrop.blogspot.com/2009/02/open-source-software-and-licenses.html">Open Source Software and Licenses</a></p>
<p>Do Leave your comments to let me know what you think.</p>
<p><strong>Note: </strong>Support queries and requests should be made through the <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">FeedAPI Imagegrabber Forum</a>. I may not be able to answer them here. <img src='http://publicmind.in/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="download">
<p><strong>Updates:</strong></p>
<ul>
<li>The first stable version of the module was released on 7th April, 2009. Check it out now <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">here</a>!!</li>
<li>RC1 release for Imagegrabber is now available for download on Project page. It is compatible with the RC1 release of Imagefield. (17 Apr, 2009)</li>
<li>Demonstration Website is up, and is available <a href="http://publicmind.in/feedapi_imagegrabber/demonstration">here</a>. (20 Aug, 2009)</li>
<li>FeedAPI ImageGrabber v1.8 released. Download it from the project website <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">here</a>. (20 September 2009)</li>
<li><a href="http://publicmind.in/blog/tutorial-for-feedapi-imagegrabber">Tutorial for FeedAPI ImageGrabber</a> published. (20 September 2009)</li>
<li>FeedAPI ImageGrabber v1.9 released. Download it from the project website <a href="http://drupal.org/project/feedapi_imagegrabber" target="_blank">here</a>. (26 October 2009)</li>
<li>FeedAPI ImageGrabber now supports <a href="http://drupal.org/project/filefield_paths">Filefield Paths</a> module. Download the development snapshot, its stable for use on production site.</li>
<li>As of 02 Dec 2009, Development of FeedAPI ImageGrabber has been halted. You can look out for the <a href="http://drupal.org/project/feeds_imagegrabber" target="_blank">Feeds Image Grabber</a> module which supports <a href="http://drupal.org/project/feeds" target="_blank">Feeds</a> module,  successor of FeedAPI, with the same functionality.</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://publicmind.in/blog/feedapi-imagegrabber/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
