By luyendao on
Is there a generic function that I can truncate variables that are pulled from CCK nodes, to a given word length?
I have a variable output using contemplate;
print $node->field_news_body[0]['view']
I know there's a setting in drupal for teasers to be truncated, i'm wondering if I can use the same thing.
Comments
have a look at this thread
have a look at this thread http://drupal.org/node/78336 i don't know if it works in drupal 5.x but its worth a try - i came across this script a few months back and i love it!
Thanks a lot Stan, i've read
Thanks a lot Stan, i've read that posting a number of times in my efforts to understand CCK/views better.
It seems that using substr, only truncates to a char length, that means it could cut off mid-word, was that the case for you? That's a good start though, maybe i can modify it to do what i need.
Thanks for your reply!
yes its a shame that it
yes its a shame that it doesn't recognise the end of the word but not strictly necessary with the ...read more link at the end as it infers there's more and the user should click and go find it! :)
i can't remember where i found it originally on here so i can't take the credit for it!
good luck in your search
end of word
Here's how to split at the end of a word...
LVX
TF
-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com
-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com
so simple! Thank you!
so simple! Thank you!
Nifty, thanks
for the code but where exactly do I put it? I've got this in my contemplate teaser:
Thanks!
<?phpif(strlen($field_your_re
i think this should work, i just replaced $body with the CCK field you had.
thanks luyendao for the
thanks luyendao for the code, I do appreciate it : )
I wanted to post the read more addition for anyone interested:
Worked for me, too. Thanks
Worked for me, too. Thanks for the snippet.
Contemplate
I need some help here. I want to create a disk template only, not use contemplate for errrmmm cck templates.
I don't know what to call the teaser filename?
Thanks for the help.
Excelent! It works perfect
Excelent! It works perfect for me... Thanks!