[drupal-support] Re: categories in the index page

paul paul at chintha.com
Sun Feb 27 01:53:16 UTC 2005


Hi,
Please ignore the previous mail and php code that i posted. I found a
better way to do this. The code is smaller and neat. You need to have
taxonomy_dhml and  taxonomy_context modules enabled. I am using
functions from those two modules.

Paste the follwing code in your page.tpl.php:

if ($is_front) {
    $vocabularies = taxonomy_dhtml_get_vocabularies();
    foreach ($vocabularies as $vocabulary) {
    print "<h2>" . $vocabulary->name . "</h2><br \>";
    $result = db_query("SELECT n.tid, n.name FROM {term_hierarchy} t,
{term_data} n WHERE t.tid = n.tid AND n.vid = %d AND t.parent = 0 ORDER
BY n.weight, n.name", $vocabulary->vid);
  while ($term = db_fetch_object($result)) {
       print "<strong>" . $term->name . "</strong>";
       $output .= "<ul>" . taxonomy_context_show_nodes($term->tid) .
"</ul>\n";
       print $output;
       $output="";
      }
      }
}

Hope this helps.
Paul


Nektarios Sylligardakis wrote:

> very quite site.
> Somthing like this i meen
> is it yours site ?
> could you tell as how did that?
>  
>
> paul wrote:
>
>> Please take a look at www.chintha.com <http://www.chintha.com>
>> Is this what you are looking for?
>>
>> paul
>>
>> Abalieno wrote:
>>
>>> I'm actually interested in a similar feature:
>>>
>>> I'd like to flag manually some of the nodes so that their titles 
>>> (just them) appear in a custom box on the homepage (not the sidebar).
>>>
>>> HRose / Abalieno
>>>
>>>
>>>> I don't think this is a standard feature, so you may need to code 
>>>> some PHP unless someone else has done this and can offer some 
>>>> suggestions.
>>>>
>>>> There is a 'categories' block, which lists the various categories 
>>>> and the number of articles in each category - maybe this could be 
>>>> modified to suit your needs.
>>>>
>>>> (sorry, I am a bit to busy at the moment to give this further 
>>>> thought - maybe someone else will help?)
>>>>





More information about the drupal-support mailing list