<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Rapid Development Group</title>
	
	<link>http://blog.rapiddg.com</link>
	<description>Blog</description>
	<lastBuildDate>Fri, 27 Apr 2012 14:14:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rapiddg" /><feedburner:info uri="rapiddg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Theme Drupal Content as an Overlay</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/I6G7skp9FYU/</link>
		<comments>http://blog.rapiddg.com/2012/04/theme-drupal-content-as-an-overlay/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 00:53:24 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[colorbox]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[Drupal 7]]></category>
		<category><![CDATA[drupal colorbox]]></category>
		<category><![CDATA[drupal overlay]]></category>
		<category><![CDATA[drupal theming]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=422</guid>
		<description><![CDATA[What if you want to have forms display as overlays on your Drupal 7 installation? Perhaps you want to give your users a way to add nodes without leaving the current page (like adding reference nodes to the node being edited). There are a few ways to accomplish this task, but this approach will add [...]]]></description>
			<content:encoded><![CDATA[<p>What if you want to have forms display as overlays on your Drupal 7 installation?  Perhaps you want to give your users a way to add nodes without leaving the current page (like adding reference nodes to the node being edited).  </p>
<p>There are a few ways to accomplish this task, but this approach will add this functionality without requiring specific template changes within the active theme.  Instead, all code can reside within your custom module.  This is handy if you want your functionality to remain independent of what theme is used, which seems ideal to me.  </p>
<p>Drupal 7 includes the <a href="http://api.drupal.org/api/drupal/modules!overlay!overlay.module/7">Overlay</a> module; which, when enabled does a nice job of displaying the admin pages in an overlay.  It would be great to tap into what drupal is using here in this module, but unfortunately the code is tailored pretty specifically, and isn&#8217;t very extensible.</p>
<p>This approach will also provide the form without the irrelevant regions of a page like the header, footer, sidebars, etc.  </p>
<p>For the overlay functionality we usually use <a href="http://www.jacklmoore.com/colorbox">Colorbox</a>, which is our library of choice for implementing light-box like functionality with jQuery.  There is a <a href="http://drupal.org/project/colorbox">module</a> with help facilitates this integration with Drupal.  But there are a number of jQuery libraries that accomplish the same thing.  The installation of one of these libraries is outside the scope of this example.</p>
<p>So here is how accomplish this&#8230;</p>
<p>First we create the menu callback and it&#8217;s corresponding function, which will need to also reside in your *.module file unless you specify otherwise in the <a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu/7">menu hook</a>.  This callback will be responsible for providing what ever it is you want to display in your overlay.  In this example I am providing a form.</p>
<pre class="brush: php">
function mymodule_menu()
{
  $items = array();

  $items[&#039;mymodule/popup&#039;] = array(
    &#039;title&#039; =&gt; &#039;Popup Overlay&#039;,
    &#039;page callback&#039; =&gt; &#039;_mymodule_callback&#039;,
    &#039;access arguments&#039; =&gt; array(&#039;access content&#039;),
    &#039;type&#039; =&gt; MENU_CALLBACK,
  );

  return $items;
}
</pre>
<pre class="brush: php">
function _mymodule_callback() {
  module_invoke(&#039;admin_menu&#039;, &#039;suppress&#039;);
  $form = drupal_get_form(&#039;_mymodule_form&#039;);
  $form[&#039;#popup&#039;] = true;
  return $form;
}
</pre>
<p>So here is what we are doing with this callback.  We are invoking the <strong>suppress</strong> function of the <strong><a href="http://drupal.org/project/admin_menu">admin_menu</a></strong> in order to prevent this menu from appearing along the top of the overlay.  You don&#8217;t need to do this if you are not using this module, however because we are using <a href="http://api.drupal.org/api/drupal/includes!module.inc/function/module_invoke/7">module_invoke</a> we won&#8217;t receive an error if the module doesn&#8217;t exist on this Drupal installation.</p>
<p>Next we are grabbing the form <a href="http://drupal.org/node/930760">render array</a> to pass back from this callback.  This can be any render array you want.</p>
<p>Finally, we add an element to our <a href="http://drupal.org/node/930760">render array</a> that we will be using later to indicate that we want to only show the main content of this page. </p>
<p>Next we are going to implement <a href="http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_theme/7">hook_theme</a> to define a new theme element in the registry.</p>
<pre class="brush: php">
function mymodule_theme() {

  $items[&#039;mymodule_popup&#039;] = array(
    &#039;render element&#039; =&gt; &#039;page&#039;,
    &#039;template&#039; =&gt; &#039;mymodule_popup&#039;,
  );

  return $items;
}
</pre>
<p>This function defines a new theme called <strong>mymodule_popup</strong>.  It indicates it will be theming the page element and will be using a template named <strong>mymodule_popup (.tpl.php)</strong>.  This tpl file should reside in the base directory of your custom module unless you specify a path in the theme definition.</p>
<p>Next let&#8217;s create our tpl.php file.  All we want this to do is show our main content, wrapped in minimal html.  Simply copying the innermost portion of your standard page.tpl.php file will give you a good start.</p>
<pre class="brush: html">
&lt;div id=&quot;page-wrapper&quot;&gt;&lt;div id=&quot;page&quot;&gt;
  &lt;div id=&quot;main-wrapper&quot;&gt;&lt;div id=&quot;main&quot; class=&quot;clearfix&quot;&gt;
    &lt;div id=&quot;content&quot; class=&quot;column&quot;&gt;&lt;div class=&quot;section&quot;&gt;
      &lt;a id=&quot;main-content&quot;&gt;&lt;/a&gt;
      &lt;?php print render($page[&#039;content&#039;]); ?&gt;
    &lt;/div&gt;&lt;/div&gt;&lt;!-- /.section, /#content --&gt;
  &lt;/div&gt;&lt;/div&gt;&lt;!-- /#main, /#main-wrapper --&gt;
&lt;/div&gt;&lt;/div&gt;&lt;!-- /#page, /#page-wrapper --&gt;
</pre>
<p>Lastly we implement <a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_page_alter/7">hook_page_alter</a>.  This is what tells Drupal to use our new stripped down theme file when displaying a page with the attribute of &#8216;#popup&#8217;.  This attribute corresponds to the line of code we included in the callback function.</p>
<pre class="brush: php">
function mymodule_page_alter(&amp;$page) {
  if (isset($page[&#039;content&#039;][&#039;system_main&#039;][&#039;#popup&#039;])) {
    $page[&#039;#theme&#039;] = &#039;mymodule_popup&#039;;
  }
}
</pre>
<p>That does it, after refreshing the theme cache, when invoking an ajax callback (using colorbox or comparable library) you should see your overlay displaying the content returned from the callback function.  </p>
<p>Hope this helps, feel free to ask questions in the comments.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Ftheme-drupal-content-as-an-overlay%2F&amp;linkname=Theme%20Drupal%20Content%20as%20an%20Overlay">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/04/theme-drupal-content-as-an-overlay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/04/theme-drupal-content-as-an-overlay/</feedburner:origLink></item>
		<item>
		<title>Updating a Drupal Module’s Schema</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/C2iGjGBhysk/</link>
		<comments>http://blog.rapiddg.com/2012/04/updating-a-drupal-modules-schema/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 17:23:52 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=370</guid>
		<description><![CDATA[I recently had the need to make updates to a table I am defining using Drupal&#8217;s schema API.  It&#8217;s extremely simple to do, though there isn&#8217;t much in the way of documentation (if there is, let me know in the comments).  The biggest reason to implement a schema update is if you want to make updates to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to make updates to a table I am defining using Drupal&#8217;s <a href="http://api.drupal.org/api/drupal/includes%21database%21schema.inc/group/schemaapi/7" target="_blank">schema API</a>.  It&#8217;s extremely simple to do, though there isn&#8217;t much in the way of documentation (if there is, let me know in the comments).  The biggest reason to implement a schema update is if you want to make updates to the database, but do not want to lose the data already in the system (otherwise you can just uninstall and reinstall the module to update the schema).</p>
<p>So here&#8217;s what you do.</p>
<p>First you need to modify the <a href="http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_schema/7">hook_schema</a> implementation to include the new fields (or removal of fields).  For my example I&#8217;ll be adding a field called &#8216;<strong>test_flag</strong>&#8216; to my custom table.</p>
<pre class="brush: php">

&#039;test_flag&#039; =&gt; array(
  &#039;description&#039; =&gt; &#039;Is this record flagged&#039;,
  &#039;type&#039; =&gt; &#039;int&#039;,
  &#039;size&#039; =&gt; &#039;tiny&#039;,
  &#039;not null&#039; =&gt; TRUE,
  &#039;default&#039; =&gt; 0,
),
</pre>
<p>This will ensure that the schema is correct for anyone installing the module for the first time.  But we need to make sure anyone using this module also has the correct schema.  You need to name your function <strong>[module name]_update_[version number]</strong>.  Naming the function this way is important and provides a lot of nice functionality for free.  Your version number should be the version of Drupal times 1000.  So the first update for a module on Drupal 7 should be versioned 7001.  Subsequent versions being 7002, 7003, etc&#8230;</p>
<p>The comment you place over your function is also important.  This is what will be used as a description to the user updating the module.  This was an unexpected surprise for me when looking through core.</p>
<p>Lastly you need to make the db changes.  Drupal gives us an easy way to do this within a single line of code.  Use <a href="http://api.drupal.org/api/drupal/includes%21database%21database.inc/function/db_add_field/7">db_add_field</a> passing in the name of the schema (table) and the field you are looking to add along with an array of attributes for this field.  The array of attributes uses the same structure other schema definitions.</p>
<pre class="brush: php">

/**
* Add test_flag fields to the {custom_table} table.
*/
function custom_update_7001() {
  db_add_field(
    &#039;custom_table&#039;,
    &#039;test_flag&#039;,
    array(
      &#039;type&#039; =&gt; &#039;int&#039;,
      &#039;size&#039; =&gt; &#039;tiny&#039;,
      &#039;not null&#039; =&gt;TRUE,
      &#039;default&#039; =&gt; 0,
    )
  );
}
</pre>
<p>Drupal will automatically recognize that a new version of the module is available and will the run the function code when doing a database update with <strong>update.php</strong> or <strong>drush updb</strong>.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F04%2Fupdating-a-drupal-modules-schema%2F&amp;linkname=Updating%20a%20Drupal%20Module%26%238217%3Bs%20Schema">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/04/updating-a-drupal-modules-schema/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/04/updating-a-drupal-modules-schema/</feedburner:origLink></item>
		<item>
		<title>The Future of Drupal Upgrades is Migrate</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/h7r_Lo6hGJA/</link>
		<comments>http://blog.rapiddg.com/2012/03/the-future-of-drupal-upgrades-is-migrate/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 13:51:58 +0000</pubDate>
		<dc:creator>Jonathan Pichot</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[d8]]></category>
		<category><![CDATA[migrate]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=397</guid>
		<description><![CDATA[Major version upgrades in Drupal are hard. Drupal&#8217;s open-source  development process puts everything on the table every major release, including fundamental APIs and features. This allows Drupal to evolve as a platform, such as when fields moved into core in Drupal 7, and how Drupal 8 will adopt many components from Symfony2. But this also [...]]]></description>
			<content:encoded><![CDATA[<p>Major version upgrades in Drupal are hard.</p>
<p>Drupal&#8217;s open-source  development process puts everything on the table every major release, including fundamental APIs and features. This allows Drupal to evolve as a platform, such as when fields moved into core in Drupal 7, and how Drupal 8 will adopt many components from Symfony2. But this also means that every major version upgrade requires significant changes to your data structure.</p>
<p>Part of the challenge is that Drupal installations are never just core, but a large constellation of contributed modules with their own database tables. In other words, for any site more complicated than a basic install, its data is not just being handled by Drupal core, but by a handful of other modules, each with varying levels of complexity and maintainability.</p>
<p>The <a href="http://drupal.org/upgrade">typical upgrade procedure (for now) on Drupal.org</a> is to use Drupal&#8217;s built-in update mechanism, update.php. While update.php does a great job keeping your database schema up-to-date when making minor-point updates (eg. D7.10 to D7.12), it is severly limited in handling any major upgrade beyond a stock Drupal installation.</p>
<p>Update.php, for example, is capable of upgrading contributed module data only if the maintainer of that module has provided a new version and has written the requisite upgrade code. Established and well-maintained modules are usually good at this, but even the largest modules can go away. As the Drupal ecosystem evolves, better solutions emerge to common use-cases. For example, the <a href="http://drupal.org/project/references">D7 References</a> module, which includes the heavily used Node and User Reference fields, will likely be deprecated in Drupal 8 in favor of <a href="http://drupal.org/project/entityreference">Entity Reference</a>. This means that any site that uses User and Node reference fields will need to be upgraded to Entity Reference fields after D7. This kind of data shift between two different modules is only one of the challenges of major upgrades.</p>
<p>Update.php is also incapable of jumping Drupal versions. To upgrade from D5 to D7 using update.php, you&#8217;d have to first run D6&#8242;s update.php, then D7&#8242;s. With all this data shifting, it&#8217;s also common to have leftover database tables. These tables can bloat your databse, hurting performance and your data usage.</p>
<p>The solution is the Migrate module. Migrate uses an Object-Oriented process to take data from a source–database, CSV, JSON, etc–and insert it into a Drupal database. Each Migrate process is essentially a subclass of Migrate which defines what fields to import and any other needed logic. At the moment, Migrate requires a user to write these PHP classes themselves, since Migrate was originally targeted at importing data from non-Drupal sources. But a new project called <a href="http://drupal.org/sandbox/mikeryan/1234554">migrate_d2d</a> by mikeryan, lead maintainer of Migrate, aims to use Migrate for major version Drupal upgrades. At DrupalCon Denver 2012, mikeryan mentioned that he is looking at replacing update.php with migrate_d2d for all upgrades to D8.</p>
<p>This is awesome.</p>
<p>Migrate_d2d effectively takes a clean install of Drupal and brings in all your old data. This means only the data you need is imported, so no old, unused tables. And since Migrate can take data from one module and use another module&#8217;s hooks to import it, moving data from one module to another becomes possible. This process also opens up the ability to jump versions. This means, then, that a supported upgrade path from D6 to D8, for example, could become a reality.</p>
<p>If migrate_d2d matures enough for it to become the default major upgrade mechanism, it will help eleviate many of the upgrade frustrations in Drupal. This is particularly important for organizations who can&#8217;t afford to always rebuild their site after every major version release. With the added flexibility of migrate_d2d, the Migrate module will further secure Drupal as the CMS of choice for organizations large and small.</p>
<p><em>For more on Migrate, check out <a href="http://denver2012.drupal.org/program/sessions/getting-it-drupal-migrate">this DrupalCon Denver presentation</a> by drewish, and if you wait till the Q&amp;A, mikeryan talks a little about migrate_d2d.</em></p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fthe-future-of-drupal-upgrades-is-migrate%2F&amp;linkname=The%20Future%20of%20Drupal%20Upgrades%20is%20Migrate">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/03/the-future-of-drupal-upgrades-is-migrate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/03/the-future-of-drupal-upgrades-is-migrate/</feedburner:origLink></item>
		<item>
		<title>DrupalCon Denver 2012</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/bGFb1B21W3g/</link>
		<comments>http://blog.rapiddg.com/2012/03/drupalcon-denver-2012/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 13:37:25 +0000</pubDate>
		<dc:creator>Jonathan Pichot</dc:creator>
				<category><![CDATA[Company News]]></category>
		<category><![CDATA[denver]]></category>
		<category><![CDATA[drupalcon]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=404</guid>
		<description><![CDATA[Last week Mike and I were in Denver for the 2012 North American DrupalCon. Besides discovering a great city–and having one of the best burgers I have ever had–we were able to check the pulse of the Drupal community. An important part every DrupalCon is discovering where the community is headed. Below are the six themes [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">Last week Mike and I were in Denver for the 2012 North American DrupalCon. Besides discovering a great city–and having <a href="http://cherrycricket.com/">one of the best burgers I have ever had</a>–we were able to check the pulse of the Drupal community.</p>
<p style="text-align: left">An important part every DrupalCon is discovering where the community is headed. Below are the six themes I came away with from DrupalCon this year, separated by topics relevant immediately, and important topics about the future of the platform.</p>
<ul>
<li>Present
<ul>
<li>Life without Views: View Modes and FieldEntityQuery</li>
<li>SASS for Drupal Theming</li>
<li>Separation of Concerns: The 5 layers of Drupal</li>
</ul>
</li>
<li>Future
<ul>
<li><a href="http://blog.rapiddg.com/2012/03/drupal-and-symfony-2/">Symfony2 Components in Drupal8</a></li>
<li><a href="http://blog.rapiddg.com/2012/03/the-future-of-drupal-upgrades-is-migrate/">Migrate: The future of Drupal major upgrades</a></li>
<li>Blocks Everywhere: The future of Drupal layouts</li>
</ul>
</li>
</ul>
<p>Mike has <a href="http://blog.rapiddg.com/2012/03/drupal-and-symfony-2/">already written on the Symfony2 integration</a>, which I link to in the list. I&#8217;ve written about the <a href="http://blog.rapiddg.com/2012/03/the-future-of-drupal-upgrades-is-migrate/">future of Migrate</a>. I&#8217;m hoping to address several of the other topics in the coming weeks.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupalcon-denver-2012%2F&amp;linkname=DrupalCon%20Denver%202012">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/03/drupalcon-denver-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/03/drupalcon-denver-2012/</feedburner:origLink></item>
		<item>
		<title>Rdio vs. Spotify</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/skHLjHeWAiE/</link>
		<comments>http://blog.rapiddg.com/2012/03/rdio-vs-spotify/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 18:36:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Music & Media]]></category>
		<category><![CDATA[Technical Articles]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=270</guid>
		<description><![CDATA[In a previous post I discussed the growing shift of music listeners from owning to streaming their music.  Now I&#8217;m going to take a quick look at what I would consider to be the two best streaming services.  I have used both Rdio and Spotify over the past year and they both have their advantages. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rapiddg.com/wp-content/uploads/2011/09/rdio-v-spotify.gif"><img class="aligncenter size-full wp-image-271" title="rdio-v-spotify" src="http://blog.rapiddg.com/wp-content/uploads/2011/09/rdio-v-spotify.gif" alt="" width="600" height="149" /></a></p>
<p>In a <a title="Music: Own vs. Stream" href="http://blog.rapiddg.com/2011/08/music-own-vs-stream/">previous post</a> I discussed the growing shift of music listeners from owning to streaming their music.  Now I&#8217;m going to take a quick look at what I would consider to be the two best streaming services.  I have used both Rdio and Spotify over the past year and they both have their advantages.  The good thing is that the competition between them will make better products for us.  I am currently using Rdio after about 8 months with Spotify; switching because of the Rdio desktop client refresh.  One nice advantage to these services is that they both have free plans, which in my case, means I can switch between the two premium plans as I feel like without losing my settings, etc.</p>
<p><span id="more-270"></span></p>
<p>Rdio has recently released a new desktop client that has been dramatically improved from the previous version.  It took a lot of queues from Spotify and iTunes giving you quicker access to features and playlists in the left column.  It has also improved the social aspect showing you quickly which of your friends have listened to specific albums or songs.</p>
<p>Spotify&#8217;s desktop on the other hand has remained fairly constant with the exception of the new Spotify Apps feature.  This is a great feature that allows third party developers to create custom apps within the Spotify interface.  Apps like Rolling Stone which give you access to the lists that the magazine has assembled over the years.  Billboard offers all of the top 100 lists for the variety of genres.  There are over a dozen apps now, and they provide a lot of functionality for the Spotify desktop, which in my eyes adds a lot of value.</p>
<p>I would say that in general, before Rdio&#8217;s update I preferred Spotify&#8217;s desktop experience.  It seemed quicker, more responsive, simpler, and just more comfortable.  But Rdio&#8217;s new app made things much simpler, and user friendly, and I&#8217;m enjoying using this new app very much, though I would say it is still not as responsive as Spotify.  Some things I am still missing from Spotify are the apps, and the flexibility of mobile syncing.  Spotify&#8217;s user base is also much larger making it better for interacting with friends.  Spotify&#8217;s audio quality seems to be a bit better as well.  While they both say they are using high bit-rates, the highs and lows of Rdio seem to be lacking a bit.  Rdio does say on their site that they are constantly adjusting the compression of the music to make things as good as possible.</p>
<p>Rdio&#8217;s app is much more album centric.  It makes it easy to listen to whole albums, and organize these albums in your collection.  While it certainly isn&#8217;t difficult to listen to albums on Spotify, the app in general is much more focused on individual songs and not so much what album they belong to.  As someone who appreciates a complete album listening experience I like Rdio&#8217;s album centric interface.</p>
<p>Spotify&#8217;s catalog claims to be much larger than Rdio&#8217;s, however I will say of the songs I listen to there are about the same number of missing tracks in both apps compared to the other.  So this is pretty much a wash.</p>
<p>While the mobile apps are quite different from each other, I wouldn&#8217;t say I prefer one greatly over the other.  Spotify&#8217;s app is very simplistic, just showing your your play lists, which is nice for quickly listening to music, but Rdio&#8217;s app has more &#8220;features&#8221; and is a basically their desktop compressed for the iPhone.  Both apps run into problems if your streaming through air play, but I believe it relates to a problem with the phone itself.  After you begin streaming, and say&#8230; put the phone back in your pocket, it will only last about a song or two before cutting out.  I did a fair amount of research and determined that this is due to the phone switching off wi-fi back to the cell network.  Obviously this would terminate the local wi-fi air play connection.  But this is unfortunate as it would be really nice to play on the stereo via phone.  Luckily there is the iPad.</p>
<p>One big advantage Rdio has is that they actually a provide an iPad app (now in HD).  I use air play a great deal.  Basically anytime I want to listen to music on the home stereo.  Using an iPad (wi-fi only) I can stream music consistently without interruption.  With Spotify you can use the iPhone app, upscaled, but this isn&#8217;t too pretty.  Rdio on the other hand has a very functional iPad app, that acts a lot like the desktop client.  Spotify has said on multiple occasions that getting an iPad app out is one of their top priorities, but as of the writing of this article, no app yet.  This is a pretty important feature that Rdio has upper hand on in my book.</p>
<p>So this is my assessment after a almost a year of usage.  Both platforms will continue to change and &#8220;one up&#8221; the other, but hopefully both are around for the long haul.</p>
<p>If you have additional considerations or features I forgot to mention leave a comment and let me know.  Thanks.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Frdio-vs-spotify%2F&amp;linkname=Rdio%20vs.%20Spotify">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/03/rdio-vs-spotify/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/03/rdio-vs-spotify/</feedburner:origLink></item>
		<item>
		<title>Drupal and Symfony 2</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/TuqE3hbCk7s/</link>
		<comments>http://blog.rapiddg.com/2012/03/drupal-and-symfony-2/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 22:01:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal 8]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=368</guid>
		<description><![CDATA[We here at Rapid Development Group are first and foremost Drupal developers, and have become the &#8220;go-to&#8221; people for anything related to the popular CMS. A large chunk of our work is in some form or another related to a Drupal site (even if it is an iOS app that connects to a Drupal backend). [...]]]></description>
			<content:encoded><![CDATA[<p>We here at Rapid Development Group are first and foremost Drupal developers, and have become the &#8220;go-to&#8221; people for anything related to the popular CMS.  A large chunk of our work is in some form or another related to a Drupal site (even if it is an iOS app that connects to a Drupal backend).</p>
<p>Outside of this I have always been interested in other development frameworks, especially ones that implement the traditional MVC architecture, and have ORM configuration all within code that is easily versioned and deployed.  These kinds of framework allow for quick application development when the weight of CMS functionality isn&#8217;t needed.  Something that Ruby on Rails has become so popular for providing.</p>
<p><span id="more-368"></span></p>
<p>Years ago, Cake was the hotness that brought this (RoR) type functionality to the PHP world, and as PHP has evolved and become more object-oriented more frameworks have popped up.  In the past year I gained more interest in these frameworks especially as it relates to the new versions of PHP.  PHP 5 introduced classes and a few other OOP structures, and by version 5.3 has become very refined in handling the whole suite of OOP structures (polymorphism, inheritance, etc).</p>
<p>The problem with many PHP frameworks is that they catered to those using older versions of PHP to reach a wider audience.  But as PHP 5.3 has become adopted there are frameworks being created that require it, which means they are lighter in weight, faster, and more efficient because they do not include all of the logic to make them backward compatible.</p>
<p>So I began researching these, and while there were a number of options, the one that seemed to stand out the most was <a href="http://www.yiiframework.com/">Yii</a>.  This had great documentation, and a strong community of developers backing it.  It&#8217;s performance stats were superior to most others, and it is very flexible.  At this time Symfony 2 existed, but was still in beta.  Symfony 1 had been a success, but like many other frameworks adapted older versions of PHP.</p>
<p>So while Symfony looked like a good option, I chose to pursue Yii because of it&#8217;s current stability.  Fast forward a few months and Drupal announces a partnership with Symfony, and symfony 2 is fully released.  I was knee deep in Yii, but if symfony was ready to go it deserved another look, but more importantly, Symfony was going to be a part of the Drupal realm of which we are happily entrenched.  So I made the decision to leave Yii and begin studying and learning the ins and outs of symfony.</p>
<p>At this point I didn&#8217;t know how much Drupal was going to include the symfony architecture.  The more I worked and played with Symfony the more I realized how clean, and powerful it is to use.  I was&#8230; dare I say&#8230; falling in love?</p>
<p>Now I am at Drupalcon Denver, and I am able to get a glimpse into the vision for the Drupal roadmap, especially as it relates to the next version of Drupal, (Drupal 8, which at this time is expected to release in spring/summer of 2013).  There are some primary objectives for the next release and Symfony fits many of those like a glove.</p>
<p>At a high level drupal 8 will be moving to a &#8220;<a href="http://groups.drupal.org/drupal-8-blocks-layouts-everywhere-initiative" target="_blank">Blocks Everywhere</a>&#8221; layout approach.  A page layout will consist of &#8220;blocks&#8221;, and blocks will contain other &#8220;blocks&#8221;.  I put blocks in quotes since these really are not like the blocks structure drupal currently uses. For each of these blocks, a REST url will provide the contents.  This is a huge win for caching because only the block that is changing will need to refresh.  This goes hand in hand with another initiative&#8230; to use reverse proxy, which is needed to execute this &#8220;Blocks Everywhere&#8221; approach.  And lastly, there is a slow migration to a more object oriented code base, and this will continue in Drupal 8.  Contributed modules like Views, Beans, Migrate, etc. have already made this jump in their latest code releases.  These initiatives for Drupal 8 have been established in Symfony, so rather than rewrite this infrastructure why not partner with a framework that has executed these principles better than anyone else.</p>
<p>I hope to elaborate more on the initiatives of Drupal 8 as well as the main themes of DrupalCon Denver.</p>
<p>What adds to the &#8220;synergy&#8221; is that Fabien Potencier, the creator of Symfony, is also excited about this partnership and will be working with the Drupal team to integrate his amazing framework with what we consider to be the best CMS.</p>
<p>For more information on this partnership, there are other more legitimate articles to read, from the creators themselves&#8230;</p>
<ul>
<li><a href="http://buytaert.net/8-steps-for-drupal-8" target="_blank">http://buytaert.net/8-steps-for-drupal-8</a></li>
<li><a href="http://symfony.com/blog/symfony2-meets-drupal-8" target="_blank">http://symfony.com/blog/symfony2-meets-drupal-8</a></li>
</ul>
<p>I&#8217;ll stick to commentary and other trends I&#8217;m seeing within the Drupal network.</p>
<p>&nbsp;</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F03%2Fdrupal-and-symfony-2%2F&amp;linkname=Drupal%20and%20Symfony%202">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/03/drupal-and-symfony-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/03/drupal-and-symfony-2/</feedburner:origLink></item>
		<item>
		<title>Drupal’s EntityFieldQuery and Taxonomy</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/Mf9qN7FpE-g/</link>
		<comments>http://blog.rapiddg.com/2012/02/drupals-entityfieldquery-and-taxonomy/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 15:49:48 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[Drupal 7]]></category>
		<category><![CDATA[EntityFieldQuery]]></category>
		<category><![CDATA[Taxonomy]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=348</guid>
		<description><![CDATA[Drupal 7&#8242;s powerful EntityFieldQuery class can be used as an alternative to writing a view (and using views_get_view_result). When attempting to grab a list of terms in a vocabulary you can do the following. $taxonomy_query = new EntityFieldQuery; $taxonomy_query-&#62;entityCondition(&#039;entity_type&#039;, &#039;taxonomy_term&#039;) -&#62;propertyCondition(&#039;vid&#039;, 2) -&#62;propertyOrderBy(&#039;weight&#039;); $taxonomy_terms = $taxonomy_query-&#62;execute(); foreach ($taxonomy_terms[&#039;taxonomy_term&#039;] as $tid =&#62; $term) { # code... [...]]]></description>
			<content:encoded><![CDATA[<p>Drupal 7&#8242;s powerful <a href="http://api.drupal.org/api/drupal/includes!entity.inc/class/EntityFieldQuery/7" target="_blank">EntityFieldQuery</a> class can be used as an alternative to writing a view (and using <a href="http://drupalcontrib.org/api/drupal/contributions%21views%21views.module/function/views_get_view_result/7" target="_blank">views_get_view_result</a>).</p>
<p>When attempting to grab a list of terms in a vocabulary you can do the following.</p>
<pre class="brush: php">
$taxonomy_query = new EntityFieldQuery;
$taxonomy_query-&gt;entityCondition(&#039;entity_type&#039;, &#039;taxonomy_term&#039;)
  -&gt;propertyCondition(&#039;vid&#039;, 2)
  -&gt;propertyOrderBy(&#039;weight&#039;);

$taxonomy_terms = $taxonomy_query-&gt;execute();

foreach ($taxonomy_terms[&#039;taxonomy_term&#039;] as $tid =&gt; $term) {
  # code...
}
</pre>
<p>I didn&#8217;t come across any good examples of this the Drupal docs, or anywhere else for that matter.  Hope this helps.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupals-entityfieldquery-and-taxonomy%2F&amp;linkname=Drupal%26%238217%3Bs%20EntityFieldQuery%20and%20Taxonomy">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/02/drupals-entityfieldquery-and-taxonomy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/02/drupals-entityfieldquery-and-taxonomy/</feedburner:origLink></item>
		<item>
		<title>Drupal 7 HTML E-Mail With PDF Attachments</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/WP2DoBK5ksA/</link>
		<comments>http://blog.rapiddg.com/2012/02/drupal-7-html-e-mail-with-pdf-attachments/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 02:46:40 +0000</pubDate>
		<dc:creator>rhunter</dc:creator>
				<category><![CDATA[Technical Articles]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=325</guid>
		<description><![CDATA[Are you having trouble getting attachments working on Drupal 7? You are not alone. Drupal pared back the core e-mail functionality quite a bit from 6 to 7. You can&#8217;t even send html mail anymore without installing a module. This article will focus on getting attachments working &#8211; then getting pdf attachments working, but we [...]]]></description>
			<content:encoded><![CDATA[<p>Are you having trouble getting attachments working on Drupal 7? You are not alone. Drupal pared back the core e-mail functionality quite a bit from 6 to 7. You can&#8217;t even send html mail anymore without installing a module. This article will focus on getting attachments working &#8211; then getting pdf attachments working, but we will be using Mime Mail, so a side effect will be HTML enabled mail. </p>
<p>Most of the solutions for sending mail with an attachment in Drupal 7 don&#8217;t seem to rely on Drupal modules. The most popular <a href="http://www.metachunk.com/blog/sending-e-mails-attachments-drupal-7">solution</a> to this problem is to basically circumvent Drupal and create a new php class to send your mail. I wanted to use a more Drupal centric solution.</p>
<p>My solution involves the modules <a href="http://drupal.org/project/mimemail">Mime Mail</a>, <a href="http://drupal.org/project/mailsystem">Mail System</a>, and <a href="http://drupal.org/project/print">Print</a>, along with our own custom module that we will write that will send the email.</p>
<p>To send an email with a pdf attachment, one must first be able to send an email with some kind of attachment at all. This is no small feat, as the documentation on this is <a href="http://drupal.org/node/1389504">severely lacking</a>. However, attachment functionality is built into the Mime Mail module. Most of the confusion seems to arise from 2 things: the fact that the attachments are set via $message['params']['attachments'], rather than $message['attachment'], and that attachments are an array of arrays. Another possible pitfall is that you must set up drupal_mail() to use mime mail as the mail system interface. This is where the mail system module comes into play. The module is pretty straightforward, and lets you set a different mail system per module. There is a straightforward configuration at admin/config/system/mailsystem where you create a new setting for your module, and select mime mail as the mail system.</p>
<p>To make sure that we can even send attachments, we test sending a .txt file that should exist on every site. This is the code that should be in your custom module to test for sending an attachment. I am using the case of a user submitting a form as the trigger to send the emails.</p>
<pre class="brush: php">
function _example_form_submit($form, &amp;$form_state) {
  _example_form_save($form, $form_state);
  global $user;
  $accounts = array($user, user_load(XX)); //you can add accounts to this array to notify
  example_notify($accounts, $user); //could also pass $form_state or other variables
}

function example_notify($accounts, $from) {
  $params[&#039;from&#039;] = $from;
  foreach ($accounts as $account) {
  $params[&#039;account&#039;] = $account;
  // example_mail() will be called based on the first drupal_mail() parameter.
  drupal_mail(&#039;example&#039;, &#039;notice&#039;, $account-&gt;mail, user_preferred_language($account), $params, $from-&gt;mail);

  drupal_set_message(&#039;This form has been emailed to &#039;. $account-&gt;name);
  }
}

function example_mail($key, &amp;$message, $params) {
  $data[&#039;user&#039;] = $params[&#039;from&#039;];
  $account = $data[&#039;user&#039;]-&gt;name;

  $attachment = array(
  &#039;filecontent&#039; =&gt; file_get_contents(DRUPAL_ROOT . &#039;/README.txt&#039;),
  &#039;filename&#039; =&gt; &#039;test.txt&#039;,
  &#039;filemime&#039; =&gt; &#039;text/plain&#039;,
  );

  switch($key) {
  case &#039;notice&#039;:
  $langcode = $message[&#039;language&#039;]-&gt;language;
  $message[&#039;subject&#039;] = &#039;example submission from&#039; . $account;
  $message[&#039;body&#039;][] =&#039;&lt;p&gt;&#039;. $account .&#039; has submitted an example.&lt;/p&gt;&#039;;
  $message[&#039;params&#039;][&#039;attachments&#039;][] = $attachment;
  break;
  }
}
</pre>
<p>Hooray! Attachments are now working! Not too bad once you gather all the pieces together. Now, onto producing pdf attachments. </p>
<p>We will use the pdf generation capabilities of the print module. Installing and configuring the module is beyond the scope of this blog post, but I can tell you that it is easier than you think it would be and the directions on the module page are pretty straightforward. Now that we have this module installed and configured to show pdf versions of pages on the site, we need to tap into the print_pdf module in our custom code. We are going to access a hook of the print_pdf module called print_pdf_generate_path. This function is poorly named, since it&#8217;s return value is not a path at all, but is instead the actual file data for the pdf being created. We pipe this into the filecontent of our attachment and we are good to go.</p>
<pre class="brush: php">
function _example_form_submit($form, &amp;$form_state) {
  _example_form_save($form, $form_state);
  global $user;
  $accounts = array($user, user_load(XX)); //you can add accounts to this array to notify
  example_notify($accounts, $user); //could also pass $form_state or other variables
}

function example_notify($accounts, $from) {
  $params[&#039;from&#039;] = $from;
  foreach ($accounts as $account) {
  $params[&#039;account&#039;] = $account;
  // example_mail() will be called based on the first drupal_mail() parameter.
  drupal_mail(&#039;example&#039;, &#039;notice&#039;, $account-&gt;mail, user_preferred_language($account), $params, $from-&gt;mail);

  drupal_set_message(&#039;This form has been emailed to &#039;. $account-&gt;name);
  }
}

function example_mail($key, &amp;$message, $params) {
  $data[&#039;user&#039;] = $params[&#039;from&#039;];
  $account = $data[&#039;user&#039;]-&gt;name;

  module_load_include(&#039;inc&#039;, &#039;print_pdf&#039;, &#039;print_pdf.pages&#039;);
  $file_content = module_invoke(&#039;print_pdf&#039;, &#039;generate_path&#039;, &#039;example-url/&#039;);

  $attachment = array(
  &#039;filecontent&#039; =&gt; $file_content,
  &#039;filename&#039; =&gt; &#039;example-filename&#039;,
  &#039;filemime&#039; =&gt; &#039;application/pdf&#039;,
  );

  switch($key) {
  case &#039;notice&#039;:
  $langcode = $message[&#039;language&#039;]-&gt;language;
  $message[&#039;subject&#039;] = &#039;example submission from &#039;. $account;
  $message[&#039;body&#039;][] =&#039;&lt;p&gt;&#039;. $account .&#039; has submitted an example.&lt;/p&gt;&#039;;
  $message[&#039;params&#039;][&#039;attachments&#039;][] = $attachment;
  break;
  }
}
</pre>
<p>It&#8217;s downright simple once you see the example code, but believe me this took a lot of trial and error (since googling didn&#8217;t seem to lead to much useful information) to get everything to meld together. Of particular note is the use of module_load_include in order to access functions of other modules that exist outside of the main .module file. If you have any suggestions for improvement, or have questions, feel free to leave comments below. </p>
<p>Portions of this code were adapted from other examples available, but I don&#8217;t remember exactly from where. Mad props go out to you, Drupal community.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F02%2Fdrupal-7-html-e-mail-with-pdf-attachments%2F&amp;linkname=Drupal%207%20HTML%20E-Mail%20With%20PDF%20Attachments">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/02/drupal-7-html-e-mail-with-pdf-attachments/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/02/drupal-7-html-e-mail-with-pdf-attachments/</feedburner:origLink></item>
		<item>
		<title>Building a flexible layout with jQuery splitters and accordions</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/n_WJxtIMMjQ/</link>
		<comments>http://blog.rapiddg.com/2012/01/building-a-flexible-layout-with-jquery-splitters-and-accordions/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 23:29:14 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Technical Articles]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=314</guid>
		<description><![CDATA[This is part 1 of a series: The Learning jQuery code browser. This article series explores the construction of the code browser tool that accompanies the book Learning jQuery, Third Edition. The first challenge in building the code browser was finding a way to present all of the information required simultaneously. We need to be [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part 1 of a series: <a href="http://blog.rapiddg.com/2011/12/the-learning-jquery-code-browser/">The Learning jQuery code browser</a>. This article series explores the construction of the <a href="http://book.learningjquery.com/6549/codebrowser/">code browser</a> tool that accompanies the book <a href="http://www.packtpub.com/learning-jquery-for-interaction-design-web-development-with-javascript/book">Learning jQuery, Third Edition</a>.</em></p>
<p>The first challenge in building the code browser was finding a way to present all of the information required simultaneously. We need to be able to see the JavaScript code side-by-side with the finished product, while at the same time having easy access to the associated HTML and CSS for reference. In addition, we need controls for navigating among code samples easily.</p>
<p>The finished product uses a combination of accordion and splitter widgets to accomplish this.<br />
<a href="http://blog.rapiddg.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-31-at-5.48.10-PM.png"><img src="http://blog.rapiddg.com/wp-content/uploads/2011/12/Screen-Shot-2011-12-31-at-5.48.10-PM-300x144.png" alt="" title="jQuery Code Browser Layout" width="300" height="144" class="aligncenter size-medium wp-image-315" /></a></p>
<p>A combination of HTML, CSS, and JavaScript is needed to put this together. First, the HTML.</p>
<pre class="brush: html">
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;title&gt;Learning jQuery Code Listing Browser&lt;/title&gt;

    &lt;link rel=&quot;stylesheet&quot; href=&quot;jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css&quot; media=&quot;screen&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;browse.css&quot; media=&quot;screen&quot;&gt;
    &lt;script src=&quot;jquery-1.5.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;jquery-ui/js/jquery-ui-1.8.9.custom.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;jquery.history.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;splitter.js&quot;&gt;&lt;/script&gt;

    &lt;script src=&quot;browse.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id=&quot;container&quot;&gt;
      &lt;div id=&quot;navigation&quot;&gt;
        &lt;h1&gt;Learning jQuery, Third Edition&lt;/h1&gt;
        &lt;label for=&quot;chapter&quot;&gt;Chapter&lt;/label&gt;
        &lt;select name=&quot;chapter&quot; id=&quot;chapter&quot; size=&quot;1&quot;&gt;&lt;/select&gt;

        &lt;label for=&quot;step&quot;&gt;Code Listing&lt;/label&gt;
        &lt;div class=&quot;ui-state-default ui-corner-all&quot;&gt;&lt;a href=&quot;#prev&quot; id=&quot;prev&quot; class=&quot;ui-icon ui-icon-triangle-1-w&quot;&gt;Prev&lt;/a&gt;&lt;/div&gt;
        &lt;input type=&quot;text&quot; name=&quot;step&quot; value=&quot;1&quot; id=&quot;step&quot;&gt;
        &lt;div class=&quot;ui-state-default ui-corner-all&quot;&gt;&lt;a href=&quot;#next&quot; id=&quot;next&quot; class=&quot;ui-icon ui-icon-triangle-1-e&quot;&gt;Next&lt;/a&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div id=&quot;content&quot;&gt;
        &lt;div id=&quot;splitter&quot;&gt;
          &lt;div id=&quot;left-pane&quot;&gt;
            &lt;h3&gt;&lt;a href=&quot;#html&quot;&gt;HTML&lt;/a&gt;&lt;/h3&gt;
            &lt;div class=&quot;panel&quot; id=&quot;html&quot;&gt;&lt;/div&gt;
            &lt;h3&gt;&lt;a href=&quot;#css&quot;&gt;CSS&lt;/a&gt;&lt;/h3&gt;
            &lt;div class=&quot;panel&quot; id=&quot;css&quot;&gt;&lt;/div&gt;
            &lt;h3&gt;&lt;a href=&quot;#javascript&quot;&gt;JavaScript&lt;/a&gt;&lt;/h3&gt;
            &lt;div class=&quot;panel&quot; id=&quot;javascript&quot;&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div id=&quot;right-pane&quot;&gt;
            &lt;div&gt;
              &lt;iframe id=&quot;result&quot;&gt;&lt;/iframe&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This HTML 5 code sets up divisions for the navigation area, the left pane, and the right pane. Within the left pane we have subdivisions for HTML, CSS, and JavaScript code.</p>
<p>There is obviously a significant amount of CSS involved here. The following is the portion of the CSS required for the basic page structure.</p>
<pre class="brush: css">
#navigation {
  padding: 10px 0;
  height: 20px;
  background-color: #000;
  color: #fff;
}

#left-pane {
  width: 250px;
}
#right-pane {
}

#splitter {
  clear: left;
  height: 100%;
  overflow: hidden;
}
#right-pane &gt; div {
  padding-left: 20px;
  height: 100%;
}
#result {
  width: 100%;
  height: 100%;
  border: none;
}
</pre>
<p>With this HTML and CSS in place, we have a start at our page layout. There is still more work to do in styling the page, but in this instance we won&#8217;t care about graceful degradation for users without JavaScript enabled, since all of the code examples rely on JavaScript anyway. So, we&#8217;ll leave the rest of the styling work to the jQuery plugins we&#8217;ve been using.</p>
<p><strong>The accordion widget</strong></p>
<p>An accordion widget is pretty simple. we simply need to expand one item while collapsing the others. A basic approach is easy to outline:</p>
<pre class="brush: js">
$(document).ready(function() {
  $(&#039;#left-pane h3&#039;).click(function() {
    $(&#039;#left-pane div:visible&#039;).slideUp();
    $(this).next().slideDown();
  });
});
</pre>
<p>This gets the very rudimentary job done, but there are lots of details left untended. For example:</p>
<ul>
<li>Setting up the initially-visible item</li>
<li>Gracefully handling clicks on the currently-active item</li>
<li>Keyboard support</li>
<li>Visual feedback that the titles are clickable</li>
<li>Expanding the active item to take up as much vertical space as possible</li>
<li>Various styling enhancements</li>
</ul>
<p>These are all things we could take care of ourselves, but there&#8217;s no need to when the jQuery UI project has done the job for us. The <a href="http://jqueryui.com/demos/accordion/">jQuery UI accordion widget</a> is simple to use, and very powerful.</p>
<pre class="brush: js">
$(document).ready(function() {
  $(&#039;#left-pane&#039;).accordion({
    fillSpace: true,
    active: 2
  });
]);
</pre>
<p>A call to .accordion() does almost all the work. The only parameters we have to provide are fillSpace, which makes sure the accordion uses all the vertical space available to it, and active, which lets us tell the widget to reveal the third item (the one containing JavaScript code) initially and to hide the other two.</p>
<p><strong>The splitter widget</strong></p>
<p>The accordion conserves vertical space in the left column. We also want to give the user flexibility, though, in deciding how much of the screen to devote to the source code and how much to the rendered output. A splitter widget will accomplish this.</p>
<p>Again, using a jQuery plugin is much more efficient than trying to write the code ourselves. The jQuery UI project doesn&#8217;t have a candidate to try, but <a href="http://methvin.com/splitter/">Dave Methvin&#8217;s splitter plugin</a> will fit the bill nicely.</p>
<p>Again, using the plugin couldn&#8217;t be very much simpler.</p>
<pre class="brush: js">
$(document).ready(function() {
  $(&#039;#splitter&#039;).splitter({
    type: &#039;v&#039;,
    anchorToWindow: true,
    cursor: &#039;col-resize&#039;
  });
});
</pre>
<p>We are using three parameters in our call to .splitter() to reach the desired effect. The type parameter lets us specify that the splitter will run vertically (splitting the content horizontally). The anchorToWindow parameter ensures that the splitter fills up the entire window height, even when the window is resized. Finally, the cursor parameter allows us to choose an appearance for the mouse cursor while it is over the splitter, to give the user extra feedback.</p>
<p>With these two plugins in place and active, users can now switch between the three source code viewing areas at will using the accordion widget, and resize the source code and output areas using the splitter widget. Next up, we&#8217;ll be looking at how we populate these areas with real content.</p>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2012%2F01%2Fbuilding-a-flexible-layout-with-jquery-splitters-and-accordions%2F&amp;linkname=Building%20a%20flexible%20layout%20with%20jQuery%20splitters%20and%20accordions">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2012/01/building-a-flexible-layout-with-jquery-splitters-and-accordions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2012/01/building-a-flexible-layout-with-jquery-splitters-and-accordions/</feedburner:origLink></item>
		<item>
		<title>The Learning jQuery code browser</title>
		<link>http://feedproxy.google.com/~r/rapiddg/~3/ltTVOWaL5g0/</link>
		<comments>http://blog.rapiddg.com/2011/12/the-learning-jquery-code-browser/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 22:08:35 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Technical Articles]]></category>

		<guid isPermaLink="false">http://blog.rapiddg.com/?p=311</guid>
		<description><![CDATA[This year, Karl and I completed the third edition of Learning jQuery. We&#8217;re very excited about the updates, which bring the book in line with the newest features of the library. We also used this opportunity to take our reader feedback into account. Exercises were added to the end of each chapter. The examples readers [...]]]></description>
			<content:encoded><![CDATA[<p>This year, Karl and I completed the third edition of <a href="http://www.packtpub.com/learning-jquery-for-interaction-design-web-development-with-javascript/book">Learning jQuery</a>. We&#8217;re very excited about the updates, which bring the book in line with the newest features of the library. We also used this opportunity to take our reader feedback into account. Exercises were added to the end of each chapter. The examples readers found confusing were elaborated on or rewritten. The biggest change, though, related to the structure of the second half of the book and the code examples therein.</p>
<p>Readers liked the first seven chapters of the earlier editions, which build up the basic concepts of the jQuery library. Each uses a self-contained web page, with all the code examples in the chapter relating to that page. In the second half of the book, though, all of the examples referred to the same fictional web site. While this gave a nice &#8220;real-world&#8221; feel to these examples, in practice readers were confused by multiple chapters requiring the same code base. It was also difficult for readers to view the effect of just one example in isolation from everything else that was going on. In addition, to accurately represent the code to the user, many pages at the end of the chapter needed to be devoted to code listings that were largely repetitive—pages that could instead be used for more explanatory prose.</p>
<p>To remedy this, the second half of the book was completely rewritten. Rather than being structured around concepts such as &#8220;tables&#8221; and &#8220;forms,&#8221; the chapters now mirror the structure of the first half of the book, stepping through the basic jQuery building blocks, but this time from a more advances perspective. This approach allowed us once again to use small web pages for each chapter, with all code examples for a chapter working on the same content.</p>
<p>What remained was the problem of handling the large code listings. A code download is provided with the book, so we felt a printed copy of all code was not particularly helpful to the reader. Instead, we wanted a way for the reader to be able to execute and experiment with the code at any stage of its development in a chapter. We also wanted to present this in a visually helpful way.</p>
<p>The result is the <a href="http://book.learningjquery.com/6549/codebrowser/">Learning jQuery Code Browser</a>. This tool allows readers to view any listing in the book in the context of the rest of the code. They can see exactly which lines of code have changed, view the HTML and CSS the script applies to, and view the result of that code when run against the page.</p>
<p>This tool was built quite quickly, and is hardly a paragon of engineering, but nonetheless readers have found it very useful already. Creating it required work in HTML, CSS, PHP, and JavaScript, including the incorporation of several third-party libraries. This makes it worthy of some study as an example. In an upcoming series of articles, I&#8217;ll be breaking down the pieces and parts of the code browser, discussing how each component works. Topics will include:</p>
<ul>
<li>Building a flexible layout with jQuery splitters and accordions</li>
<li>Combining HTML, CSS, and JavaScript on demand</li>
<li>Simple navigation UI widgets</li>
<li>Managing browser history and the back button</li>
<li>Syntax highlighting with GeSHi</li>
<li>Writing a simple &#8220;diff&#8221; script to highlight changed lines of code</li>
</ul>
<a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/digg.png" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/delicious.png" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/msdn?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="MSDN" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/msdn.png" alt="MSDN"/></a> <a href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/google.png" alt="Google Bookmarks"/></a> <a href="http://www.addtoany.com/add_to/gmail?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser" title="Gmail" rel="nofollow" target="_blank"><img src="http://blog.rapiddg.com/wp-content/plugins/add-to-any/icons/gmail.png" alt="Gmail"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fblog.rapiddg.com%2F2011%2F12%2Fthe-learning-jquery-code-browser%2F&amp;linkname=The%20Learning%20jQuery%20code%20browser">Share/Save</a>]]></content:encoded>
			<wfw:commentRss>http://blog.rapiddg.com/2011/12/the-learning-jquery-code-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.rapiddg.com/2011/12/the-learning-jquery-code-browser/</feedburner:origLink></item>
	</channel>
</rss>

