Danke für die Antwort. Hier mal die Ausgabe des Teasers:
Code: Alles auswählen
<?php
//---MODULE MODIFIED BY--------------------------
//-- a-concept internet.studio
//-- Sven Albert-Pedersen
//-- www.a-concept.de / www.svenalbert.de
//-----------------------------------------------
//-- version 1.24
//-- date 30-may-2007
//-----------------------------------------------
//-- Nachträglich eingefügt:
//--
//-- * Zählen und Schließen von DIVs & SPANs
//-- * Auswahl der Sortierung nach Prio
//-- * Ausblendung eines Bildes im Artikel
//-- * Funktionalität mit mehrsprachigen Webseiten
//-- * Zurück-Link, wenn Seite über den Teaser aufgerufen wurde
//-- * v1.24 Texte für $nextLink und $backLink im oberen Bereich der Datei
//--
//-- Bugfixes:
//-- v1.23 Moduleingabe: Select hatte falschen Variablennamen
//-----------------------------------------------
//---BEZEICHNUNG DER BLÄTTER- und WEITER-LINKS---
//--
//--
$backLink_text = 'vorige Seite';
$nextLink_text = 'nächste Seite';
$moreLink_text = 'weiterlesen';
//--
//--
//-----------------------------------------------
$itemsPerSide = "REX_VALUE[1]";
$wordsPerArticle = "REX_VALUE[2]";
$sorting_order = "REX_VALUE[3]";
//echo $sorting_order;
// Nur im Frontend
//if (!$REX['REDAXO']):
// Sortierfunktionen
// Sortierfunktion by Name
// siehe http://wiki3.redaxo.de?n=R3.Sortiermöglichkeiten
if(!function_exists('sortArticlesByName')) { function sortArticlesByName( $artA, $artB) { $nameA = $artA->getName(); $nameB = $artB->getName(); if ( $nameA == $nameB) { return 0; } $names = array($nameA,$nameB); sort( $names, SORT_STRING); return $names[0] == $nameA ? -1 : 1; } }
// Sortierfunktion by Prio
// siehe http://wiki3.redaxo.de?n=R3.Sortiermöglichkeiten
if (!function_exists('sortArticlesByPrio')) { function sortArticlesByPrio( $artA, $artB) { $prioA = $artA->getPriority(); $prioB = $artB->getPriority(); if ( $prioA == $prioB) { return 0; } return $prioA > $prioB ? 1 : -1; } }
// Sortierfunktion by CreateDate
// siehe http://wiki3.redaxo.de?n=R3.Sortiermöglichkeiten
if(!function_exists('sortArticlesByCreateDate')) { function sortArticlesByCreateDate( $artA, $artB) { $createA = $artA->getCreateDate(); $createB = $artB->getCreateDate(); if ( $createA == $createB) { return 0; } return $createA > $createB ? -1 : 1; } }
// Sortierfunktion by UpdateDate
// siehe http://wiki3.redaxo.de?n=R3.Sortiermöglichkeiten
if(!function_exists('sortArticlesByUpdateDate')) { function sortArticlesByUpdateDate( $artA, $artB) { $updateA = $artA->getUpdateDate(); $updateB = $artB->getUpdateDate(); if ( $updateA == $updateB) { return 0; } return $updateA > $updateB ? -1 : 1; } }
$start = !empty($_GET['start']) ? (int) $_GET['start'] : 0; // Startitem
$offset = $itemsPerSide; // 10 Items pro Seite
$cats = array( 16); // alle Kategorien die Du "indizieren" willst
$articles = array();
foreach ( $cats as $catId) {
$cat = OOCategory::getCategoryById( $catId);
// CatIds die nicht funktionieren aussortieren
if( $cat === null) {
continue;
}
$cat_articles = $cat->getArticles( true);
foreach ( $cat_articles as $ooarticle) {
// keine Startartikel anzeigen
if ( $ooarticle->isStartPage()) {
continue;
}
// Damit keine Endlosschleife passiert, den Artikel der die Pagination setzt überspringen
if ( $ooarticle->getId() == REX_ARTICLE_ID) {
continue;
}
$articles[] = $ooarticle;
}
}
$articles_length = count( $articles);
// Sortieren
if ( $articles_length > 0) {
if ($sorting_order == "updatedate") {
usort( $articles, "sortArticlesByUpdateDate");
}
elseif ($sorting_order == "prio") {
usort( $articles, "sortArticlesByPrio");
}
elseif ($sorting_order == "name") {
usort( $articles, "sortArticlesByName");
}
elseif ($sorting_order == "createdate") {
usort( $articles, "sortArticlesByCreateDate");
}
}
$article_list = array_slice( $articles, $start, $offset);
foreach ( $article_list as $ooarticle) {
if ($ooarticle->isOnline(true)) {
$articleId = $ooarticle->getId();
$article = new article();
$article->setClang($REX['CUR_CLANG']); // lt. Kommentar, openmind, 01-feb-2007
$article->setArticleId( $articleId);
$articleContent = $article->getArticle();
// DIV-Container mit Bildern entfernen
# $articleContent = preg_replace('/<div style=\".*?<\/div>/', "",$articleContent);
$articleContent = preg_replace('/<div class=\"img_(right|left)\">.*?<\/div>/', "",$articleContent);
// Leerzeichen entfernen am Anfang und Ende des Strings
$articleContent = trim($articleContent);
// Leerzeichen vor </p> einfuegen.
// Sonst wird das letzte Wort eines Absatzes und das erste Wort
// des nachfolgenden Absatzes als ein Wort erkannt
$articleContent = str_replace("</p>", " </p>", $articleContent);
// Leerzeichen vor <br /> einfuegen.
// Sonst wird das letzte Wort einer Zeile und das erste Wort
// des nachfolgenden Zeile als ein Wort erkannt
$articleContent = str_replace("<br />", " <br />", $articleContent);
$output = "";
$words = explode(" ",$articleContent);
$wordsCount = count($words);
if ($wordsCount < $wordsPerArticle) {
$wEnd = $wordsCount;
$link = '';
}
else {
$wEnd = $wordsPerArticle;
$link = ' [...]<a class="read-more-link" href="'.rex_getUrl($articleId, $REX['CUR_CLANG']).'" title="'. $moreLink_text .'">'. $moreLink_text .'</a><br style="clear:both" />';
}
for ($w=0;$w<$wEnd;$w++) {
$output .= $words[$w]." ";
}
// Leerzeichen entfernen am Anfang und Ende des Strings
$output = trim($output);
$isCloseParagraph = substr($output,-4);
$newString = $link.'</p>';
if ($isCloseParagraph == '</p>') {
$output = substr_replace($output,$newString,-4);
}
else {
$output .= $newString;
}
// opened & closed DIVs/SPANs zählen und ggf. closing Tags ergänzen
// ----------------------------------------------------------
// MODIFIED by Sven Albert-Pedersen * alfa-x (at) web (dot) de
$openedSPANs = substr_count($output, '<span');
$closedSPANs = substr_count($output, '</span>');
$countmissingSPANs = $openedSPANs - $closedSPANs;
if ($openedSPANs > $closedSPANs) {
while ($countmissingSPANs > 0):
$output .= "</span>";
$countmissingSPANs = $countmissingSPANs - 1;
endwhile;
}
$openedDIVs = substr_count($output, '<div');
$closedDIVs = substr_count($output, '</div>');
$countmissingDIVs = $openedDIVs - $closedDIVs;
if ($openedDIVs > $closedDIVs) {
while ($countmissingDIVs > 0):
$output .= "</div>";
$countmissingDIVs = $countmissingDIVs - 1;
endwhile;
}
// ----------------------------------------------------------
// END MODIFICATION
print '<div class="teaser">'.$output.'</div>';
}
}
$prevStart = $start - $offset;
if ( $prevStart < 0)
{
$prevStart = '';
}
$nextStart = $start + $offset;
if ( $nextStart >= $articles_length)
{
$nextStart = '';
}
$link_format = '<a href="'.rex_getUrl("REX_ARTICLE_ID", $REX['CUR_CLANG'], array('start'=>'%s')).'">%s</a>';
// Vorherige Seite Link
if ( $prevStart !== '') {
$backLink = sprintf( $link_format, $prevStart, '« '.$backLink_text);
}
// Nächste Seite
if ( $nextStart !== '') {
$nextLink = sprintf( $link_format, $nextStart, $nextLink_text.' »');
}
if ($backLink != "" AND $nextLink != "") {
print '<div class="linkbox"><div class="linkbox1">'.$backLink.'</div><div class="linkbox2">'.$nextLink.'</p></div><br style="clear:both;"/></div>';
}
elseif ($nextLink != "") {
print '<div class="linkbox">'.$nextLink.'</div>';
}
elseif ($backLink != "") {
print '<div class="linkbox">'.$backLink.'</div>';
}
//endif;
?>
Im Prinzip möchte ich alle Variablen aus dem Modul verändern können wie ich möchte. Wenn die "normale" Ausgabe im Artikel z.B. folgendermaßen aussieht:
Code: Alles auswählen
<div id="a">
<h1>REX_VALUE[1]</h1>
<b>REX_VALUE[2]</b>
</div>
soll es auf der Startseite z.B so aussehen:
Code: Alles auswählen
<div id="b">
<h2>REX_VALUE[1]</h2>
<h3>REX_VALUE[2]</h3>
</div>
Also einfach komplett anders. Ich habe das bei einigen Seiten mit der preg_replace Funktion im Teaser gelöst, aber heute kam mir die Idee, dass das ganze auch einfacher zu lösen wäre, nämlich indem man halt prüft ob das Modul grade auf der Startseite angeteasert wird.
Chriz