Seite 1 von 1

Newsliste modifiziert, nun immer das gleiche Teaserbild?

Verfasst: Do 14. Aug 2008, 13:37
von tommo
Hallo,

ich hab die Newsliste so abgeändert, dass ich über IMG[x] eine Teaserbild bestimmen kann.
Leider wird bei jedem Newseintrag das selbe Teaserbils (des ersten Artikels) angezeigt.

Was hab ich denn vergessen?

Hier der Output:

Code: Alles auswählen

<?php
/**
* $RCSfile$
*
* Description: Newslist / ArticleList. Module "Output".
*
* @version 1.0.0
* @author Andreas Lindner
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2005-08-12
* }}
*
* $Id$
*/

cInclude('classes', 'class.article.php');
cInclude('includes', 'functions.api.string.php');
cInclude('includes', 'functions.api.images.php');



if (!isset($tpl) || !is_object($tpl)) {
    $tpl = new Template();
}

$tpl->reset();

$sql = "SELECT
            htmlpath, frontendpath
        FROM
            ".$cfg["tab"]["clients"]." 
        WHERE
            idclient = ".$client." ";

$db->query($sql);

if ($db->next_record()) {
	$htmlpath = $db->f('htmlpath');
	$frontendpath = $db->f('frontendpath');
}

// selected category


if ($auth->auth["uid"] == "nobody"){
$selcat = "CMS_VALUE[1]";	
} else {
$selcat = "65";	
}


$template = "teaser-standard.html";
// anzahl der zeichen text
$mxtext = 450;

$limit = "CMS_VALUE[15]";

//$cms_sort_direction = "CMS_VALUE[16]";
//$cms_sort_direction = "desc";
if ($cms_sort_direction == '') {
	$cms_sort_direction = 'desc';
}

if ("CMS_VALUE[3]" == "sortdate") {
	$order = 'lastmodified';
} else {
	$order = 'artsort';
}

if ("CMS_VALUE[17]" != '') {
	$with_start = true;
} else {
	$with_start = false;
}

$newsheadline = "CMS_VALUE[4]";

$tpl->set('s', 'TITLE', mi18n("Aktuelles"));

if (strlen($selcat) > 0 && $selcat != '0') {
	$options = array ('idcat' => $selcat, "start" => $with_start, "order" => $order, "direction" => $cms_sort_direction);

	$list = new ArticleCollection($options);

	$count = $list->count;

	if ($count > 0) {
		if (is_numeric($limit) AND strlen($limit) > 0) {
			if ($limit < $list->count) {
				$limit_art = $limit;
			} else {
				$limit_art = $list->count;
			}
		} else {
			$limit_art = $list->count;
		}
$counter=0;

		for ($i = 0; $i < $limit_art; $i ++) {

			$article = $list->nextArticle();

			$article_id = $article->getField('idart');

			$teaser_img = '';
			if ($noimg != 'true') {
				//$text_html = $article->getContent('CMS_HTML', 1);




				$regEx = "/<img[^>]*?>.*?/i";
				$match = array ();
				preg_match($regEx, $text_html, $match);

				$regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i";
				$img = array ();
				preg_match($regEx, $match[0], $img);
				$img_src = preg_split("/\//", $img[0]);

				$img_name = $img_src[count($img_src) - 1];
				$img_name = preg_replace("/\"/", "", $img_name);
				$img_split = preg_split("/\./", $img_name);
				$img_type = $img_split[count($img_split) - 1];

				$img_split2 = preg_split("/_/", $img_split[0]);

$bildnummer = $article->getContent('IMG', 123);

$sql = "SELECT
            *
        FROM
            ".$cfg["tab"]["upl"]." 
        WHERE
            idupl = ".$bildnummer." ";

$db->query($sql);

if ($db->next_record()) {
	$bildname = $db->f('filename');
	$pfad = $db->f('dirname');
}


$img_name = $bildname;


				$name = $img_name;

				if (count($img_split2) > 1) {
					$img_x = $img_split2[count($img_split2) - 1];
					$img_y = $img_split2[count($img_split2) - 2];

					if (is_numeric($img_x) AND is_numeric($img_y)) {
						$suffix = "_".$img_x."_".$img_y.".".$img_type;
						$name = preg_replace("/$suffix/", "", $img_name);
						$name = $name.".[a-zA-Z]{3}";
					}
				}

				$img_teaser = '';

				if (strlen($name) > 0) {
					$sql = "SELECT
													*
												FROM
													".$cfg["tab"]["upl"]." 
												WHERE
													filename REGEXP '$name' ";

					//echo "<pre>"; print_r($sql); echo "</pre>";

					$db->query($sql);

					if ($db->next_record()) {
						$filename = $db->f('filename');
						$dirname = $db->f('dirname');
					}

					$img_path = $cfgClient[$client]["upl"]["path"].$dirname.$filename;

					$img_size = "CMS_VALUE[14]";

					$img_teaser = capiImgScale($img_path, $img_size, $img_size, $crop = false, $expand = false, $cacheTime = 1000, $wantHQ = false);
				} // end if strlen

				if (strlen($img_teaser) > 0) {
					$teaser_img = '<img src="'.$img_teaser.'" class="teaser_img">';
				} else {
					$teaser_img = '';
				}

			} // end if noimg 		

			$headline = strip_tags($article->getContent('CMS_HTMLHEAD', 1));
			$headline = str_replace($replace, " ", $headline);

			/*			$subheadline = strip_tags($article->getContent('CMS_HTMLHEAD', 2));
						$subheadline = str_replace($replace, " ", $subheadline);*/

			$teaserheadline = /*$subheadline."&nbsp;-&nbsp;".*/
			$headline;
			$href = $sess->url("front_content.php?idcat=$selcat&idart=$article_id");
			$teasertext = $article->getField('summary');
                        $teaser_erstellt = $article->getField('created');

			if (strlen(trim($teasertext)) == 0) {
				$teasertext = strip_tags($article->getContent('CMS_HTML', 1));
				$teasertext2 = $teasertext;
				$teasertext = capiStrTrimAfterWord($teasertext, $mxtext);
				if ($teasertext!=$teasertext2) {
					$teasertext.= '...';
				}
				
			} // end if  
 			

			$teasertext = $teasertext."&nbsp;";

			$tpl->set('d', 'HEADLINE', $teaserheadline);
			$tpl->set('d', 'TEXT', $teasertext);
			$tpl->set('d', 'HREF', $href);
			$tpl->set('d', 'IMG', $teaser_img);
			$tpl->set('d', 'MORE', mi18n("mehr"));
                        $tpl->set('d', 'DATUM', $teaser_erstellt);
if ($counter==0){
                        $tpl->set('d', 'CLASS1', ' class="active"');
                        $tpl->set('d', 'CLASS2', '');
}else{
                        $tpl->set('d', 'CLASS1', '');
                        $tpl->set('d', 'CLASS2', '  style="display: none;"');
}


			$tpl->next();

$counter++;


		} // end for

		$tpl->generate('templates/'.$template);

	}
}
?>
Gruß,
Tom

Verfasst: Do 21. Aug 2008, 08:49
von emergence
verschoben...

Verfasst: Mo 25. Aug 2008, 15:31
von tommo
Kann mir denn keiner Helfen :(

Das Problem müssen doch schon mehr gehabt haben :?:

Tom

Verfasst: Di 26. Aug 2008, 16:01
von Jamest
Über das Thema News und Bilder wird hier scheinbar gern geschwiegen.

Wir haben auch probleme damit, und sind damit nicht die einzigsten, kannst ja mal hier schauen: Response nahezu 0!

http://forum.contenido.org/viewtopic.ph ... highlight=

Grüße

Jamest