how to render a field "view mode" inside a field collection item template file? to render a field "view mode" (or "format") inside a node.tpl.php i use, for example:

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


now i'd like to do quite the same thing, but inside a field-collection-item.tpl.php (for a field that is part of a field collection).

in my field-collection-item.tpl.php, i can render each field just like in a node;tpl.php:

&lt;?php print render($content['field_myfieldname']); ?&gt;


but if i try the first code above inside field-collection-item.tpl.php (to trim a field-collection field), it just doesn't work...

thanks you for helping !
I haven't tested this but I suspect your issue arises from the fact that the $node object is not available to that template file. You have a couple of options; write your own theme function, load the node object some other way (this might still not work though because of the way field collection works) or just trim the rendered value.

Something like this should work for you if you are just looking to trim the result to 30 characters:

&lt;?php print trim(substr(render($content['field_myfieldname']), 0, 30)); ?&gt;