ich versuche gerade folgendes Modul für meine Zwecke anzupassen:
http://www.redaxo.de/165-Moduldetails.html?module_id=176
Meine Seite soll dreisprachig sein und ich möchte das Modul für eine Newsbox verwenden, die z.B. 3 Artikel aus der Kategorie "anteasert".
Ich hab schonmal im Forum gesucht aber für meine Zwecke noch keine Lösung gefunden. das Problem wurde hier ja auch schonmal behandelt, krieg es aber nicht hin, daß der Inhalt aus der jeweiligen Sprache ausgeworfen wird. Ich bekomme immer nur die Inhalte aus der Sprache 0 (deutsch) angezeigt.
Die "Weiter"-Links hab ich schonmal mit der cur_lang versehen und das geht ja auch easy.
Also, wo muß ich im Modul eintragen, daß sich Redaxo die Inhalte aus der aktuellen Sprache holt.
Code Modulausgabe:
- 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)) {
foreach ($cats as $cat) {
$i += 1;
if ($i <= $itemsPerSide)
{
if($cat->isOnline()){
$catId = $cat->getId();
$catName = $cat->getName();
$article = $cat->getArticles();
if (is_array($article)) {
foreach ($article as $var) {
$articleId = $var->getId();
$articleName = $var->getName();
$articleDescription = $var->getDescription();
$art = new article();
$art->setArticleId($articleId);
$articleContent = $art->getArticle();
$articleContent = trim($articleContent);
$articleContent = str_replace("</p>", " </p>", $articleContent);
$articleContent = str_replace("<br />", " <br />", $articleContent);
$articlePPath = $REX["HTDOCS_PATH"]."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, $REX['CUR_CLANG']).'"> ...mehr</a>';
$newString = $link.'</p>';
if ($isCloseParagraph == '</p>') {
$output = substr_replace($output,$newString,-4);
}
else {
$output .= $newString;
}
print '<dl>';
print '<dt><h2>'.$articleName.'</h2></dt>';
print '<dt><br /></dt>';
print '<dt><div class="teaser2">'.$output.'</div></dt>';
print '<hr style="color:#D4D4D4; height:2px">';
print '</dl>';
}
}
}
}
}
}
?>

