Seite 2 von 2

Verfasst: Di 5. Dez 2006, 08:07
von wosch
Marvel hat geschrieben:Kann es daran liegen das das web unter http://www.xyz.de/xyz/cms (also in einem Unterordner) liegt?
Wenn das Modul von HerrB läuft, müßte auch die Artikelliste laufen, und demnach dürfte es nichts ausmachen.

Was du noch machen könntest:
Das ausprobieren was die Dodger77 im 2. Beitrag geschrieben hat
oder
in dem Thread zu diesem Modul von HerrB nochmals neu nachfragen:
http://www.contenido.org/forum/viewtopic.php?t=8887

Verfasst: So 10. Dez 2006, 14:30
von KreativeStube.de
Hallo,

an welcher Stelle wird denn das Datumsformat geändert? Habe es mit

$teaser_erstellt = date('d.m.Y', $created);

versucht, doch das Datum wird dann mit 01.01.1970 angezeigt.

Gruss,
Marco

Verfasst: Mo 11. Dez 2006, 10:57
von HerrB

Code: Alles auswählen

$teaser_erstellt = date('d.m.Y', strtotime($created));
Gruß
HerrB

Verfasst: Mo 11. Dez 2006, 18:58
von KreativeStube.de
HerrB hat geschrieben:

Code: Alles auswählen

$teaser_erstellt = date('d.m.Y', strtotime($created));
Gruß
HerrB
hi,

macht er leider nicht, datumsformat ist dann zwar richtig, allerdings schmeisst er das aktuelle tagesdatum raus.

vg,
marco

Verfasst: Di 12. Dez 2006, 11:00
von HerrB
Dann ist $created leer. Woher kommt der Wert (habe mir den Code die Seiten vorher nicht angesehen)?

Gruß
HerrB

Verfasst: Mo 26. Feb 2007, 19:42
von KreativeStube.de
guten abend,

ich habe leider noch immer das problem, dass bei mir anstatt des erstelldatums immer 1.1.1970 angezeigt wird.

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname  :      News
* Author(s)   :     Andreas Lindner, 4fb
* Copyright   :     Contenido - four for business, Andreas Lindner
* Created     :     12.08.2005
************************************************/

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

if (!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]";
//echo "sel $selcat<br>";
$template = "teaser-news.html";
//echo "tpl $template<br>";
// 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';
}

$newsheadline = "CMS_VALUE[4]";

$tpl->set('s', 'TITLE', $newsheadline);

if (strlen($selcat) > 0 AND $selcat != '0') {
   $options = array ('idcat' => $selcat, "start" => false, "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');
         $teaser_erstellt = $article->getField('created');
 $teaser_erstellt = date('d.m.Y', ($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', 'CREATE', $teaser_erstellt);
         $tpl->set('d', 'MORE', mi18n("mehr"));

         $tpl->next();

      } // end for

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

   }
}
?>

viele grüsse,
marco

Verfasst: Di 27. Feb 2007, 11:41
von wosch
Ich habe auf die Schnelle mal das News-Modul geändert und getestet, es funktioniert mit der Datumsanzeige.
Das Datum wird noch so angezeigt: erstellt: 2007-02-26 16:56:44
Das was HerrB geschrieben hat muß du noch einarbeiten.

Hier der letzte Teil des Modul-Output wo die Änderungen sind:

Code: Alles auswählen

			} // 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', 'DATUM', $teaser_erstellt);
			$tpl->set('d', 'MORE', mi18n("mehr"));

			$tpl->next();

		} // end for

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

	}
}
?>
Im Template muß dann noch der Platzhalter für das Datum rein.
Könnte z. B. so aussehen:
Modultemplate:

Code: Alles auswählen

<h1 class="content">{TITLE}</h1>
<!-- BEGIN:BLOCK -->
<hr>
<A HREF="{HREF}"><B>{HEADLINE}</B></A>
<TABLE>
<TR><TD VALIGN="TOP" ALIGN="LEFT">{IMG}</TD>
<TD ALIGN="LEFT" VALIGN="TOP"><BR>{TEXT}<BR><BR><A HREF="{HREF}">{MORE}</A><br>erstellt: {DATUM}</TD>
</TR>
</TABLE>
<!-- END:BLOCK -->

Verfasst: Mi 28. Feb 2007, 13:08
von KreativeStube.de
wosch hat geschrieben:Ich habe auf die Schnelle mal das News-Modul geändert

$tpl->set('d', 'DATUM', $teaser_erstellt);
hi wosch,

wenn ich dies einbaue, zeigt er mir nur {CREATE} HEADLINE an.

ändere ich diese zeile in:
$tpl->set('d', 'CREATE', $teaser_erstellt);

schmeisst er das erstellungsdatum in der form 2007-02-26 16:56:44 aus. eigentlich auf dem richtigen weg. wenn ich versuche, das darum in die form d.m.y zu bekommen geht es aber wieder los.....

baue ich den teil von herr b ein:
$teaser_erstellt = date('d.m.Y', strtotime($created));

schmeißt er mir leider das akutelle tagedatum raus.

wenn ich es in $teaser_erstellt = date('d.m.Y', $created); änder habe ich leider wieder die 01.01.1970 problematik.

der code sieht jetzt wie folgt aus:

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname  :      News
* Author(s)   :     Andreas Lindner, 4fb
* Copyright   :     Contenido - four for business, Andreas Lindner
* Created     :     12.08.2005
************************************************/

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

if (!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]";
//echo "sel $selcat<br>";
$template = "teaser-news.html";
//echo "tpl $template<br>";
// 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';
}

$newsheadline = "CMS_VALUE[4]";

$tpl->set('s', 'TITLE', $newsheadline);

if (strlen($selcat) > 0 AND $selcat != '0') {
   $options = array ('idcat' => $selcat, "start" => false, "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');
         $teaser_erstellt = date('d.m.Y', strtotime($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', 'CREATE', $teaser_erstellt); 
         $tpl->set('d', 'MORE', mi18n("mehr"));

         $tpl->next();

      } // end for

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

   }
}
?>

Verfasst: Mi 28. Feb 2007, 14:40
von wosch
Du vermischt 2 Probleme miteinander.

1. Datumsanzeige:
ist gelöscht, es wird dir das "Erstellungsdatum" angezeigt.
KreativeStube.de hat geschrieben:wenn ich dies einbaue, zeigt er mir nur {CREATE} HEADLINE an.
Das war mein Fehler, ich habe im ersten Post eine andere Variable genommen als im 2. Post des Codes, extra.
Nur hätte ich es vielleicht erwähnen sollen.

Das das Datum nicht in der Formatierung wie von dir gewünscht angezeigt wird ist das 2. Problem.
Möglich das du da die falsche Variable genommen hast, oder ???
Da wird HerrB mehr, besser und kompetenter was zu sagen könne.

Verfasst: Do 1. Mär 2007, 09:04
von KreativeStube.de
wosch hat geschrieben: Da wird HerrB mehr, besser und kompetenter was zu sagen könne.
ja wäre toll denn ich finde den fehler leider nicht.

vielen dank auf jeden fall für deine hilfe wosch.

gruss,
marco

Verfasst: Do 1. Mär 2007, 18:14
von KreativeStube.de
machen wir es lieber so bevor man den überblick verliert. bei dem folgenden stand:

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname  :      News
* Author(s)   :     Andreas Lindner, 4fb
* Copyright   :     Contenido - four for business, Andreas Lindner
* Created     :     12.08.2005
************************************************/

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

if (!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]";
//echo "sel $selcat<br>";
$template = "teaser-news.html";
//echo "tpl $template<br>";
// 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';
}

$newsheadline = "CMS_VALUE[4]";

$tpl->set('s', 'TITLE', $newsheadline);

if (strlen($selcat) > 0 AND $selcat != '0') {
   $options = array ('idcat' => $selcat, "start" => false, "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');
         $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', 'CREATE', $teaser_erstellt);
         $tpl->set('d', 'MORE', mi18n("mehr"));

         $tpl->next();

      } // end for

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

   }
}
?>
bekomme ich die datumsanzeige 2007-01-22 18:34:48 diese soll jetzt in die form D.M.Y gesetzt werden.

ich bin wirklich über jeden tipp und hilfe dankbar.

Verfasst: Do 1. Mär 2007, 18:35
von Oldperl
Diese Zeile:

Code: Alles auswählen

$teaser_erstellt = $article->getField('created'); 
Ändern in:

Code: Alles auswählen

$teaser_erstellt = date('d.m.Y', strtotime($article->getField('created')));
Gruß aus Franken

Ortwin

Verfasst: Do 1. Mär 2007, 18:41
von KreativeStube.de
:) vielen, vielen Dank Ortwin.

gruss aus dem ruhrgebiet,
marco