Posted by Summit on September 2, 2010 at 1:51pm
Jump to:
| Project: | Node displays |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi,
Great module!
How can I change a with taxonomy terms?
I want to have the following info which I want to integrate in the node_display taxonomy:
<?php if ($terms): ?>
<div class="terms clear-both"><div class="terms-inner">
<?php print t('Tags') . ': ' . $terms; ?>
</div></div>
<?php endif;?>Thanks a lot in advance for your reply!
greetings,
Martijn
Comments
#1
I'm not exactly sure what you mean ? What do you want to do exactly ? Terms are available in the node displays module, so you shouldn't have the need anymore of the $terms variable normally.
#2
Hi
I am sorry if I was not clear.
I want to use the
<div class="terms-inner"> so theming looks nice.greetings, Martijn
#3
Ah, you can just define styles in admin/build/ds/layout/styles and use those styles. Those styles will be available to add on any field you like in the interface as an extra class.
#4
I got that, and how to imitate this behaviour (2 divs..with a ul class)? Is that also possible please?
<div class="terms clear-both"><div class="terms-inner">Labels: <ul class="links inline"
#5
Well you could create a fieldgroup, render it as a simple div, give it the right classes and nest the terms underneath it.
#6
Poehh..don't know yet how to do this..
you mean create a fieldgroep of terms render, or links inline, the ul?
#7
Hi,
if you really want custom wrappers around your fields, I guess the best solution for you would be to create a new code field under display suite > node displays > fields. You will have to write some php code which will be quite similar to your code above.
#8
#9
Hi Jive, Could you show the code for this case in php please?
Thanks a lot in advance.
greetings, Martijn
#10
Hi Jive,
Set it to active, because the php code I try to put in display suite > node displays > fields doesn't show up making a new code field.
The phpcode is:
<?php if ($terms): ?><div class="terms clear-both"><div class="terms-inner">
<?php print t('Tags') . ': ' . $terms; ?>
</div></div>
<?php endif;?>
What do I do wrong please?
Thanks again for helping me. Greetings, Martijn
#11
Hi Jive,
Tried some things, and this is working. But is it the most efficient method?
<div class="terms clear-both"><div class="terms-inner"><?php
print t('Tags') . ': ';
foreach ($object->taxonomy as $term) {
print "<a href=\"".drupal_get_path_alias(taxonomy_term_path($term))."\">$term->name</a>" . " , ";
}
?>
</div></div>
I am not getting it to work with tokens..[term] and [termalias]
Thanks a lot for your review.
greetings,
Martijn
#12
@summit
that's pretty much the way you'd want to do that. However, with some clever CSS'ing, you can mimic the styling of the original though.