By stephtek on
Is there a way to limit the word count in the teaser to something like 100 words exactly... no matter if it breaks a sentence up?
Is there a way to limit the word count in the teaser to something like 100 words exactly... no matter if it breaks a sentence up?
Comments
=-=
administer -> post settings
ya there is 200 or 400 or
ya there is 200 or 400 or unlimited. I am wondering if it is possible to make it more exact? Exactly 100 words.
take a gander at this
take a gander at this thread, theres 2 functions you could use that I posted, one trims to a character count, the other to a word count.
http://drupal.org/node/343014
its a long thread I know...
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
dang.. didnt work for me. I
dang.. didnt work for me. I am using CCK and contemplate. Here is my template code:
and this is in my template.php
...
Never used contemplate, but is $body the correct variable that contemplate tells you to use?
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
$body should be
$body should be $node->body.
Excerpt
An alternative for your consideration: http://drupal.org/project/excerpt
There are times when you want the teaser to be a summary in a specific format. Excerpt gives you that option by creating the teaser separate to the body. When you have to modify code to do something special to the teaser, you might find Excerpt a better starting point.
petermoulding.com/web_architect
petermoulding.com/web_architect
this works for me
http://www.lullabot.com/articles/trim_a_string_to_a_given_word_count
Then I display the teaser using fields in views, and put the code in a template file (like views-view-field--comments-recent--comment.tpl.php).
best way to do is
best way to do is that:
search table name variables
SELECT *
FROM `variable`
WHERE `name` LIKE '%teaser%'
edit
teaser_length s:3:"200";
to what ever you want
-------------------
Is there no easy way to
Is there no easy way to change post settings to give me the option "100" instead of 200?
Try
Try adding
To your settings.php
Thanks mate! Worked great =)
Thanks mate! Worked great =)
Isn't the setting for number
Isn't the setting for number of characters in the teaser, not number of words?
Also, note that this only affects teasers being generated as pages are saved. They are not generated on the flyer for viewing, so existing teasers will stay the same after this is altered.
=-=
yes it is characters.
correct the setting is not retroactive but one can do a bulk operation on the previously saved node which would alter the previously saved node and force them to take on the new setting. One could also investigate the retease.module which aids in this type of thing.
Are you using a view
Are you using a view block?
If so, in the views section, click edit on the block you want. Click 'Node: Teaser' in the filters section and then scroll down.
You will see a check box titled 'Trim this field to a maximum length' When that is clicked, you will have the option to type any value in.
Remember to save
=-=
IIRC that field setting in views is still character length and not word length.
Sorry, my bad!
Didn't read it through correctly.
Have you tried: http://drupal.org/node/46391