<?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>Engwar &#187; drupal</title>
	<atom:link href="http://engwar.com/tags/drupal/feed" rel="self" type="application/rss+xml" />
	<link>http://engwar.com</link>
	<description>Chintana Wilamuna&#039;s weblog</description>
	<lastBuildDate>Wed, 30 Nov 2011 13:28:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Compromises</title>
		<link>http://engwar.com/post/136?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=compromises</link>
		<comments>http://engwar.com/post/136#comments</comments>
		<pubDate>Sun, 04 Oct 2009 21:44:01 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=136</guid>
		<description><![CDATA[Lack of a coherent essay these days can partly be blamed to the rise of the tablogging. Then again, striking a balance between a tech, utterly abstract mumbo jumbo or something explicit as a Tucker Max story is challenging There&#8217;s &#8230; <a href="http://engwar.com/post/136">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Lack of a coherent essay these days can partly be blamed to the <a href="http://lair.fierydragon.org/2009/09/tablogging/">rise of the tablogging</a>. Then again, striking a balance between a tech, utterly abstract mumbo jumbo or something explicit as a <a href="http://www.tuckermax.com/">Tucker Max</a> story is challenging <img src='http://engwar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  There&#8217;s no better way to start a Monday morning with a <a href="http://robozen.com/technology/drupal-sucks/">hilarious rant about Drupal</a>. Despite the mild headache, tis gonna be a good day!</p>
<p>I agree with some of the comments by the author. Yes, it&#8217;s not the easiest to configure and maintain. If you ignore some best practices you&#8217;re really screwed. If this configuration problem refers to specific module configurations, yes, I&#8217;ve seen numerous people gripe about that.</p>
<p>3rd party modules are there so that the core can be clean and simple. This extensibility, IMO a very good thing. Coding a custom CMS in Rails doesn&#8217;t seem sexy to me. It&#8217;s a really boring thing to code a CMS these days regardless of the language. There are enough free CMSes out there that work 95% of the time. The remaining 5% is not worth coding a new CMS from scratch.</p>
<p>Yes, Drupal views are stored in the database. For me, that&#8217;s the easiest and logical place to store this. I think if the file system was used, this feature would&#8217;ve been much slower given its dynamic nature.</p>
<p>Again, I agree with that the usability sucks. It can be improved.</p>
<p>The comment about the use of structured programming instead of OOP is nonsense. Drupal framework implement a hooks system that you can hook up a user defined function practically anywhere. For the programmer that&#8217;s sufficient to get the job done. Dissing the whole framework because of OOP fanboyism is stupid.</p>
<p>A particular software tool might not be able to do everything that we dream of doing. However, compared with a proprietary program, the user has a choice of choosing something which matches closely with his requirements. As Paul puts it, it&#8217;s like an <a href="http://pzf.fremantle.org/2009/09/arranged-marriages-vs-dating.html">arranged marriage vs. dating</a>. Cool thing is, if you need a particular feature so badly you can pay someone and get it done the way you want it. Reality has it, even if it&#8217;s arranged vs. dated for couple of years, after getting married you can&#8217;t live together if you&#8217;re not able to make compromises. So I&#8217;ve been told.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/136/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Drupal, amelioratory management</title>
		<link>http://engwar.com/post/47?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=drupal-amelioratory-management</link>
		<comments>http://engwar.com/post/47#comments</comments>
		<pubDate>Fri, 22 Aug 2008 22:18:05 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=47</guid>
		<description><![CDATA[I&#8217;m going to take Drupal as an example during this post and outline some of the challenges of working on it with a loosely knit team. One major problem with PHP based content management systems is that it&#8217;s PHP. So, &#8230; <a href="http://engwar.com/post/47">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to take <a href="http://drupal.org/">Drupal</a> as an example during this post and outline some of the challenges of working on it with a loosely knit team.  One major problem with PHP based content management systems is that it&#8217;s PHP.  So, anyone who have taken the time to stare at some code snippets could modify, say, the user module (in Drupal) and get his changes displayed (assuming that&#8217;s what he wanted in the first place).  As a side note, <a href="http://www.php.net/manual/en/">PHP Manual</a> is all you need to learn about PHP.  This was a much criticized fact for Ruby, lack of freely accessible up-to-date documentation.  Although situation is improving as the <a href="http://ruby-doc.org/">ruby-doc</a> project gained more momentum. Any &#8220;teach yourself how to clean dog poop in 24 hours&#8221; guides are useless because it&#8217;ll take <a href="http://www.norvig.com/21-days.html">10 years to learn howto program</a> effectively.</p>
<p>Coming back to Drupal, this issue of having the freedom to modify anything &#8216;cos it&#8217;s all PHP should really not be an issue but experience suggest otherwise.  Having restricted access to Drupal core files is also of limited success. Remember, I&#8217;m not talking from an outsiders perspective where you worry about world readable files and whatnot, this is from the developer perspective who has full control over making a code level change. A set of people maintaining the site doing continuous modifications.</p>
<p>If you&#8217;re just running Drupal as a blog and you&#8217;re the only one who makes changes to it, then there are no issues. In a team environment sometimes you assume that something like a change to a core file should not be done unless you have 1) googled 2) RTFM (thrice) and there&#8217;s no other way to do it, but surprisingly people overlook this fact and do change the stuff that should not be changed. Usually these kind of shit happens when you cut your software engineering lectures and go collecting meadow muffins on perfectly bright and sunny days. </p>
<p>Close examination suggest legitimate reasons such as,</p>
<ol>
<li>It&#8217;s easy to customize, say, <code>include/common.inc</code> rather than reading the API doc, which is comparatively harder and takes more time</li>
<li>Naming conventions. <code>common.inc</code>. &#8220;I need to display the top most blah blah blah nodes on these set of pages, it&#8217;s a common feature to all these so <code>common.inc</code> is the right place to do it&#8221;.</li>
<li>You do need to get something displayed, quickly, you know it&#8217;s not the right way to do it but since time is more important you decide to change a line in a core module which is trivial.</li>
</ol>
<p>All goes well for a couple of years until someone else takes over and use the universal language to communicate with your entire genealogy.</p>
<p>Those 10 second hack jobs will stack up with time and by the time shit hits the fan, no amount of version control could save you. Problems arise when you have to update your CMS. Files such as <code>common.inc</code> belongs to the Drupal core and will be updated. So if you have modifications in those files you now have to get those to the system. If you&#8217;re really unlucky and the API has changed now you have to substitute the new functions. This will become tedious when you have to go through each and every file to see what has been added/modified. Things get more vexing if you have nodes embedded with PHP code. These are nodes with Input type PHP.  If the API has changed now you have to go through those pages and see what breaks.</p>
<p>So what are the possible solutions for this mussed up state of affairs?</p>
<ol>
<li>Making it hard to modify the core files which will be replaced during an upgrade.</li>
<li>Enforce an internal policy regarding the modifications so that changes happen in either the theme used or in a separate module.</li>
</ol>
<p>Making everyone aware of the extension mechanisms available and doing changes in a disciplined manner will save you when you have to upgrade. Also this will make the life of the <a href="http://c2.com/cgi/wiki?MaintenanceProgrammer">maintenance programmer</a> easier. This does have one drawback. Turnaround times for features/changes will now take a bit more time than earlier but the big upside is the whole thing could be rapidly updated (if there&#8217;s a security vulnerability or a newer version have a killer feature, makes it faster etc&#8230;) and someone else could take over without much effort.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/47/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fiddling with drupal forms</title>
		<link>http://engwar.com/post/46?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fiddling-with-drupal-forms</link>
		<comments>http://engwar.com/post/46#comments</comments>
		<pubDate>Thu, 21 Aug 2008 15:30:06 +0000</pubDate>
		<dc:creator>Chintana</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[oxygentank]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://engwar.com/?p=46</guid>
		<description><![CDATA[This will show some of the neat API calls Drupal provides which you could use to do almost anything. OxygenTank, the developer portal related to WSO2 products runs on Drupal. The code examples in this post are extracted from a &#8230; <a href="http://engwar.com/post/46">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This will show some of the neat API calls Drupal provides which you could use to do almost anything.  <a href="http://wso2.org/">OxygenTank</a>, the developer portal related to <a href="http://wso2.org/downloads">WSO2 products</a> runs on <a href="http://drupal.org/">Drupal</a>.  The code examples in this post are extracted from a soon to be implemented module which will alter the way you download products. Everything you need to know about the <a href="http://api.drupal.org/">Drupal API is nicely documented</a>.</p>
<p>Forms are defined as PHP arrays,</p>
<pre lang="php">
$form['noreg'] = array(
    '#type' => 'checkboxes',
    '#title' => "Reason not to register",
    '#options' => $reasons,
    '#default_value' => 0,
    '#validate' => array('fizzed_up_validator' => array())
);
</pre>
<p>When the above code fragment gets rendered into HTML it&#8217;ll be a list of checkboxes with the items in <code>$reasons</code>. Also note that we&#8217;re passing a custom validation function. Inside your custom validation function you could perform all the checking and if there&#8217;s an error condition you could say,</p>
<pre lang="php">
form_set_error($form, $message);
</pre>
<p>which will display an error message and redirects users back to the form. <code>$form</code> is a parameter your validation function takes. Forms API is well documented with examples.</p>
<p>There&#8217;s this need to add the user to a particular role depending on from where the user come to the download page. This should be done in the registration phase. That&#8217;s trivial to do with Drupal. You could get this &#8220;event&#8221; where the user submitted details has passed all the validation logic and about to be inserted into the database, at that time you have to fetch the role info from the DB and insert stuff to <code>users_roles</code> table. Oh, and the redirection part. When the form is successfully submitted (meaning user got registered) you could redirect the user to anywhere. All the API and the things you could do with it is extremely well thought out and nice to play with. To get this registration form, all I had to do was hide some attributes before the form gets rendered. For example look at the standard <a href="http://wso2.org/user/register">registration page</a>. Embedded registration form of the newly designed page had to contain only the mandatory fields. There was no need to display rest of the stuff. So, what I had to do was in <code><a href="http://api.drupal.org/api/function/hook_form_alter/6">hook_form_alter</a></code> unset the relevant <code>$form['elems']</code>. Had to define a session variable to detect we&#8217;re coming from the right page, otherwise the all the registration form instances will be changed. After that display the form,</p>
<pre lang="php">
drupal_get_form('user_register');
</pre>
<p>voila! Now you have a customized registration form. The cool thing is all the validation stuff defined for the registration form will work and you don&#8217;t have to do anything extra.</p>
<p>A slightly less documented API call that we use is <code><a href="http://api.drupal.org/api/function/user_external_load/6">user_external_load</a></code>. This&#8217;ll load a given user&#8217;s details into the current session so that the user will be logged into the system. To pull this off successfully there needs to be an entry in the <code>authmap</code> table as the function implementation shows. I&#8217;ve not been able to find a way one could insert a record to this table via the admin screens.</p>
]]></content:encoded>
			<wfw:commentRss>http://engwar.com/post/46/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

