[phpBB Debug] PHP Warning: in file [ROOT]/ext/tas2580/seourls/event/listener.php on line 213: Undefined array key "FORUM_NAME"
REDAXO Forum • Frage zu Modul "Artikel Teaser mit Einstelloptionen..."
Seite 1 von 1

Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 3. Mai 2011, 09:45
von Kucki2
Guten Morgen,

ich möchte gern das Modul "Artikel Teaser mit Einstelloptionen und Paginierung"
http://www.redaxo.org/de/download/modul ... &cat_id=-1.

Ich habe das Modul angelegt, wie erforderlich eine extra Datei für die Sortierfunktion (sortieren.php) erstellt und diese in den files-Ordner geladen.

Mir ist nur nich klar, wo ich das Ganze includen soll:

Code: Alles auswählen

<? include('files/sortieren.php'); ?>


Wäre schön, wenn mir jemand helfen könnte.

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 3. Mai 2011, 15:19
von Kucki2
Hat sich soeben erledigt. Hab's selber rausgefunden :-)

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 10. Mai 2011, 08:39
von bb_web
habe das das gkeiche problem - vielleicht andere ja auch --

könntest du uns deine lösung vielleicht mitteilen? :?:

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 10. Mai 2011, 09:07
von Kucki2
Sorry, natürlich gern :-)

Ich habe wie beschrieben den php-Code für die Sortierfunktion in einer Datei "sortieren.php" abgespeichert und diese dann in der Modulausgabe ganz am Anfang inkludiert:

Code: Alles auswählen

<? include('files/sortieren.php'); ?>

<?php

if (!function_exists('ep_checkOnlineDate'))
{
	function ep_checkOnlineDate($date, $article_date)
	{
		if ($date > 0 && $article_date == '')
			return false;
		elseif ($date > 0 && $article_date < $date)
			return false;
		
		return true;
	}
}

$out = '';
$article_total = 'REX_VALUE[6]';
$article_per_page = 'REX_VALUE[2]';
$mode = 'REX_VALUE[3]';
$sort = 'REX_VALUE[5]';
$date_start = 'REX_VALUE[8]';

$hdl_tag = 'REX_VALUE[7]';
if ($hdl_tag == '')
	$hdl_tag = 'h3';

$cat_id = 0;
if ($mode == 't' || $mode == 'tf')
	$cat_id = REX_CATEGORY_ID;
elseif ($mode == 'c' || $mode == 'cf')
	$cat_id = 'REX_VALUE[4]';
	
$date_start_time = 0;
if ($date_start != '')
{
	$date_start_arr = explode('|', $date_start);
	
	$date_start_time = mktime('0', '0', '0', date('m'), date('d'), date('Y'));
	$date_seconds = $date_start_arr[1] * 24 * 60 * 60;
	switch ($date_start_arr)
	{
		case '-':
			$date_start_time = $date_start_time - $date_seconds;
			break;
			
		case '+':
			$date_start_time = $date_start_time + $date_seconds;
			break;
	}
	
//	echo date('d.m.Y - H:i:s', $date_start_time);
}

$page = rex_request('page', 'int', '1');


$month_abbr = array();
$month_abbr[0][1] = 'Jan';
$month_abbr[0][2] = 'Feb';
$month_abbr[0][3] = 'Mrz';
$month_abbr[0][4] = 'Apr';
$month_abbr[0][5] = 'Mai';
$month_abbr[0][6] = 'Jun';
$month_abbr[0][7] = 'Jul';
$month_abbr[0][8] = 'Aug';
$month_abbr[0][9] = 'Sep';
$month_abbr[0][10] = 'Okt';
$month_abbr[0][11] = 'Nov';
$month_abbr[0][12] = 'Dez';

// OOArticel werden gespeichert
$article_list = array();


// Artikel holen fuer Modus
// -> seitenuebergreifend
if ($mode == 'p')
{
	$sql = new rex_sql();
//	$sql->debugsql = true;
	$sql->setQuery('SELECT id FROM rex_article WHERE art_teaser = "|true|" AND status = "1" AND id != "REX_ARTICLE_ID"');
	
	$rows = $sql->getRows();
	if ($rows >= 1)
	{
		for ($i = 1; $i <= $rows; $i++, $sql->next())
		{
			$ooarticle = OOArticle::getArticleById($sql->getValue('id'));
			
			if (ep_checkOnlineDate($date_start_time, $ooarticle->getValue('art_online_from')) )
				$article_list[] = $ooarticle;
		}
	}
}

// Artikel holen fuer Modus
// -> Aktuelle Kategorie
// -> Kategorie wählen
if (($mode == 't' || $mode == 'c') && $cat_id > 0)
{
	$articles = OOArticle::getArticlesOfCategory($cat_id, true);
	foreach ($articles as $ooarticle)
	{
		if ($ooarticle->isStartArticle())
			continue;
/*		
		if ($ooarticle->getValue('art_teaser') != '|true|')
			continue;
*/			
		// Endlosschleife vermeiden
		if ($ooarticle->getId() == REX_ARTICLE_ID)
			continue;
		
		
		if (ep_checkOnlineDate($date_start_time, $ooarticle->getValue('art_online_from')) )
			$article_list[] = $ooarticle;
	}
}


// Artikel holen fuer Modus
// -> Aktuelle Kategorie und alle darunter
// -> Kategorie wählen und alle darunter
if (($mode == 'tf' || $mode == 'cf') && $cat_id > 0)
{
	$sql = new rex_sql();
//	$sql->debugsql = true;
	$sql->setQuery('SELECT id FROM rex_article WHERE art_teaser = "|true|" AND status = "1" AND id != "REX_ARTICLE_ID" AND path LIKE "%|'.$cat_id.'|%" ');
	
	$rows = $sql->getRows();
	if ($rows >= 1)
	{
		for ($i = 1; $i <= $rows; $i++, $sql->next())
		{
			$ooarticle = OOArticle::getArticleById($sql->getValue('id'));
			
			if (ep_checkOnlineDate($date_start_time, $ooarticle->getValue('art_online_from')) )
				$article_list[] = $ooarticle;
		}
	}
}



// Sortierung
if (count($article_list) > 0)
{
	$sort_arr = explode('|', $sort);
	$sort_f = strtolower($sort_arr[0]); // Feld
	$sort_c = strtolower($sort_arr[1]); // Kriterium (ASC / DESC)
	if ($sort_f == 'prior' AND $sort_c == 'asc')
		usort($article_list, "sortArticlesByPrio"); 
	elseif ($sort_f == 'prior' AND $sort_c == 'desc')
		usort($article_list, "sortArticlesByPrioDesc"); 
	elseif ($sort_f == 'date' AND $sort_c == 'asc')
		usort($article_list, "sortArticlesByOnlineFromDate"); 
	elseif ($sort_f == 'date' AND $sort_c == 'desc')
		usort($article_list, "sortArticlesByOnlineFromDateDesc"); 
}


if ($article_total > 0)
{
	$article_list = array_slice($article_list, 0, $article_total);
}


$navi_pag = '';
if ($article_per_page > 0)
{
	$articles_length = count($article_list);
	$pages = ceil($articles_length / $article_per_page);
	
	//$offset = $page - 1;
	$offset = ($page * $article_per_page) - $article_per_page;
	$article_list = array_slice($article_list, $offset, $article_per_page);
	
	
	// Pagination
	for ($i = 1; $i <= $pages; $i++)
	{
		$param = '';
		if ($page == $i)
			$param .= ' active';
			
		if ($i == 1)
			$param .= ' first';
			
		if ($param != '')
			$param = ' class="'.trim($param).'"';
		
		$navi_pag .= '<a'.$param.' href="'.rex_getUrl('', '', array('page' => $i)).'">'.$i.'</a>';
	}
}


if (count($article_list) > 0)
{
	$c = 0;
	foreach ($article_list as $article)
	{
		
		
		$c++;
		
		$name = '';	
		$name = $article->getValue('art_teaser_hdl');
		if ($name == '')
			$name = $article->getName();
			
		$desc = $article->getValue('art_teaser_text');
		$file = $article->getValue('art_teaser_file');
	
		$teaser_link = $article->getValue('art_teaser_link_intern'); 
		
		$link_id = '';
		if ($teaser_link != '' && $teaser_link > 0)
			$link_id = $teaser_link;
		else
			$link_id = $article->getId();
		
		$link = '';
		// Link nur anzeigen, wenn Checkbox deaktiviert ist
		if ($article->getValue('art_teaser_link_more') != '|true|')
			$link = '<a class="lk1" href="'.rex_getUrl($link_id).'">REX_VALUE[1]</a>';
		
		
		$hdl = '';
		$hdl .= '<'.$hdl_tag.' class="hl hl4">';

		// nur verlinken, wenn weiterlesen link vorhanden ist
		if ($link != '')
			$hdl .= '<a href="'.rex_getUrl($link_id).'">';
		
		$hdl .= $name;
		
		if ($link != '')
			$hdl .= '</a>';
			
		$hdl .= '</'.$hdl_tag.'>';



		$from = '';
		if ($article->getValue('art_online_from') != '')
		{
			$date = $article->getValue('art_online_from');
			$d = date('d', $date);
			$m = date('n', $date);
			
			$from = '<span class="date"><span class="day">'.$d.'</span><span class="month">'.$month_abbr[$REX['CUR_CLANG']][$m].'</span></span>';
//			$from = '<p class="tx1 tsr-date">'.date('d.m.Y', $article->getValue('art_online_from')).'</p>';
		}
		
		$class = '';
		
		$file_out = '';
		if ($file != "")
		{
			$class = ' ti-bl';
		
			$src = '';
			$srcWidth = 1;
			$imageWidth = 150;
			$s = getimagesize($REX['HTDOCS_PATH'].'files/'.$file);
			if ($s[0] > $imageWidth)
			{
				$src = '/index.php?rex_img_type=ws_typt1&rex_img_file='.$file;
				$srcWidth = $imageWidth;
			}
			else
			{
				$src = $REX['HTDOCS_PATH'].'files/'.$file;
				$srcWidth = $s[0];
			}
	
			$factor = $s[0] / $srcWidth;
			$srcHeight = round($s[1] / $factor);
			
			$media = OOMedia::getMediaByName($file);
			$title = $media->getTitle();
			
			$file_out = '<p class="img fl-lft"><span class="img shdw">';
			
			// nur verlinken, wenn weiterlesen link vorhanden ist
			if ($link != '')
							
			$file_out .= '<img src="'.$src.'" title="'.$title.'" alt="'.$title.'" width="'.$srcWidth.'" height="'.$srcHeight.'" />'.$from;
			

			$file_out .= '</span></p>';
		}
		
		$text_out = '';
		if($desc != '')
		{
			$textile = htmlspecialchars_decode($desc);
			$textile = str_replace("<br />", "", $textile);
			$textile = rex_a79_textile($textile);
	
			$srch = array();
			$rplc = array();
			
			$srch[] = 'href="#fn';
			$rplc[] = 'href="'.rex_getUrl().'#fn';
			
			$srch[] = 'href="http://';
			$rplc[] = 'class="lk4" href="http://';
			
			$srch[] = 'href="/';
			$rplc[] = 'class="lk1" href="/';
			
			$textile = str_replace($srch, $rplc, $textile);
	
			if (substr($textile, -4) == '</p>')
				$textile = substr($textile, 0, -4).' '.$link.'</p>';
			else
				$textile .= '<p class="tsr-lk">'.$link.'</p>';
			
			$text_out = '<div class="content">'.$hdl.$textile.'</div>';
		}
		
		$tsr_class = '';
		if ($c == 1)
			$tsr_class = ' tsr-first';
	
		$out .= '<div class="tsr'.$tsr_class.'">';
		$out .= '<div class="slice ti'.$class.'">';
//		$out .= $from.$name;
		$out .= $file_out.$text_out;
		$out .= '<div class="clearer"> </div>';
		$out .= '</div></div>';
	
	}
}


if ($navi_pag != '')
	$out .= '<br><br><div class="pagination">Seite '.$navi_pag.'</div>';

echo $out;
?>
Ich weiß zwar nicht, ob das der beste Weg ist, aber es funktioniert bei mir auf jeden Fall.

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 11. Mai 2011, 18:10
von bb_web
Danke Dir - iss doch egal ob elegant oder der beste weg -- das ergebniss zählt -- :D

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 20. Mai 2011, 09:56
von bb_web
hi Kucki -- habe das jetzt mal versucht durchzuziehen

klappt bei mir aber nicht, habe die datei wie du eingebunden -- aber beim/nach dem einbinden des modulds kommt folgende fehlermeldung

Code: Alles auswählen

Warning: include(files/sortieren.php) [function.include]: failed to open stream: Datei oder Verzeichnis nicht gefunden in /home/www/kunden/xxx.de/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 2204

Warning: include() [function.include]: Failed opening 'files/sortieren.php' for inclusion (include_path='.:/opt/php5/share/pear') in /home/www/kunden/xxx.de/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 2204

Warning: usort() [function.usort]: Invalid comparison function in /home/www/kunden/xxx.de/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 2357

Seite

        1

hast du nen schimmer was das problem ist??? wie gesagt die datei liegt im verzeichnis files -- komme da momentan nicht dahinter :shock:

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 20. Mai 2011, 10:06
von Kucki2
Sorry, aber ich habe wirklich keine Ahnung. Vielleicht liest aber ja jemand den Beitrag, der Dir weiterhelfen kann.

Oder weißt Du was, ich glaub das Problem hatte ich auch, nachdem ich eines der Galerie-Addons(sowohl gs-fancybox als auch lightbox) installiert habe. Nachdem ich das Addon wieder deinstalliert habe, lief der Teaser problemlos. Ist nicht wirklich toll, aber in meinem Fall konnte ich auf eine schöne Bilderausgabe verzichten.

Viel Glück :-)

LG, Kucki2.

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 20. Mai 2011, 10:33
von bb_web
ok -- dank erstmal -- iss jetzt natürlich mühselig das entsprechende adon zu finden welches stört

habe die lightbox mal rausgeschmissen, benutze ich eh nich -- aber ändern tut sich auch nix -- na mal sehen ob sich da noch jemand meldet der mir weiterhelfen kann --

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 20. Mai 2011, 10:43
von bb_web
so habe jetzt ne lösung gefunden die auch geht --

habe den kompletten code der php datei einfach an den anfang des moduls kopiert -- ist ja irgendwie das selbe wie include --

und jetzt klappts erstmal -- iss doch echt witzig manchmal :roll:

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 23. Dez 2011, 16:05
von pummelfee
Ich bekomme folgende Fehlermeldung ausgeworfen.


Warning: usort() [function.usort]: Invalid comparison function in /homepages/23/d395278342/htdocs/motorists/redaxo/include/classes/class.rex_article.inc.php(133) : eval()'d code on line 152
Sortierfunktionen als Datei abspeichern und includen.


Was kann die Ursache sein????

HappyXmas!!!!!

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 6. Jan 2012, 12:48
von chandany
Kucki2 hat geschrieben:

Code: Alles auswählen

<? include('files/sortieren.php'); ?> ...
Bereitet unter PHP5.3 ... erhebliche Problem.
im FE funzt folgender Aufruf:

Code: Alles auswählen

include './files/inc/art_pagination.inc.php'; 
aber BE erhalte ich dafür folgende Fehlermldung: :roll:

Code: Alles auswählen

Warning: include(./files/inc/art_pagination.inc.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/redaxo4_3_2_community/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 90

Warning: include() [function.include]: Failed opening './files/inc/art_pagination.inc.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/redaxo4_3_2_community/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 90

Warning: usort() expects parameter 2 to be a valid callback, function 'sortArticlesByPrioDesc' not found or invalid function name in /Applications/XAMPP/xamppfiles/htdocs/redaxo4_3_2_community/redaxo/include/classes/class.rex_article_base.inc.php(354) : eval()'d code on line 245
Habt Ihr ne Idee????

Re: Frage zu Modul "Artikel Teaser mit Einstelloptionen..."

Verfasst: 6. Jan 2012, 12:53
von chandany
chandany hat geschrieben:
Kucki2 hat geschrieben:
Habt Ihr ne Idee????
Mann War ich blööööööööööööööööööööööööööööööööD!!!!!

REINKOPIEREN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :oops: