es gibt ein schönes modul von Mattias Beckmann, die Kategorienliste
http://www.redaxo.de/165-Moduldetails.html?module_id=176:
input:
- Code: Alles auswählen
<strong>Anzahl der Artikel pro Seite</strong><br />
<input name="VALUE[1]" value="REX_VALUE[1]" class="inp100" />
<br /><br />
<strong>Anzahl der Wörter pro Artikel</strong><br />
<input name="VALUE[2]" value="REX_VALUE[2]" class="inp100" />
output:
- Code: Alles auswählen
<?php
$cat = OOCategory :: getCategoryById($this->getValue('category_id'));
$cats = $cat->getChildren();
$itemsPerSide = "REX_VALUE[1]";
$wordsPerArticle = "REX_VALUE[2]";
if (is_array($cats))
{
$i = 0;
foreach ($cats as $cat)
{
$i += 1;
if ($i <= $itemsPerSide)
{
$catId = $cat->getId();
$catName = $cat->getName();
$article = $cat->getArticles(1);
if (is_array($article))
{
foreach ($article as $var)
{
$articleId = $var->getId();
$articleName = $var->getName();
$art = new rex_article($articleId);
$articleContent = $art->getArticle(1);
$articleContent = trim($articleContent);
$articleContent = str_replace('</p>', ' </p>', $articleContent);
$articleContent = str_replace('<br />', ' <br />', $articleContent);
$articlePPath = $REX['MEDIAFOLDER'] . 'files/' . $var->getValue('file');
$output = '';
$words = explode(' ', $articleContent);
$wordsCount = count($words);
if ($wordsCount < $wordsPerArticle)
$wEnd = $wordsCount;
else
$wEnd = $wordsPerArticle;
for ($w = 0; $w < $wEnd; $w++)
{
$output .= $words[$w] . ' ';
}
$output = trim($output);
$isCloseParagraph = substr($output, -4);
$link = '<a href="' . rex_getUrl($articleId) . '" class="more"> ... mehr</a>';
$newString = $link . '</p>';
if ($isCloseParagraph == '</p>')
{
$output = substr_replace($output, $newString, -4);
}
else
{
$output .= $newString;
}
// print '<h3>'.$articleName.'</h3>';
if ($_GET["article_id"] == 2)
print '<div class="teaser">'.$output.'</div>' ;
}
}
}
}
}
?>
benutze ich so unter redaxo 4.1 und funktioniert.
ich würde es jetzt gerne umschreiben, kann aber nur rudimentär php ...
ich möchte keine kategorienliste sondern nur einen bestimmten artikel der website wählen können und bestimmen, wieviele wörter des inhalts der spalte x dargestellt werden sollen.
im input sähe das bei mir so aus:
- Code: Alles auswählen
Artikel, der angeteasert werden soll:
<br /><br />
REX_LINK_BUTTON[1]
<br /><br />
<strong>Anzahl der Wörter</strong><br />
<input name="VALUE[2]" value="REX_VALUE[2]" class="inp100" />
wie muss ich jetzt den output anpassen, damit er nicht alle artikel der kategorie ausliest?
ist möglicherweise nur die zeile
- Code: Alles auswählen
$article = ooarticle::getArticleById(REX_LINK_ID[1]);
die an der richtigen stelle die verweise auf die kategorie" ersetzt.
nur ich weis nicht wie ...
kann mir jemand unter die arme greifen?
danke!

