I've been trying to figure out how to nest the node's body field into a div with a class of ".body".
I have attempted to use _preprocess_node. But I cant seem to get a value from content['body']['#value'] that i can manipulate. And it looks that the node just prints from $content with a type of string, it is not an array. I dont want to create a whole new tpl just for this task and print out separately all the node fields.
I dont know what I am missing, it looks like I could develop a module and use the nodeapi to do this, but that seems to be a lot of work for such a trival task.... plus I'd have to figure it all out.
New to drupal and php. Coming from a java background.
Any thoughts of how to do this easily?
thanx,
Michael
Comments
Here are a few hints:
Here are a few hints:
This one will remove all CCK fields from display
$vars['content'] = '<div class="body">' . $vars['node']->content['body']['#value'] . '</div>';This will keep all the fields:
$vars['content'] = '<div class="body">' . $vars['node']->body . '</div>';A few more ideas here: http://drupal.hu/forum/teaser-külön-formázása#comment-35203
Yeah i figured out the first
Yeah i figured out the first one finally.... some things are objects... other are arrays. It makes me confused. But the problem I am seeing with node->content[body] is that it seems to hold the unaltered/nonprocessed state of the node body. It is most likely somewhere down the line this will break some module that I would like to affect all nodes.
as fore node->body..... It looks like you might as well print $vars['content']. They seem to hold the same content.
I'll keep plugging away at it. For now I will manually place the div class="body" into the body field.
Thanks
Michael
interesting question you have
Michael, it's quite an interesting question you have. We discussed it with a few drupal friends of mine... but no real solution yet.
Looks like it's much easier to overcome it in D7 but still, in sake of science would beat it in D6 as well :) So will wait for your posts too.
...
Yes, its surely is an interesting issue, created quite a discussion over here as well - we're all been putting thoughts to it an no real solution either, and whats this soupp mr robot?
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.