2

I have a content type with a text field that i want to render trimmed and full in the same node.

I've set my field to "trimmed" and rendered it in my node.tpl.php using
<?php print render($content['field_image_desc']); ?>

Now i need to render the same field but not trimmed (to display it in an overlay div).

Thanks for helping...

3

i answer myself:

inside node.tpl.php, this is rendering a trimmed version of my field

<?php 
     print render(field_view_field('node', $node, 'field_myfieldname', array(
        'label'=>'hidden', 
        'type' => 'text_summary_or_trimmed', 
        'settings'=>array('trim_length' => 30),
    )));
?>

and then i render my 'default' format field like always

<?php print render($content['field_image_desc']); ?>
1
  • Yes. Upboats for you, welcome to drupal.stackexchange. Cheers! Aug 23 '12 at 2:05
0

This is simple, your obviously going to want some sort of event to open the overlay so create a link field. Display the full content in the overlay with a different view mode.

1
  • ok, thanks ! in fact the problem was that i din't know how to render view modes in a node.tpl.php.
    – mix
    Jul 20 '12 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.