7940 Posts in 1543 Topics by 946 members
|Go to End|
21 August 2009 at 4:04am Last edited: 21 August 2009 9:49pm
I've got DOM working nicely, but I wondered is there a way to only show a few characters / first sentence of a returned field?
I've got three columns showing - date (date), author (text), and article content (html text) - and would like to just show the first few words of the article content as a summary, so that the table isn't huge!
I've had a look through the forum but can't see if anyone has managed to do this yet, or even requested it.
21 August 2009 at 4:29am
In your headings array just use 'ArticleContent.FirstSentence' => 'Article Content (summary')
21 August 2009 at 4:35am
Thanks again for the quick reply, but I get:
Uncaught Exception: Object->__call(): the method 'newscontent' does not exist on 'NewsArticle'
when I try your suggestion (I called the field NewsContent instead of ArticleContent in the end).
This is the call I'm using that blows up:
$f->addFieldToTab("Root.Content.NewsArticles", new DataObjectManager(
array('Date' => 'Date','Author'=>'Author','NewsContent.FirstSentence' => 'NewsContent'),
21 August 2009 at 5:12am
Just do this
'ShortNewsContent' => 'Short news content'
21 August 2009 at 9:49pm
Yup, that worked a treat!
Thanks again UC.
|Go to Top|