Hallo,
ich möchte gerne den Contenttyp Artikelmenu umschreiben und die Artikelbilder anzeigen lassen.
Ich hab die MySQL-Query schon umgeschrieben um die entsprechenden Daten aus der DB zu holen und mir dann einfach mal um zu schauen was passiert, die Daten als String anzeigen lassen. Also die Daten bekomme ich, nur weiß ich jetzt nicht, wie ich die benutzen muss um das Bild dann auch zu bekommen. Könnte mir da jemand auf die Sprünge helfen? Ich würde mich freuen, wenn auch direkt ein Codebeispiel gezeigt würde. Bzw. eine Stelle im Sourcecode in der das gemacht wird, denn schließlich werden diese Bilder ja wohl auch normalerweise irgendwie angezeigt, ich konnte nur nichts finden.
Danke schonmal
Christian
--english
Hello,
I would like to rewrite the contenttype "article menu" to show me the article pictures. I already changed the MySQl-Query to get the image data from the db. After that I just let PHPwCMS write that out as string data, so I could see the information. But that did not help me much, so I ask for help to actually show the picture. Code examples would be much appreciated as would be references to the source code, because there should be a function to show this pictures already. I just did not find it.
Thanks
Christian
article_image Daten benutzen für Artikelbilder als Menu
Falls jemand interessiert ist, ich habs folgendermaßen gelöst:
If anyone is interested, I did it this way:
\include\inc_front\content\cnt15.article.inc.php
If anyone is interested, I did it this way:
\include\inc_front\content\cnt15.article.inc.php
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
//article menu
$CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
$alinkmenu = unserialize($crow["acontent_form"]);
$alinkmenu["catid"] = ($alinkmenu["cat"]) ? $alinkmenu["catid"] : $content["cat_id"];
$alinkmenu['link'] = '';
$blinkmenu = '';
$alink_sql = "SELECT article_id, article_title, article_cid, article_image FROM ".
DB_PREPEND."phpwcms_article WHERE article_public=1 AND ".
"article_aktiv=1 AND article_deleted=0 AND article_cid=".
intval($alinkmenu["catid"])." AND article_begin<NOW() ".
"AND article_end>NOW() ORDER BY article_sort, article_tstamp DESC;";
if($result = mysql_query($alink_sql, $db) or die("error while getting link article list: ".$alink_sql)) {
while($row = mysql_fetch_row($result)) {
$alinkmenu['link'] .= "<tr valign=\"top\">\n";
$alinkmenu['link'] .= "<td align=\"left\"><a href=\"index.php?id=".$row[2].",".$row[0].",0,0,1,0\" target=\"_self\"";
$alinkmenu['link'] .= get_class_attrib($template_default["article"]["link_article_class"]).">";;
$alinkmenu['link'] .= html_specialchars($row[1])."</a></td></tr><tr><td><p> </p></td></tr>\n"; //\n
$image = unserialize($row[3]);
if ($image['hash']) {
$imagename = $image['hash'] . '.' . $image['ext'];
$blinkmenu .= '<tr valign="top"><td align="left"><a href="index.php?id='.$row[2].','.$row[0].',0,0,1,0" target="_self"><img src="./phpwcms_filestorage/' . $imagename .'" border="0"></a></td></tr><tr><td><p> </p></td></tr>';
}
}
$alinkmenu['link'] .= '<tr><td><p> </p><p> </p></td></tr>';
mysql_free_result($result);
}
if($alinkmenu['link']) {
$CNT_TMP .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"85\" style=\"margin-right: 15px; table-layout: fixed;\">\n";
$CNT_TMP .= $alinkmenu['link'];
$CNT_TMP .= $blinkmenu;
$CNT_TMP .= "</table>\n";
}
?>
-
- Posts: 11
- Joined: Fri 7. Apr 2006, 11:54
- Location: Deutschland, Leipzig
- Contact:
Code: Select all
$row[4] = unserialize($row[4]);
$caption = explode('|', $row[4]["caption"]);
$row[4]["caption"] = $caption[0]; //$caption[0]
//build image/image link
$thumb_img = '';
if(!empty($row["4"]["hash"])) {
$thumb_image = get_cached_image(
array( "target_ext" => $row["4"]['ext'],
"image_name" => $row["4"]['hash'] . '.' . $row["article_image"]['ext'],
"max_width" => $row["4"]['width'],
"max_height" => $row["4"]['height'],
"thumb_name" => md5($row["4"]['hash'].$row["4"]['width'].$row["4"]['height'].$GLOBALS['phpwcms']["sharpen_level"])
));
}
$thumb_img = '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="'.$caption[1].'" title="'.$caption[1].'">';
Code: Select all
src="./phpwcms_filestorage/' . $imagename .'"
Und noch ein Problem, was ich noch nicht gelöst habe: Die Breite des Bildes ist im benutzten Layout vorgegeben. Das hat zur Folge, dass die Pics acuh diese Breite dann haben. Wie mans ändert, weiss ich wie gesagt noch nicht.
-
- Posts: 11
- Joined: Fri 7. Apr 2006, 11:54
- Location: Deutschland, Leipzig
- Contact:
Code: Select all
$row[4] = unserialize($row[4]);
$caption = explode('|', $row[4]["caption"]);
$row[4]["caption"] = $caption[0]; //$caption[0]
//build image/image link
$thumb_img = '';
if(!empty($row["4"]["hash"])) {
$thumb_image = get_cached_image(
array( "target_ext" => $row["4"]['ext'],
"image_name" => $row["4"]['hash'] . '.' . $row["article_image"]['ext'],
"max_width" => $row["4"]['width'],
"max_height" => $row["4"]['height'],
"thumb_name" => md5($row["4"]['hash'].$row["4"]['width'].$row["4"]['height'].$GLOBALS['phpwcms']["sharpen_level"])
));
}
$thumb_img = '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="'.$caption[1].'" title="'.$caption[1].'">';
Code: Select all
src="./phpwcms_filestorage/' . $imagename .'"
Und noch ein Problem, was ich noch nicht gelöst habe: Die Breite des Bildes ist im benutzten Layout vorgegeben. Das hat zur Folge, dass die Pics acuh diese Breite dann haben. Wie mans ändert, weiss ich wie gesagt noch nicht.
-
- Posts: 11
- Joined: Fri 7. Apr 2006, 11:54
- Location: Deutschland, Leipzig
- Contact:
-
- Posts: 11
- Joined: Fri 7. Apr 2006, 11:54
- Location: Deutschland, Leipzig
- Contact:
jetzt hab ichs:
beispiel auf http://www.silvercore.de/
Code: Select all
$row[4] = unserialize($row[4]);
$caption = explode('|', $row[4]["caption"]);
$row[4]["caption"] = $caption[0]; //$caption[0]
//build image/image link
$thumb_img = '';
if(!empty($row["4"]["hash"])) {
$thumb_image = get_cached_image(
array( "target_ext" => $row["4"]['ext'],
"image_name" => $row["4"]['hash'] . '.' . $row["4"]['ext'],
"max_width" => $row["4"]['width'],
"max_height" => $row["4"]['height'],
"thumb_name" => md5($row["4"]['hash'].$row["4"]['width'].$row["4"]['height'].$GLOBALS['phpwcms']["sharpen_level"])
));
$thumb_img = '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="'.$caption[1].'" title="'.$caption[1].'">';
}
else $thumb_img = '<br>';