3 Artikel nebeneinander dann bruch
Verfasst: Fr 20. Aug 2004, 10:17
Hallo miteinander,
ich hoffe Ihr könnt und wollt mir helfen es geht um eine Team zusammenstellung: sprich ich habe eine artkelliste genommen nun werden ja die artikel immer untereinander dargestellt ich hätte es aber gerne das 3 artikel nebeneinander dargestellt werden und wenn ein 4 artikel vorhanden ist dieser in der nächsten zeile erscheint . Also pro zeile 3 artikel dann einen umbruch . Die artikel sind nicht besonders groß es geht nur um ein bild und um den Namen . hier nun das modul das ich bisher verwende:
input
Output
wie kann man das realisieren ??
ich hoffe ihr könnt mir helfen
vielen Dank im vorraus
blackmeetswhite
ich hoffe Ihr könnt und wollt mir helfen es geht um eine Team zusammenstellung: sprich ich habe eine artkelliste genommen nun werden ja die artikel immer untereinander dargestellt ich hätte es aber gerne das 3 artikel nebeneinander dargestellt werden und wenn ein 4 artikel vorhanden ist dieser in der nächsten zeile erscheint . Also pro zeile 3 artikel dann einen umbruch . Die artikel sind nicht besonders groß es geht nur um ein bild und um den Namen . hier nun das modul das ich bisher verwende:
input
Code: Alles auswählen
/**
* Artikelliste mit I1,H1,T1
*
* Erstellt eine Liste mit allen Artikel bis
* auf den Startartikel.
*
* INPUT
*
* Author Jan Lengowski
* Copyright four for business AG
*/
// selected category
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
<tr valign=\"top\">
<td>Kategorie wählen:</td>
<td>
<select name=\"CMS_VAR[0]\">";
if($selected!="0" && $selected!=""){
echo"<option value=\"0\">--- kein ---</option>";
}else{
echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
}
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
// indent spacer
$spaces = "|";
// how many levels
$levels = $db->f("level");
for ($i = 0; $i < $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "--";
} // end for
$spaces .= ">";
if ($selected == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo " </select>";
echo " </td>
</tr>
<tr>
<td>Überschrift</td>
<td><input type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\"></td>
</tr>
<tr>
<td>Angezeigte Länge in Zeichen</td>
<td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\"></td>
</tr>
</table>";
Code: Alles auswählen
<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste
*
* Liste von Artikeln mit mehreren Daten basierend
* auf 4fb referenz modul
*
* Author : Evert Smit
* Copyright : 4fB
* Created : 13-07-2003
* Modified : 16-08-2002
************************************************/
// 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.idart, ARTLANG.idartlang 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 CATART.idart DESC";
// 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");
} // end while
// loop through subarticles
echo '
<table width="410" border="0" cellspacing="0" cellpadding="0" align="left"><TR><TD align="left">
';
if (is_array($articleID)) {
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
$sql = "SELECT ".$cfg["tab"]["content"].".*,".$cfg["tab"]["art_lang"].".summary
FROM ".$cfg["tab"]["content"]."
left join ".$cfg["tab"]["art_lang"]."
on ".$cfg["tab"]["content"].".idartlang=".$cfg["tab"]["art_lang"].".idartlang
WHERE ".$cfg["tab"]["content"].".idartlang = '$value'
AND ".$cfg["tab"]["content"].".idtype = '1'
AND ".$cfg["tab"]["content"].".typeid = '1'";
$db->query($sql);
$db->next_record();
// select and resolve image path
$imagesql="select value from ".$cfg["tab"]["content"]." where idartlang='$value' and idtype='4' and typeid='1'";
$db2->query($imagesql);
$db2->next_record();
$image_id= $db2->f("value");
// get image name and path
$imagesql="select * from ".$cfg["tab"]["upl"]." where idupl='$image_id'";
$db2->query($imagesql);
$db2->next_record();
$webdir='upload/';
$thumbdir='thumbnails/';
$filedir='/home/www/web511/html/cms/';
$imagelocation=$filedir.$webdir.$db2->f('dirname').$db2->f('filename');
$thumblocation=$filedir.$webdir.$thumbdir.$db2->f('filename');
if (!file_exists($thumblocation)){
// create thunbnail
$fileinformation=getimagesize($imagelocation);
$imagewidth = $fileinformation[0];
$imageheight = $fileinformation[1];
$imagetype=$db2->f('filetype');
$imageattributes = $fileinformation[3];
//$newfile= $last_id."-image.".$imagetype;
$target=$thumblocation;
if ( !(copy($imagelocation,$target)))
{
echo "Could not copy file to destintaion., Command returned Error Message. Please check your log files. ".$imagelocation." ".$target;
die;
}
//create thumbnails 80xrelational height
// Determine what filetype and set pointer to source image
switch ($imagetype)
{
case "gif":
$original_image=imagecreatefromgif($target);
break;
case "png":
$original_image=imagecreatefrompng($target);
break;
case "jpg":
$original_image=imagecreatefromjpeg($target);
break;
}
if (!$original_image){
echo 'Error getting image from '.$target.'.';
}
//echo $target;
// set image width and height of thunbnail and put pointer for filesytsem
$thumbfile= $db2->f('filename');
$target_thumb=$thumblocation;
$t_width=80;
// calculating height to maintain ratio
$t_height=(80/$imagewidth)*$imageheight;
// remove digits to get solid number
list ($t_height,$notimportand)=explode('.',$t_height);
// create blank image
$thumb_image=imagecreate($t_width,$t_height);
// resize image based on height and width
imagecopyresized($thumb_image,$original_image,0,0,0,0,$t_width,$t_height,$imagewidth,$imageheight);
// store image on file system
// requires different functionf for either gif or jpeg
switch ($imagetype)
{
case "gif":
imagegif($thumb_image,$target_thumb);
break;
case "png":
imagepng($thumb_image,$target_thumb);
break;
default:
imagejpeg($thumb_image,$target_thumb,80);
break;
}
imagedestroy($thumb_image);
imagedestroy($original_image);
}
$image=$webdir.$thumbdir.$db2->f('filename');
$head = urldecode($db->f("value"));
$summary= urldecode($db->f("summary"));
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 align="left" ><br/><br/><A HREF="'.$link.'">'.$db->f("value").'</a></td></tr>';
echo '<A HREF="'.$link.'">'.$head.'</a><br/><br/><img src="'.$image.'"><br/><br/>';
} // end while
echo '</TD></TR>';
unset($head);
unset($summary);
} // end foreach
} // end if (is_array)
echo '</table>';
?>
ich hoffe ihr könnt mir helfen
vielen Dank im vorraus
blackmeetswhite