Problems to separate teaser/body/fields using CCK
I'm trying a bunch of time now to get a seperate teaser field and additional other fields in my nodes, that I can theme as I want. But with every way to solve my problem y encountered another one. I'm using CCK but I couldn't figure out how to make a separate teaser field with it. So I'm using the excerpt module which works fine. But: When ich add more fields to my node, they always show up in the teaser and/or the body when I work on the theming (either with the contemplate module or with the node-.tpl.php files).
The ideal would be having seperate fields for title, author (just a text field, not the publisher), teaser, body (without teaser so that I can assign them different classes), ... and then call them by variables to assign them css classes/id's. But as I said I can't get the teaser separated from the CCK fields. And I don't get why $node->body gives out or the teaser or the teaser AND the body (depending on the view: list or whole node).
I'm sorry if my description is a little difficult to understand, but maybe somebody can help me. I'm looking for this for a long time already.
More or less like this for the list view:
<h2 class="title">[title]</h2>
<div id="byline">by <span class="author">[author]</span>, <span class="date">[date]</span></div>
<div id="teaser">[teaser]</div>And like this for the node view:
<h2 class="title">[title]</h2>
<div id="byline">by <span class="author">[author]</span>, <span class="date">[date]</span></div>
<div id="teaser">[teaser]</div>
<div id="body">[body]</div>
example
To be a little more precise: When I
<?phpprint $node->teaser
?>
had a similar issue
i had a similar issue when printing the body field - not sure if will help you - but the solution was to print out the field using a different syntax:
<?php
print $node->content['body']['#value']
?>
so you might try:
print $node->content['teaser'][#value']
hope that helps!?
nope...
No, that doesn't really help. But I'm a bit confused: The teaser is a little different from the first paragraph of the body. Is the information safed twice? I'm using the excerpt module and have a seperate field for the teaser. But the teaser is still repeated in the body field (in db).
Additionally I don't quite get why print $node->content['body']['#value'] (or print $node->body) is not displayed in the node list but on the node page.
And in reverse $node->content['teaser']['#value'] (or print $node->teaser) doesn't appear on the page but in the list.
Am I doing it right?
I am having trouble getting a teaser (shortened) version of the body to print in views. In views I have the view set up as a block in list_view and the body's handler as a teaser. However when I view the block, the body is full-view? So i replaced the
<?phpprint $body
?>
with
<?phpprint $node -> teaser
?>
and
<?phpprint $node->content['teaser']['#value']
?>
Both display nothing???? The only thing that displays anything is the $body, which is full even though teaser is the selected handler?
same
I got the exact same problem!
Same here
Same here
Have you tried the Contemplate module?
Contemplate allows you to create the html so that you can output exactly what you want. It's best to work outside of the tiny little windows on a different document. I've found it helpful to copy and paste all of the output on the right side to a different document to grok it all. I also tend to work the html on a different document as well, then paste it back into the window. Hope this helps. http://drupal.org/project/contemplate
Exactly the same problem
Exactly the same problem
worked for me
<?php print $teaser = substr($node->content['body']['#value'], 0, 220) ?>And if your teaser make more
And if your teaser make more than 220 character ?
Setting CCK field visibility for teaser and body
CCK fields can be set to show in the body, the teaser or both, from the 'display fields' tab of the specific CCK type, like at /admin/content/types/[yourtype]/display
Then you can toggle which fields appear in the teaser or body independantly, as well as how they are labelled. Is that what you're looking for?