[TYPO3] tt_news first paragraph
Dan Osipov
dosipov at phillyburbs.com
Sun Aug 24 23:15:28 CEST 2008
I would suggest making an extension, and making use of the TCE hook, so
that every time a news record is saved, the first paragraph is isolated
and wrapped. This is probably more complicated than what you were hoping
for, but I can't see another way...
Suggested code:
function processDatamap_preProcessFieldArray(&$incomingFieldArray,
&$table, &$id, &$tcemain)
{
if($table == "tt_news")
{
preg_match_all("/<p>(.+)<\/p>/Us",
$incomingFieldArray["bodytext"], $post);
// Wrap $post[1][0], and append it to the rest of the text
}
}
Dan Osipov
Calkins Media
http://danosipov.com/blog/
Lee M. Childress wrote:
> Before I go hacking away at the actual tt_news code, I am sure there is a better way to do this:
>
> When displaying a single view in tt_news I would like only the first paragraph of the news body to have a different class tag than the rest, i.e.:
>
> <p class="bodytext_first">This is the first paragraph of the news story.</p>
> <p class="bodytext">This is the second and remaining paragraphs.</p>
>
> Any decent way to do this without altering the code?
More information about the TYPO3-english
mailing list