Blätterbare Art.List mit ModRewrite

Gesperrt
Michael Tschauder
Beiträge: 87
Registriert: Fr 20. Aug 2004, 17:36
Wohnort: Stelle
Kontaktdaten:

Blätterbare Art.List mit ModRewrite

Beitrag von Michael Tschauder » Di 14. Feb 2006, 11:15

Hallo,
ich habe ein Prob mit der blätterbaren Artikelliste. Nachdem ich auf ModRewrite umgestellt habe sieht der Link von "vor" z.B. so aus:
www.domian.de/?p=2
Die URL der ersten Seite sieht so aus:
www.domain.de/top-aktuell/
Das CMS kann also aus der Variablen ?p=2 keine neue Seite mit den weiteren Texten aufrufen.

Der Code in der Liste dazu sieht so aus:

Code: Alles auswählen

         if (($pages - $page) != 0 && $browse) {
            $href = $sess->url("front_content.php?idcat=$selcat&p=$next");
            echo "<td><a href=\"".$href."\">vor</a></td>";
         }
Was muss nun geändert werden das es mit ModRewrite funktioniert? Oder geht es so nicht?

Hier noch ein Livebeispiel

http://www.on-sol.de/tschauder/Topnews/Newsarchiv/

mfg
Michael

PS: ModRewrite war das Upgrade vom Steese
... warum eigentlich nicht?

stese
Beiträge: 1040
Registriert: Fr 3. Dez 2004, 17:47
Wohnort: München
Kontaktdaten:

Beitrag von stese » Di 14. Feb 2006, 14:37

link zum artikellisten modul wäre nicht schlecht.

der generierte html code schaut so aus:

Code: Alles auswählen

<a href="/?p=3">
ich nehme mal sehr stark an dass das artikellisten modul die $_GET["idcat"] verarbeitet, die es nach mod rewrite nicht mehr gibt. du kannst statt dessen die interne variable $idcat nehmen, dann sollte es auch wieder funktionieren.

ausserdem sind einige deiner eingesetzten module recht seltsam mit den vollen urls geschrieben. prinzipiell sollte man bei verwendung von mod rewrite auf den zugriff auf contenido interne variablen die üblicherweise als parameter an die frontconten angehangen werden mittels $_GET oder $_REQUEST verzichten, die diese ja bei modrewrite weggeschnitten sind um die url schön zu machen. daher können diese module probleme bereiten.

Michael Tschauder
Beiträge: 87
Registriert: Fr 20. Aug 2004, 17:36
Wohnort: Stelle
Kontaktdaten:

Blätterbare Liste

Beitrag von Michael Tschauder » Mi 15. Feb 2006, 12:43

Hallo Stese (nun richtig geschrieben),

leider beschränken sich meine Fähigkeiten eher weniger auf PHP. Da habe ich man grade soviel von begriffen das ich weiß ich begreif das nicht mehr :oops:

Das mit den URL´s ist mir auch aufgefallen aber ich weiß nicht wo ich das ändern soll.

Zu dem Blättern, ich haber versucht den Quelltext zu ändern, was aber nicht den erwünschten Erfolg brachte, hier mal der Code das Moduls

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
* Modified    :     Clemens Koch, OWLweb (added page & browsing support)
* Date         :     20.01.2006
************************************************/

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

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

$aperpage = "CMS_VALUE[20]";
if ("CMS_VALUE[21]" != "") {
   $browse = true;
} else {
   $browse = false;
}

if ($aperpage == '') {
   $aperpage = 1000;
}

$pages = 0;

if (!isset ($_GET["p"])) {
   $page = 1;
} else {
   $page = $_GET["p"];
}
$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-standard2.html";
//echo "tpl $template<br>";
// anzahl der zeichen text
$mxtext = 110;

$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 ++) {

         if (($i % $aperpage) == 0) {
            $pages = $pages +1;
         }

         $article = $list->nextArticle();
         if ($pages == $page) {
            $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;".$next;

            $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);
      $selcat = $_GET["idcat"];
      if ($pages != 1) {
         $prev = $page -1;
         $next = $page +1;
         echo "<table><tr><td>";
         if ($page > 1 && $browse) {
            $href = $sess->url("front_content.php?idcat=$selcat&p=$prev");
            echo "<a href=\"".$href."\">zurück</a></td><td>";
         }
         for ($j = 1; $j < $pages +1; $j ++) {
            $href = $sess->url("front_content.php?idcat=$selcat&p=$j");
            if ($j == $page) {
               echo "[<b>".$j."</b>]";
            } else {
               echo "[<a href=\"".$href."\">".$j."</a>]";
            }
         }
         echo "</td>";
         if (($pages - $page) != 0 && $browse) {
            $href = $sess->url("front_content.php?idcat=$selcat&p=$next");
            echo "<td><a href=\"".$href."\">vor</a></td>";
         }
         echo "</tr></table>";

      }
   }
}
?> 
Wahrscheinlich muss im letzten Bereich was geändert werden das es auch mit ModRewrite läuft.
... warum eigentlich nicht?

timdubi
Beiträge: 75
Registriert: Fr 10. Sep 2004, 16:34
Kontaktdaten:

Beitrag von timdubi » Mi 15. Feb 2006, 16:01

Hi!

Hmm, versuchs mal damit! Bin mir nicht sicher - hier schwirren 2 Versionen rum. Ansonsten versuch die Liste von HerrB, aus dem Thread, aus dem du diese Liste hast.

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
* Modified    :     Clemens Koch, OWLweb (added page & browsing support)
* Date	      :     20.01.2006
************************************************/

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

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

$aperpage = "CMS_VALUE[20]";
if ("CMS_VALUE[21]" != "") {
	$browse = true;
} else {
	$browse = false;
}

if ($aperpage == '') {
	$aperpage = 1000;
}

$pages = 0;

if (!isset ($_GET["p"])) {
	$page = 1;
} else {
	$page = $_GET["p"];
}
$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-standard2.html";
//echo "tpl $template<br>";
// anzahl der zeichen text
$mxtext = 110;

$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 ++) {

			if (($i % $aperpage) == 0) {
				$pages = $pages +1;
			}

			$article = $list->nextArticle();
			if ($pages == $page) {
				$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&p=$page");
				$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             

$sql = "SELECT DATE_FORMAT(created, '%d.%m.%Y') AS Changedatum FROM concms_art_lang WHERE idart = " .$article_id;
         
         $db->query($sql);

         if ($db->next_record())
         {
            $time = $db->f('Changedatum');
         }  
				$teasertext = $teasertext."&nbsp;".$next;

				$tpl->set('d', 'HEADLINE', $teaserheadline);
                                $tpl->set('d', 'TIME', $time);
				$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);
		$selcat = $_GET["idcat"];
                if (isset($_GET["idart"])){
                  $link="front_content.php?idcat=$selcat&idart=" . $_GET["idart"];
                } else {
                  $link="front_content.php?idcat=$selcat";
                }
		if ($pages != 1) {
			$prev = $page -1;
			$next = $page +1;
			echo "<div class=\"pages\"><table><tr><td>";
			if ($page > 1 && $browse) {
				$href = $sess->url($link . "&p=$prev");
				echo "<a href=\"".$href."\">zurück</a></td><td>";
			}
			for ($j = 1; $j < $pages +1; $j ++) {
				$href = $sess->url($link . "&p=$j");
				if ($j == $page) {
					echo "[<b>".$j."</b>]";
				} else {
					echo "[<a href=\"".$href."\">".$j."</a>]";
				}
			}
			echo "</td>";
			if (($pages - $page) != 0 && $browse) {
				$href = $sess->url($link . "&p=$next");
				echo "<td><a href=\"".$href."\">vor</a></td>";
			}
			echo "</tr></table></div>";

		}
	}
}
?>
Thomas

Michael Tschauder
Beiträge: 87
Registriert: Fr 20. Aug 2004, 17:36
Wohnort: Stelle
Kontaktdaten:

Artliste

Beitrag von Michael Tschauder » Fr 17. Feb 2006, 17:44

Hallo Leutz,
ich denke wir können den Thrad hier schließen. Ich habe die neue Liste von HerrnB (1.3 geiles Teil!) eingesetzt und diese arbeitet einwandfrei.
... warum eigentlich nicht?

Gesperrt