<?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>Little Bird LLC &#187; php</title>
	<atom:link href="http://littlebirdllc.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://littlebirdllc.com</link>
	<description>Little Bird makes cozy, quirky and weathered websites for small businesses, individuals and the soon-to-be married.</description>
	<lastBuildDate>Wed, 28 Jul 2010 00:44:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Customizing Drupal Menus</title>
		<link>http://littlebirdllc.com/customizing-drupal-menus/</link>
		<comments>http://littlebirdllc.com/customizing-drupal-menus/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 21:28:53 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[tutorials]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://ahhh-design.com/wp_templates/scribble/?p=653</guid>
		<description><![CDATA[As the interface for your website, the menu gets plenty of action. You might want to tune it up a bit, adding something to make it special. Drupal has an extensive API for interacting with the menu items you create. On our website, we wanted subtext for each primary menu item &#8211; as you see [...]]]></description>
			<content:encoded><![CDATA[<p>As the interface for your website, the menu gets plenty of action. You might want to tune it up a bit, adding something to make it special. Drupal has an extensive API for interacting with the menu items you create.</p>
<p>On our website, we wanted subtext for each primary menu item &#8211; as you see above. Drupal usually displays the link titles only. There is a description field for each menu item, and we thought that would be a great place to enter the subtext we enter. I set out to generate my own menu and place it in a block on my page. menu_navigation_links() looked like a promising function from the menu API.</p>
<p>I enabled the devel module and put the execute PHP block at the top of the page. I got to work creating the PHP that would do the trick. Dealing with arrays can be tricky if you don&#8217;t do it often. Using the PHP function print_r() , you can view the contents of your menu array. Like so:</p>
<pre class="brush: php;">&lt; ?php
$menuitems = menu_navigation_links('primary-links', $level = 0);
print_r($menuitems);
?&gt;</pre>
<p>Once you have the PHP worked out, make sure the PHP filter module is enabled for the site under admin/build/modules. Create a block at admin/build/block. Insert PHP code and change the input type to PHP.</p>
<pre class="brush: php;">&lt; ?php
//Get the menu structure and place in a variable. An array is returned.
$menuitems = menu_navigation_links('primary-links', $level = 0);

//Loop through the menu items, setting two classes for the design and outputting what we want
foreach ($menuitems as $key=&gt;$value)
{
echo '
';
echo ''.$menuitems[$key]['title'].'';
echo '
';
echo $menuitems[$key]['attributes']['title'];
echo '
';
echo '
';
}

?&gt;</pre>
<p>More information on the Drupal menu API for all versions:</p>
<p><a href="http://api.drupal.org/api/group/menu/6">http://api.drupal.org/api/group/menu/6</a></p>
]]></content:encoded>
			<wfw:commentRss>http://littlebirdllc.com/customizing-drupal-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
