I need to create lists of nodes (title as link) by content type & the term ID of the currently viewed node.
I tried this using Views with taxonomy term set as an arg, filtering by content type etc, and embedding the view in the content type tpl, however, I get an error due to using i18n - I just get many sql errors all referring to i18n...
What I want to do is something similar to this (from http://drupal.org/node/76923):
<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
$nid = (int)arg(1);
$terms = taxonomy_node_get_terms($nid);
$output = "<ul>";
foreach($terms as $term){
$sql = "SELECT n.title, n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid = $term->tid AND n.nid != $nid LIMIT 5";
$result = db_query(db_rewrite_sql($sql));
if (db_num_rows($result)) {
$output .="<li>$term->name</li><ul>";
while ($anode = db_fetch_object($result)) {
$output .= "<li>".l($anode->title, "node/$anode->nid")."</li>";
}
$output.="</ul>";
}
}
$output .= "</ul>";
return $output;
}
?>
However, I need to filter by node type also. This is because I have two content types and I want them in seperate lists.
Additionally it needs to pull the alias as link, not so sure this is happening in the above code?
I think this would be quite easy for someone familiar with php and drupal. Any help or direction much appreciated!
Comments
yay, no replies at all,
yay, no replies at all, about what I've come to expect from this community... :)
...
Shameless leech. I'll bet you never contributed anything to Drupal or anywhere but want everything from everybody for free. What makes you able to look at yourself in the mirror daily? Do you know how whiny and annoying you sound? After your second smart-arse post nobody felt like helping you anyway. Post back when you have out-grown your adolescence.
Get a life moron, I've been
Get a life moron, I've been here since Drupal 4.3 thanks very much and helped hundreds of people many many times thank-you very much!
This account is new due me loosing my details recently but I have been here a HELL of lot longer than you and answered hundreds of questions in the theme development section over the years (I am a designer).
Since you didnt notice, I ended my post with a smilie, tounge and check, but obviously you are too reactive to see or notice that, eh?
I know how busy people are here, I am one of them, what are you doing? Not helping but going around flaming old posts - yea REAL STYLISH MAN!
Dam it, I am really incensed
Dam it, I am really incensed by what you have said, I'm coming back for another go.
What you DONT know is that the original forum posting is in regard to a website I built for a group NGO's here in Africa - serving developing communities in Kenya, Uganda and Tanzania - in particular women and children.
I've spent over 200 hours with these NGO's over the last 2 years, all VOLUNTARY, UNPAID, but highly rewarding.
This site makes heavy use CiviCRM, OG and is in 3 languages, I was struggling with the multi-lingual thing but in the end I figured it out myself.
Your remark that I expect everything for free is just utter rubbish, please be more aware of your facts before flaming away.
I suggest you look hard in the mirror and ask yourself "what have I done today"? I think only a person with some issues surrounding that would say such things as you have...