views:

757

answers:

3

I tried to display body content with:

<?php print $node->content['body']['#value']; ?>

However, it doesn't display all body content, it just display first paragraph of body content, sometimes 2 paragraph if it is short :/

I need to print all body. how can I do that?

Thanks a lot! Appreciate helps!

A: 

In node.tpl.php try

<?php print $content ?>

However,

<?php print $node->content['body']['#value']; ?>

works for me as well.

Julian
thanks for reply. print $content just prints every field in content like my custom cck fields (image, logo, etc.) i need only full body entry part :/
artmania
+1  A: 

The shortened body content hints on it being filled/rendered for 'teaser' view instead of 'full'. In what context do you issue this print statement?


EDIT: The node templates are usually used for both, teaser and full output, but the decision on what to use, as well as the population of the content entries in the node object happen outside of the node template files. Within the node template file, the variable $teaser will be TRUE, if the node is to be shown as a teaser.

So you need to check in what context your node template gets called, as you'll have to configure that context to render the node as 'full'. This could be in many places, depending on who is responsible to provide the nodes you want to theme, e.g. if the node template gets called from a view, you'll need to configure the view to use 'full page' output, if it comes from a module, you'll need to check with the module settings, etc...

Henrik Opel
yes i was just keep searching about teaser, if I can define new length for teaser, etc, or if I can turn of teaser. I have the issue for node-blog.tpl.php
artmania
A: 

To get control over your teaser length the master value is set with Post Settings. (Length of trimmed posts)

To control this by node type try: http://drupal.org/project/teaserbytype

NOTE: Teasers are cached so you'll need to http://drupal.org/project/retease

However, if you want to just get it done in the node template you could run a node_load() and have everything... but that's not the best practice.

FYI: you can control what CCK fields show up in $content under Display Options.

PS: In teaser mode I often make use of truncate_utf8().

doublejosh

related questions