<?php
/**
* Prints an unordered list of the terms (as links) that are
* associated to the currently displayed node.
* Cut n Paste into your theme's node.tlp.php file
* $vid = vocabulary ID number
*/
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
$node = node_load(arg(1));
$vid = 4;
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
if ($terms) {
print '<ul>';
foreach ($terms as $term) {
print '<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';
}
print '</ul>';
}
}
?>
Hi,
Thanks for the script.
I experienced conflicts with this script and Contemplate. The script was inserted in a tpl.php page already customized to call specific values using the contemplate module (disk mode).
The node_load function kept other contents being printed (I'm not sure how or why,but it shut out all custom content).
Anyway, I commented the node_load line, making it look like this. Everything went fine.
<?php
/**
* Prints an unordered list of the terms (as links) that are
* associated to the currently displayed node.
* Cut n Paste into your theme's node.tlp.php file
* $vid = vocabulary ID number
*/
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
// $node = node_load(arg(1));
$vid = 4;
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
if ($terms) {
print '<ul>';
foreach ($terms as $term) {
print '<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';
}
print '</ul>';
}
}
?>
I'm just a beginner at PHP, is it kosher? How do I keep all this logic in template.php and only call it in tpl.php?
Hi,
Thanks for the script.
I experienced conflicts with this script and Contemplate. The script was inserted in a tpl.php page already customized to call specific values using the contemplate module (disk mode).
The node_load function kept other contents being printed (I'm not sure how or why,but it shut out all custom content).
Anyway, I commented the node_load line, making it look like this. Everything went fine.
<?php
/**
* Prints an unordered list of the terms (as links) that are
* associated to the currently displayed node.
* Cut n Paste into your theme's node.tlp.php file
* $vid = vocabulary ID number
*/
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
// $node = node_load(arg(1));
$vid = 4;
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
if ($terms) {
print '<ul>';
foreach ($terms as $term) {
print '<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';
}
print '</ul>';
}
}
?>
I'm just a beginner at PHP, is it kosher? How do I keep all this logic in template.php and only call it in tpl.php?
Comments
No one?
No one?
This worked for me
Glitches with Contemplate (disk mode)
Hi,
Thanks for the script.
I experienced conflicts with this script and Contemplate. The script was inserted in a tpl.php page already customized to call specific values using the contemplate module (disk mode).
The node_load function kept other contents being printed (I'm not sure how or why,but it shut out all custom content).
Anyway, I commented the node_load line, making it look like this. Everything went fine.
I'm just a beginner at PHP, is it kosher? How do I keep all this logic in template.php and only call it in tpl.php?
Glitches with Contemplate (disk mode)
Hi,
Thanks for the script.
I experienced conflicts with this script and Contemplate. The script was inserted in a tpl.php page already customized to call specific values using the contemplate module (disk mode).
The node_load function kept other contents being printed (I'm not sure how or why,but it shut out all custom content).
Anyway, I commented the node_load line, making it look like this. Everything went fine.
I'm just a beginner at PHP, is it kosher? How do I keep all this logic in template.php and only call it in tpl.php?
<?php print
<?php print $node->content['body']['#value']; ?>does not render in the presence of this code in the template files.Thanks masher. This is
Thanks masher.
This is exactly what I was looking for.
Thanks Mike. This was a great
Thanks Mike. This was a great help.
Ed: I too needed to modify as Mat had to.
-----------------------------
Subir Ghosh
www.subirghosh.in