Es wäre darüber (über eine funktionierende Multilist-Version mit Pagination) hinaus schön, wenn das Modul so erweitert würde, dass man im Backend individuell für den Artikel festlegen könnte, wieviele Wörter angezeigt werden sollen.
Dafür müssten aber mehr als 11 Redaxo-Variablen benutzt werden.
Wird das eigentlich standardmäßig in die 3.3er implementiert, dass man beliebig viele VALUES belegen kann?
Mfg,
gemüsebrühe
edit:
Okay, ich poste hier meinen Multilist-Code. Die Pagination funktioniert bei mir nicht unter PHP Version 5.2.0 und Redaxo 3.2
Code: Alles auswählen
<?php
//### Functions ###
// Filtern
if(!function_exists("filterArticles")){
function filterArticles($artarr, $withstartpage='0', $onlyteaser='0', $metatime='0'){
$show_articles = array();
foreach ($artarr as $thearticle){
if(REX_ARTICLE_ID != $thearticle->getValue('id')){ //Selbstauflistung unterbinden
//Startartikel
if($withstartpage == '1' || $thearticle->getValue('startpage') != '1'){
//Teaser
if(($onlyteaser != '1' && $onlyteaser != '3') || $thearticle->getValue('teaser') == '1'){
//Datum: online_from / online_to
if($metatime != '1' || ($thearticle->getValue('online_from') <= date('U') && $thearticle->getValue('online_to') >= date('U'))){
$show_articles[] = $thearticle;
}
}
}
}
}
return $show_articles;
}
}
// Sortierfunktion
if(!function_exists("sortArticlesByREX_VALUE[5]REX_VALUE[6]")){
function sortArticlesByREX_VALUE[5]REX_VALUE[6]( $artA, $artB) {
$sortby = 'REX_VALUE[5]';
//name, createdate, updatedate, online_from, online_to, prior
$createA = $artA->getValue($sortby);
$createB = $artB->getValue($sortby);
if ( $createA == $createB) {
return 0;
}
if('REX_VALUE[6]') return $createA > $createB ? -1 : 1;
else return $createA < $createB ? -1 : 1;
}
}
if(!function_exists("generatePagination")){
function generatePagination($articles, $listpage='0', $itemsperpage, $listnum){
$GETPARAMS = $_GET;
unset($GETPARAMS['list'.$listnum.'page']);
if($itemsperpage > 0){
$prevtext = "←";
$nexttext = "→";
$itemcount = count($articles);
$output = '';
$pagecount = ceil($itemcount / $itemsperpage);
if($pagecount > 1){
if($listpage > $pagecount) $listpage = $pagecount;
$prevpagenum = -1;
$nextpagenum = -1;
if($listpage > 0) $prevpagenum = $listpage-1;
if($listpage < ($pagecount-1)) $nextpagenum = $listpage+1;
$output = '<div id="pagination">';
if($prevpagenum >= 0) $output .= '<a href="'.rex_getUrl(REX_ARTICLE_ID).'?list'.$listnum.'page='.$prevpagenum.'&'.http_build_query($GETPARAMS).'" id="prevlink">'.$prevtext.'</a> ';
for($pagenum = 0; $pagenum < $pagecount; $pagenum++){
if($pagenum == $listpage){
$output .= '<b>'.($pagenum+1).'</b> ';
}
else{
$output .= '<a href="'.rex_getUrl(REX_ARTICLE_ID).'?list'.$listnum.'page='.$pagenum.'&'.http_build_query($GETPARAMS).'">'.($pagenum+1).'</a> ';
}
}
if($nextpagenum > 0) $output .= '<a href="'.rex_getUrl(REX_ARTICLE_ID).'?list'.$listnum.'page='.$nextpagenum.'&'.http_build_query($GETPARAMS).'" id="nextlink">'.$nexttext.'</a>';
$output .= '</div>';
}
return $output;
}
else{
return "";
}
}
}
if(!function_exists("limitArticles")){
function limitArticles($articles, $listpage = '0', $itemsperpage){
if($itemsperpage){
$itemcount = count($articles);
$pagecount = ($itemcount / $itemsperpage);
if($listpage > $pagecount) $listpage = $pagecount;
$offset = $listpage*$itemsperpage;
return array_slice ($articles, $offset ,$itemsperpage);
}
return $articles;
}
}
if(!function_exists("createArticleOutput")){
function createArticleOutput($article, $thumbsize, $fromMetadata, $withmorelink){
global $REX;
$articleId = $article->getId();
if($fromMetadata != '1'){ // from Metadata
$headline = $article->getValue('name');
$newstext = $article->getValue('description');
$image = $article->getValue('file');
}
else{ // from first Slice
if($firstSlice = OOArticleSlice::getFirstSliceForArticle($articleId)){
$headline = $firstSlice->getValue(7);
$teaser = $firstSlice->getValue(1);
if (!function_exists('truncate'))
{
function truncate($string, $length = 300, $etc = '...', $break_words = false)
{
if ($length == 0)
return '';
if (strlen($string) > $length)
{
$length -= strlen($etc);
if (!$break_words)
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length +1));
return substr($string, 0, $length).$etc;
}
else
return $string;
}
}
$newstext = truncate( strip_tags( $teaser, '<br/>'));
$image = $firstSlice->getFile(1);
}
}
$output .= '<div>';
if($thumbsize != '0'){
$output .= '<div class="newsimage">';
if($image != ''){
$output .= '<a href="'.rex_getUrl($articleId).'"><img src="'.$REX[HTDOCS_PATH].'index.php?rex_resize='.$thumbsize.'a__'.$image.'" alt="'.$headline.'"/></a>';
}
$output .= '</div>';
}
$output .= '<div class="journal-artikel"><strong><a class="title" title="Den gesamten Text anzeigen" href="'.rex_getUrl($articleId).'">'.$headline.'</a></strong>';
$output .= '<ul><li><p class="journal-date">'.date("d.m.Y.",$article->getCreateDate()).'</p></li></ul>';
$output .= '<p>'.$newstext;
if($withmorelink<2) $output .= ' <br /><a class="more" title="Den gesamten Text anzeigen" href="'.rex_getUrl($articleId).'">Weiterlesen »</a>';
$output .= '</p></div></div>';
return $output;
}
}
// Ausgabe-Code erzeugen
//nummerierung für GET
if($MLnum <0) $MLnum = 1;
else $MLnum ++;
$articles = OOArticle::getArticlesOfCategory('REX_VALUE[1]', true);
if (is_array($articles))
{
//Filtern
$articles = filterArticles($articles, 'REX_VALUE[2]', 'REX_VALUE[3]', 'REX_VALUE[4]');
}
if (count($articles) > 0)
{ //sortieren
if('REX_VALUE[5]'){
usort($articles, 'sortArticlesByREX_VALUE[5]REX_VALUE[6]');
}
//generate Pagination
$pagination = "";
if('REX_VALUE[9]' > 0){
$listpage = !empty($_GET['list'.$MLnum.'page']) ? (int) $_GET['list'.$MLnum.'page'] : 0;
if('REX_VALUE[10]' == '1'){
$pagination = generatePagination($articles, $listpage, 'REX_VALUE[9]', $MLnum);
}
//Limit
$articles = limitArticles($articles, $listpage, 'REX_VALUE[9]');
}
if(count($articles) > 0){
$output = '<div class="newslist">';
foreach ($articles as $var)
{
$output .= createArticleOutput($var, REX_VALUE[8], 'REX_VALUE[7]', 'REX_VALUE[3]');
}
$output .= '</div>';
echo $output.'<br />'.$pagination;
}
}
?>