Hi,
is contemplate the best way to control cck teasers and presentation ? Or can it be achieved in another way ?

Cordially,
Brakkar

Comments

ideviate’s picture

did yoı try excerp module? if i got correctly it may help. http://drupal.org/project/excerpt

One CMS, Drupal, to rule them all :) www.universideliyiz.biz

stanbroughl’s picture

what do you want to configure in the teasers? i find contemplate pretty good - i have a php script that allows me to set the exact teaser character length for each one, and you can theme it all you want

lias’s picture

Thanks.
Lsabug

stanbroughl’s picture

Sorry its taken a while to track it down again - i've got files everywhere!

Its not mine, i'm afraid i can't remember where i found it on drupal but it's out there somewhere:

<?php print $teaser = substr($field_story_text[0]['value'], 0, 300) ?><a href="<?php print $path ?>">...readmore</a></div>

VARIABLE_FIELD = the variable you want to trim
0 = represents what character to start counting from
300 = represents the number of characters to trim to

I also add ...readmore with a link to the page path to illustrate the trimming but thats not required

lias’s picture

I'll try it out.

lsabug

notarealperson’s picture

Where do you insert this code? Into the teaser template? Because when I do, the readmore link only point to the front page where the teaser resides, rather than the page where the story is.

colm_iqc’s picture

There's a bug, see here for the error report:
http://drupal.org/node/87223

schwa’s picture

This will take you to the relevant node page rather than to front page. Also added the class of "more-link", which will style it like all other 'read more' links on your site.

<span class="more-link"><?php print l('... more', 'node/'.$nid, array('title' => 'Read more on this article')); ?></span>

Alter the '... more' to read 'read more' or whatever alternate text you desire.

seakayjay’s picture

I've tried using the php snippet provided and paste it to the "Teaser Template" of Contemplate. That's really work.

However, the trimming style is not what i'm looking for because it doesn't respect the "words" that's in the field.

For example, when the character to be trimmed is set to 300, the characters that reach exactly on 300 will be trimmed despite the completion of the word (i.e. world --> worl). Can we make it in such a way where the trimming process will respect the final word, let it finish the word before trimming it.

I hope I've made it clear on what I'm looking for. Any guide or help will be appreciated.

Thanks

jaks1970’s picture

When I made my custom content type I included a description text field. That made it easy to separate as a teaser from the main content. I simply added the second code snippet from this thread to the description field div and removed the main content field from my teaser template. Presto I had a great teaser with a read more link. Obviously I set the description field to 300 characters in the settings for that field.

<span class="more-link"><?php print l('... more', 'node/'.$nid, array('title' => 'Read more on this article')); ?></span>

Hope that helps you.

BTW: If you want to see my teaser goto http://www.sexstoriesexchange.com/stories/straight Adult content is hidden to unregistered users but I made it so that only the teasers are shown so don't worry about seeing anything you don't want to see.

----
http://www.Trulyunusual.com and http://www.top100giftideas.com

jaks1970’s picture

I just upgraded to Drupal 5.X and had to reapply this code. Still works like a charm. :)

As If’s picture

see here, apply wherever you need to do it: http://drupal.org/node/112491#comment-200716

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

seakayjay’s picture

thanks... it works