<?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>PicaTeclas &#187; drupal</title>
	<atom:link href="http://picateclas.net/posts/category/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://picateclas.net</link>
	<description></description>
	<lastBuildDate>Mon, 03 Jan 2011 12:10:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Mostrar un listado anidado de términos de taxonomía en Drupal</title>
		<link>http://picateclas.net/posts/mostrar-un-listado-anidado-de-terminos-de-taxonomia-en-drupal/</link>
		<comments>http://picateclas.net/posts/mostrar-un-listado-anidado-de-terminos-de-taxonomia-en-drupal/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:45:22 +0000</pubDate>
		<dc:creator>zetxek</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[fragmentos útiles]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[taxonomy]]></category>
		<category><![CDATA[terms]]></category>

		<guid isPermaLink="false">http://picateclas.net/?p=92</guid>
		<description><![CDATA[Buscando cómo mostrar un listado aninado de los términos (terms) de un vocabulario (una categoría de Drupal, o taxonomy), encontré este útil fragmento de código en Drupal.org. Para que funcione esto es necesario usar el módulo Taxonomy. ?Ver código PHP&#60;?php // El ID del vocabulario de la taxonomia del que queremos crear la lista de [...]]]></description>
			<content:encoded><![CDATA[<p>Buscando cómo mostrar un listado aninado de los términos (<em>terms</em>) de un vocabulario (una categoría de Drupal, o <em>taxonomy</em>), encontré <a href="http://drupal.org/node/223675#comment-900999">este útil fragmento de código</a> en Drupal.org. Para que funcione esto es necesario usar el módulo <a href="http://drupal.org/handbook/modules/taxonomy">Taxonomy</a>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p92code2'); return false;">Ver código</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p922"><td class="code" id="p92code2"><pre class="php" style="font-family:monospace;">&lt;?php
            // El ID del vocabulario de la taxonomia del que queremos crear la lista de terminos
            $vid = 10;
&nbsp;
            $depth = 0;
            $num_at_depth = 0;
            $tree = taxonomy_get_tree($vid);
&nbsp;
            print &quot;&lt;ul class=\&quot;menu\&quot;&gt;\n&lt;li&gt;&quot;;
            foreach ($tree as $term) {
            $diffdepth=0;
              if ($term-&gt;depth &gt; $depth) {
                print &quot;\n&lt;ul&gt;\n&lt;li&gt;&quot;;
                $depth = $term-&gt;depth;
                    $num_at_depth = 0;
              }
              if ($term-&gt;depth &lt; $depth) {
                $diffdepth= $depth -$term-&gt;depth;
                while ($diffdepth &gt; 0){
                    print &quot;&lt;/li&gt;\n&lt;/ul&gt;\n&quot;;
                    $diffdepth -- ; 
                }
                    $depth = $term-&gt;depth;
              }
              if (($term-&gt;depth == $depth) &amp;&amp; ($num_at_depth &gt; 0)) {
                  print &quot;&lt;/li&gt;\n&lt;li&gt;&quot;;
                }
              print l($term-&gt;name, 'taxonomy/term/' . $term-&gt;tid);
                $num_at_depth ++;
            }
            print &quot;&lt;/li&gt;\n&lt;/ul&gt;\n&quot;;
?&gt;</pre></td></tr></table></div>

<p>El crédito va al autor, <a href="http://drupal.org/user/219531">billyboylindien</a></p>
]]></content:encoded>
			<wfw:commentRss>http://picateclas.net/posts/mostrar-un-listado-anidado-de-terminos-de-taxonomia-en-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

