Growing Venture Solutions - GVS - cracking drupal http://growingventuresolutions.com/taxonomy/term/51/0 en Designing the site: CrackingDrupal.com - How to build a "speaking" navigation http://growingventuresolutions.com/blog/designing-site-crackingdrupal-com-how-build-speaking-navigation <div style="float: right;"><img src="http://growingventuresolutions.com/gvsfiles/imagecache/bio_small/hs-mezcal_0.jpg" alt="Evelyn's photo" /></div> <p>Hello - I'm Evelyn and I have recently joined GVS as a designer and usability tester. I have been working as a freelancer for the past seven years, and now that my daughter is entering 1st grade I am excited to be spending more face time with grown-ups!</p> <p>My first task as a designer with GVS was to design a site for Greg's book: "Cracking Drupal". This was also my first real-world experience theming for Drupal and with some help, it was pretty simple.</p> <p>I began by chatting with Greg about what he wanted the site to do and how it should look. I also gave him a simple design worksheet to complete with questions such as "Who is your target audience?" and "How do you want people to describe your site?" (If I could ask only one question, this last one would be it.) Greg wanted the site to draw on the cover of the book, and wanted it to be elegant, streamlined and easy to navigate.</p> <p><strong>Book Cover:</strong> As a starting point it was an obvious choice to take the book cover and modify it into the header and footer. I pulled the color palette from the cover as well, and added a burnt orange accent to offset the strong blues and blacks. In general I try to avoid black text on white, so the body copy and some headers are actually a dark blue.</p> <p><strong>Elegant:</strong> I always strive for elegance. By elegance I don't mean just "tasteful, refined or dignified" (Oxford American Dictionary.) For me, elegance in web design is integral to good usability. Even grungy, busy sites, when done well, can be described as elegant. So for Cracking Drupal that meant a clear hierarchy and harmonious color scheme taken from the book.</p> <p><strong>Streamlined and easy to navigate:</strong> Putting myself in the position of the site user, I looked at the main navigation areas Greg wanted. I have to admit that while I sort of knew what "errata" meant, I wouldn't have bet money on it. That led to the use of "Speaking Tabs" - navigation tabs that have a subtext area that describes what one will find on that page. I've seen these tabs here and there and wanted to try them out. I thought they'd be a perfect way to clarify some terminology, but they serve several other purposes as well:</p> <ol> <li>liven up the header area of the site, </li> <li>promote "Growing Venture Solutions" with a prominent position,</li> <li>explain that clicking "purchase" will take you to Amazon.com, and</li> <li>simplify the user experience by letting people know specifics like <em>what excerpts</em> exactly, <em>what downloads</em> are available, etc., without them having to poke around. (Less clicking for some folks = better user experience.)</li> </ol> <p><img src="http://growingventuresolutions.com/gvsfiles/speaking_nav.png" alt="speaking navigation in cracking Drupal menu" /></p> <h3>Create Speaking Navigation in Drupal</h3> <p>For this site we could have just hardcoded the "speaking tabs" text into the theme, but we wanted to do this in a more sustainable way that we could actually use for clients some day. So, how to get the text onto the tabs in a way that is admin editable? We used the Primary Links and put the "speaking" part of the tabs into the "Description:" element of each menu item. Next up was to override the default <a href="http://api.drupal.org/api/function/theme_links">theme_links</a> function to show that text.</p> <p>We created a theme specific override of the function, copied over the default code, and replaced the default line:</p> <p><code>$output .= l($link[&#039;title&#039;], $link[&#039;href&#039;], $link);</code></p> <p>With a bit more code:</p> <p><div class="codeblock"><code>if (isset($link[&#039;attributes&#039;][&#039;title&#039;]) &amp;&amp; $attributes[&#039;class&#039;] != &#039;links inline&#039;) {<br />&nbsp; $link[&#039;html&#039;] = TRUE;<br />&nbsp; $output .= l(check_plain($link[&#039;title&#039;]) . &#039;&lt;span class=&quot;speaking-nav&quot;&gt;&#039;.&nbsp; filter_xss_admin($link[&#039;attributes&#039;][&#039;title&#039;])&nbsp; &#039;&lt;/span&gt;&#039;, $link[&#039;href&#039;], $link);<br />}<br />else {<br />&nbsp; $output .= l($link[&#039;title&#039;], $link[&#039;href&#039;], $link);<br />}</code></div></p> <p>The first line is an important one. The theme_links function is used for a lot of things so this conditional checks for menus that have a description set and where it's not an inline link (you know, those things under a node or comment). For this site that's a solid enough check that it only applies to the primary links, but you may need to do something more.</p> <p>The fun part is inside that conditional where we tell the l function to expect HTML so that we can add a little span with the description in it and then run <a href="http://api.drupal.org/api/function/check_plain">check_plain</a> and <a href="http://api.drupal.org/api/function/filter_xss_admin">filter_xss_admin</a> on the user entered bits to stay safe (naturally).</p> <p>The final result is a site that remains with the style of the book while adding a little extra fun.</p> http://growingventuresolutions.com/blog/designing-site-crackingdrupal-com-how-build-speaking-navigation#comments Planet Drupal cracking drupal design theming Wed, 24 Jun 2009 04:27:13 +0000 evelyn 495 at http://growingventuresolutions.com