Seite 1 von 1

News Artikellisten, geöffneten Artikel anzeigen

Verfasst: Do 8. Mai 2008, 14:34
von Snuppel007
Hallo zusammen,

ich hab mal im Forum nach Artikellisten und Navigation gesucht und leider nix gefunden.

Ich brauche eine art Artikel-Navigation, dazu müsste man das News-Modul der 4.6.8 so ändern das wenn ich einen Artikel aus der Newsliste ansehen dieser (über CSS) auch gekennzeichnet wir, so wie bei der Navi, passiv und open. Hat jemand einen Rat zur hand wie man das ändern könnte???

Sonnige Grüße, der Snuppel

Verfasst: Fr 9. Mai 2008, 18:17
von emergence
naja ich hab jetzt nur den code aus modul vor mir...

Code: Alles auswählen

$href = $sess->url("front_content.php?idcat=$selcat&idart=$article_id");
den jeweilig aktuellen artikel hast du dann, wenn die $idart ident mit $article_id ist...

mit einer kleinen if abfrage ist das thema keines mehr...

Verfasst: Mi 23. Jul 2008, 16:49
von stefkey
Hallo,

kann jemand die if-Abfrage formulieren?

Ich habe leider keine Programmierkenntnisse :-(

Um Hilfe wäre ich echt dankbar.

Ich brauche eigentlich eine Navigation für die Artikel einer Kategorie.
Die Navi-Module zeigen nur Kategorien. Sitemap und Artikellisten zeigen leider nicht den aktiven Artikel.

Ich würde versuchen das dann in ein Artikellisten Modul einzubauen. Vielleicht kann mir da auch jemand helfen...

2. Problem dann: Es soll der Artikeltitel angezeigt werden nicht etwa eine Headline oder sonstiges.


Ich hänge da jetzt schon 1 Tag dran und komme leider nicht weiter. Vielleicht hat jemand ein paar Tips für mich.


Besten Dank,
stefkey

Verfasst: Mi 23. Jul 2008, 18:01
von OliverL
kenne mich leider bei 4.6.8 nicht aus.
Poste mal die Ausgabe des Moduls.
Sollte simpel sein.

mfg OliverL

Verfasst: Mi 23. Jul 2008, 18:36
von stefkey
Hi OliverL,

danke für die Hilfe! Ich denke auch es kann nicht kompliziert sein. Man muss halt wissen was man tut...daran scheitert es bei mir.


Hier mal den Output des News-Moduls von der Demo-Installation.
Allerdings gibt es auch ein älteres Modul das wesentlich kürzer im Output ist...vielleicht ist das besser zu überfliegen.

Hier zuerst mal das neue:

<?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
$selcat = "CMS_VALUE[1]";
$template = "teaser-standard.html";
// anzahl der zeichen text
$mxtext = 200;

$limit = "CMS_VALUE[15]";

$cms_sort_direction = "CMS_VALUE[16]";
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', $newsheadline);

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;
}

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]);

$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');

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->next();

} // end for

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

}
}
?>


Grüße und Danke

Verfasst: Mi 23. Jul 2008, 18:41
von stefkey
Hier das ältere "kürzere" Modul.

Aus diesem Thread:
http://forum.contenido.org/viewtopic.ph ... tikelliste


Grüße und Vielen Dank!


<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* REFERENZ MODUL / ARTIKELLISTE
*
* Artikelliste mit Img 1, Head 1, Head 2
*
* Erstellt eine Liste mit allen Artikel bis
* auf den Startartikel.
*
* Author : Jan Lengowski
* Copyright : four for business AG
* Created : 15-08-2002
* Modified : 16-08-2002
* Modified : 23-08-2004 Sortierung nach Artikelsortierer
************************************************/

// second db class instance
$db2 = new DB_Contenido;

// selected category
$selcat = "CMS_VALUE[0]";

if($selcat!="0" && $selcat!=""){

// select all articles in category widthout start article
$query = "SELECT ARTLANG.title,ARTLANG.idart, ARTLANG.idartlang, ARTLANG.artsort FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".
$cfg["tab"]["art_lang"]." AS ARTLANG ".
"WHERE CATART.idcat = '$selcat' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' ORDER BY ARTLANG.artsort, CATART.idart";

// execute query
$db->query($query);

unset($articleID);
unset($linkID);


// get id's of sub articles
while ($db->next_record()) {
$articleID[] = $db->f("idartlang");
$linkID[] = $db->f("idart");
$sortID[] = $db->f("artsort");
} // end while

// loop through subarticles

echo '
<table width="140" border="0" cellspacing="0" cellpadding="0">
<td width="120 class=text_klein_fett>CMS_VALUE[2]</td></tr>
';

if (is_array($articleID)) {

foreach ($articleID as $key => $value) {

// select all CMS variables of the article
$sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '1'";
$db->query($sql);
$db->next_record();
$head = $db->f("value");

if ( strlen($head) > "CMS_VALUE[3]") {
$head = substr($head, 0, "CMS_VALUE[3]");
$head .= '..';
}

// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");

echo '<tr><td class="artlist" style="padding-top:3px; padding-bottom:3px"><a href="'.$link.'"><font size="-1">'.strip_tags(urldecode($db->f("value"))).'</font></a></td></tr>';

} // end while



unset($headline);
unset($text);

} // end foreach

} // end if (is_array)

echo '</table><br>';

?>