Wir benötigen ein Modul, eine GIF Grafik, eine php-Datei, sowie eine js-Datei.
1.Fangen wir bei dem Modul an:
Modul Output:
Code: Alles auswählen
<?
$cfgTab_cat_lang = $cfg['tab']['cat_lang'];
$cfgTab_content = $cfg["tab"]["content"];
$cfgTab_art_lang = $cfg["tab"]["art_lang"];
$cfgTab_cat_art = $cfg["tab"]["cat_art"];
if(strstr($HTTP_USER_AGENT,"MSIE")!=false||substr($HTTP_USER_AGENT,strpos($HTTP_USER_AGENT,"Mozilla/")+8,1)>=5 ){
echo "<script type=\"text/javascript\">
function addToQuickFinder() {
document.forms[\"quickfinder\"].submit();
}
function go(url) {
window.location.href = url;
}
function deleteToQuickFinder(de){
document.forms[\"quickfinder\"].del.value=de;
document.forms[\"quickfinder\"].submit();
}
</script>";
$query = "SELECT * FROM $cfgTab_content AS CONT, $cfgTab_art_lang AS LANG WHERE LANG.idart = '$idart' AND LANG.idlang = '1' AND CONT.idartlang = LANG.idartlang AND CONT.idtype = '1' AND CONT.typeid = '1' ORDER BY CONT.idtype";
$db->query($query);
$db->next_record();
$value = $db->f("value");
if($value!=""){
$title = $db->f("title");
}
else{
$title=$value;
}
echo "<form name=\"quickfinder\" method=\"post\" action=\"quickfinder_save.php\">";
echo "<input type=\"hidden\" name=\"lang\" value=\"$lang\">";
echo "<input type=\"hidden\" name=\"client\" value=\"$client\">";
echo "<input type=\"hidden\" name=\"idcat\" value=\"$idcat\">";
echo "<input type=\"hidden\" name=\"idart\" value=\"$idart\">";
echo "<input type=\"hidden\" name=\"m\" value=\"$m\">";
echo "<input type=\"hidden\" name=\"s\" value=\"$s\">";
echo "<input type=\"hidden\" name=\"t\" value=\"$t\">";
echo "<input type=\"hidden\" name=\"title\" value=\"$title\">";
echo "<input type=\"hidden\" name=\"del\" value=\"del\">";
echo "</form>";
$sess->hidden_session();
echo "
<table width=\"150px\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
<tr height=\"1\">
<td colspan=\"3\" bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>
<tr height=\"15\" id=\"qControl\">
<td width=\"130\" align=\"right\" class=\"text\" style=\"padding-right:5px\">Quickfinder </td>
<td width=\"1\" bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
<td width=\"19\" bgcolor=\"#3A527A\" align=\"center\"><img src=\"images/quickarrow.gif\"></td>
</tr>
<tr height=\"1\">
<td colspan=\"3\" bgcolor=\"#ffffff\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>
<tr>
<td><img src=\"images/spacer.gif\" width=\"1\" height=\"10\"></td>
</tr>
</table>
";
echo "
<div id=\"qBody\">
<table width=\"150\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
echo "
<tr style=\"background-color:#ffffff\">
<td colspan=\"2\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>";
$db2 = new DB_Contenido;
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.title FROM $cfgTab_cat_art AS CATART, $cfgTab_art_lang AS ARTLANG ".
"WHERE CATART.idcat = '12' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' AND CATART.is_start = '0' ORDER BY CATART.idart";
// execute query
$db->query($query);
// get id's of sub articles
while ($db->next_record()) {
// $articleid = $db->f("idartlang");
$linkid = $db->f("idart");
$head = $db->f("title");
$l = "lang=";
$link = $sess->url("front_content.php?client=$client&$l$lang&idcat=12&idart=$linkid&m=$m&s=$s");
$len = strlen($head);
// cut head if too long
if ($len > 20) {
$head = substr($head,0,20);
$head = $head. " ...";
} // end if
echo "
<tr style=\"background-color:#9FAFBC\" onMouseOver=\"g.over(this)\" onMouseOut=\"g.out(this)\">
<td class=\"text10bn\" style=\"padding:2px\" colspan=\"2\"> <a class=\"white\" href=\"javascript:go('".$link."')\">".$head."</a></td>
</tr>
<tr style=\"background-color:#ffffff\">
<td colspan=\"2\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>";
} // end while
if (is_array($quicklinks)) {
foreach ($quicklinks as $key => $value) {
$values = explode("|",$value);
if (strlen($values[0]) > 18) {
$values[0] = substr($values[0],0,18);
$values[0] = rtrim($values[0]);
$values[0] .= "...";
} // end if
echo "
<tr style=\"background-color:#9FAFBC\" onMouseOver=\"g.over(this)\" onMouseOut=\"g.out(this)\">
<td style=\"padding:2px\" class=\"text10bn\"><a class=\"white\" href=\"javascript:go('".$values[1]."')\">".$values[0]."</a></td>
<td align=\"right\"><a class=\"white\" href=\"javascript:deleteToQuickFinder('".$key."')\">[x] </a></td>
</tr>
<tr style=\"background-color:#ffffff\">
<td colspan=\"2\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>";
} // end foreach
} // end if
echo " <tr style=\"background-color:#9FAFBC\" onMouseOver=\"g.over(this)\" onMouseOut=\"g.out(this)\">
<td style=\"padding:2px\" class=\"text10bn\" colspan=\"2\"><a class=\"main\" href=\"javascript:addToQuickFinder()\"><b>Add to Quickfinder</b></a></td>
</tr>";
echo "</table></div>";
}
?>
Code: Alles auswählen
<?
/***********************************************
* QUICKFINDER SAVE
*
* Schreibt die Bookmarks in das Cookie
*
* Author : Jan Lengowski
* Copyright : four for business AG
* Created : 19-08-2002
* Modified : 19-08-2002
************************************************/
if($del=="del"){
// count quicklinks
$cnt="0";
for($key=0;$key<21;$key++){
if(!isset($quicklinks[$key])){
$cnt=$key;
break;
} // end if
} // end for
// set cookie
setcookie("quicklinks[$cnt]","$title|front_content.php?client=$client&lang=$lang&idcat=$idcat&idart=$idart&m=$m&s=$s&t=$t",time()*2);
}else{
setcookie("quicklinks[$del]","",time() - 3600);
}
// redirect
header("Location: front_content.php?client=$client&lang=$lang&idcat=$idcat&idart=$idart&m=$m&s=$s&t=$t&sid=$sid");
?>
4. Die Datei quickarrow.gif (19x19px) muss im Verzeichnis root\cms\images liegen
5. die Datei contenido.js muss im Verzeichnis root\cms\js liegen
Code: Alles auswählen
/**
* Contenido Product Site
* Javascript file
* Author Jan Lengowski
* Copyright four for business AG
*/
function MM_createDropDown(body,control,align,event) {
/**
* MM_createDropDown Class
*
* Class for creating drop-down menus. Tested on IE6 and NS6
* Usage: MM_createDropDown("body-ID","control-ID","align","event");
* align: "left","top","right","bottom"
* event: "over","click"
*
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG 2002
* @version 2.0
* {@link http://www.4fb.de}
*/
/**
* Create object references
* @access private
*/
oBody = document.getElementById(body);
oControl = document.getElementById(control);
/**
* Set the object properties
* @access private
*/
oBody.style.position = "absolute";
oBody.style.visibility = "hidden";
oBody.oAlign = align;
oControl.event = event;
oControl.oBody = oBody;
oControl.oBody.open = false;
oBody.event = event;
oBody.oBody = oBody;
/**
* Define class methods
* @access private
*/
oControl.open = MM_createDropDown_open;
oControl.close = MM_createDropDown_close;
oControl.getPos = MM_createDropDown_getPos;
/**
* Set event handlers depending on type (over/click)
* @access private
*/
if (event == "over") {
oControl.onmouseover = MM_createDropDown_open;
oControl.onmouseout = MM_createDropDown_close;
oBody.onmouseover = MM_createDropDown_open;
oBody.onmouseout = MM_createDropDown_close;
} else {
oControl.onclick = MM_createDropDown_open;
}
/**
* Get the position of the control element
* @access private
*/
oControl.getPos();
oBody.style.left = oBody.x;
oBody.style.top = oBody.y;
}
function MM_createDropDown_getPos() {
/**
* Method getPos()
*
* This method calculates the position
* of the control element
*
* @access private
*/
this.x = 0;
this.y = 0;
var el = this;
while (el.tagName != "BODY") {
this.x += el.offsetLeft;
this.y += el.offsetTop;
el = el.offsetParent;
}
switch (this.oBody.oAlign) {
case "top":
this.oBody.x = this.x;
this.oBody.y = this.y - this.oBody.offsetHeight;
break;
case "right":
this.oBody.x = this.x + this.offsetWidth;
this.oBody.y = this.y;
break;
case "bottom":
this.oBody.x = this.x;
this.oBody.y = this.y + this.offsetHeight;
break;
case "left":
this.oBody.x = this.x - this.offsetWidth;
this.oBody.y = this.y;
break;
}
}
function MM_createDropDown_open() {
/**
* Method for opening the menu
* @access private
*/
if (this.event == "over") {
this.oBody.style.visibility = "visible";
} else {
if (!this.oBody.open) {
this.oBody.style.visibility = "visible";
this.oBody.open = true;
} else {
this.oBody.style.visibility = "hidden";
this.oBody.open = false;
}
}
}
function MM_createDropDown_close() {
/**
* Method for closing the menu
* @access private
*/
this.oBody.style.visibility = "hidden";
}
function go(url)
{
window.location.href = url;
}
function addToQuickFinder()
{
headline = document.getElementsByTagName("h1");
document.forms["quickfinder"].elements["title"].value = headline[0].innerHTML;
document.forms["quickfinder"].submit();
}
function c_extra(oCell,oImg)
{
// Object references
this.oCell = document.getElementById(oCell);
this.oImg = document.getElementById(oImg);
// Cell cursor style
this.oCell.style.cursor = "hand";
// Default values for roll-overs
this.nImgSrc = "";
this.oImgSrc = "";
this.nColor = "";
this.oColor = "";
// Class methods
this.on = c_extra_on;
this.off = c_extra_off;
this.setColors = c_extra_setColors;
this.setImages = c_extra_setImages;
}
function c_extra_setColors(nColor,oColor)
{
this.nColor = nColor;
this.oColor = oColor;
}
function c_extra_setImages(nSrc,oSrc)
{
this.nImgSrc = nSrc;
this.oImgSrc = oSrc;
}
function c_extra_on()
{
this.oCell.style.backgroundColor = this.oColor;
this.oImg.src = this.oImgSrc;
}
function c_extra_off()
{
this.oCell.style.backgroundColor = this.nColor;
this.oImg.src = this.nImgSrc;
}
//***************************************
function MM_rollOver(nSrc,oSrc) {
this.nSrc = nSrc;
this.oSrc = oSrc;
this.over = MM_rollOver_over;
this.out = MM_rollOver_out;
}
function MM_rollOver_over(obj) {
obj.style.cursor = "hand";
obj.src = this.oSrc;
}
function MM_rollOver_out(obj) {
obj.src = this.nSrc;
}
//***************************************
function startImage(imgID) {
this.nImgSrc = "";
this.oImgSrc = "";
this.uImgOver = "";
this.uImgOut = "";
this.cImgID = document.getElementById(imgID);
this.over = startImage_over;
this.out = startImage_out;
this.defImg = startImage_def;
this.defBut = startImage_but;
}
function startImage_def(nSrc,oSrc) {
this.uImgOut = nSrc;
this.uImgOver = oSrc;
}
function startImage_but(nSrc,oSrc) {
this.nImgSrc = nSrc;
this.oImgSrc = oSrc;
}
function startImage_over(obj) {
obj.src = this.oImgSrc;
this.cImgID.src = this.uImgOver;
}
function startImage_out(obj) {
obj.src = this.nImgSrc;
this.cImgID.src = this.uImgOut;
}
/**************************************************\
© Magnet Media 2001
Table Row Mark v1.1
DO NOT USE WITHOUT PERMISSION!
myRow = new MM_rowMark(1,2,3,4)
1: Farbe des Over Effekts z.B. "#ff0000" - string
2: Farbe des Mark Effeks - string
3: Farbe des Over Effeks bei der Marked Row - string
4: Function die bei onClick aufgerufen wird - string
<tr class="grau" onMouseOver="myRow.over(this)" onMouseOut="myRow.out(this)" onClick="myRow.click(this)">
<td>eine Zeile</td>
<td><img src="einbild.gif"></td>
</tr>
\**************************************************/
function MM_rowMark(overColor,markedColor,overMarked,onClick)
{
/** Properties **/
this.overColor = overColor;
this.markedColor = markedColor;
this.overMarked = overMarked;
/** Variables **/
this.oldColor = "";
this.markedRow = "";
/** Methods **/
this.over = MM_rowMark_over;
this.out = MM_rowMark_out;
this.click = MM_rowMark_click;
/** Event Handler **/
this.onClick = onClick;
}
function MM_rowMark_over(oRow)
{
this.oldColor = oRow.style.backgroundColor;
if (oRow.style.backgroundColor == this.markedColor)
oRow.style.backgroundColor = this.overMarked;
else
oRow.style.backgroundColor = this.overColor;
}
function MM_rowMark_out(oRow)
{
if (oRow.style.backgroundColor == this.markedColor)
oRow.style.backgroundColor = this.markedColor;
else
oRow.style.backgroundColor = this.oldColor;
}
function MM_rowMark_click(oRow)
{
if (this.markedRow == "")
{
oRow.style.backgroundColor = this.markedColor;
this.markedRow = oRow;
if (this.onClick != "")
eval(this.onClick);
}
else
{
this.markedRow.style.backgroundColor = this.oldColor;
oRow.style.backgroundColor = this.markedColor;
this.markedRow = oRow;
if (this.onClick != "")
eval(this.onClick);
}
}
/**
* Instanzieren der Javascript Klassen */
onload = init;
function init() {
disk = new MM_rollOver("images/icons/diskette_out.gif","images/icons/diskette_over.gif");
bedienung = new startImage("g_img");
bedienung.defImg("images/start_gesamt.jpg","images/start_bedienung.jpg");
bedienung.defBut("images/icons/bedienung_out.gif","images/icons/bedienung_over.gif");
sicherheit = new startImage("g_img");
sicherheit.defImg("images/start_gesamt.jpg","images/start_sicherheit.jpg");
sicherheit.defBut("images/icons/sicherheit_out.gif","images/icons/sicherheit_over.gif");
skalierbarkeit = new startImage("g_img");
skalierbarkeit.defImg("images/start_gesamt.jpg","images/start_skalierbarkeit.jpg");
skalierbarkeit.defBut("images/icons/skalierbarkeit_out.gif","images/icons/skalierbarkeit_over.gif");
administration = new startImage("g_img");
administration.defImg("images/start_gesamt.jpg","images/start_administration.jpg");
administration.defBut("images/icons/administration_out.gif","images/icons/administration_over.gif");
kosten = new startImage("g_img");
kosten.defImg("images/start_gesamt.jpg","images/start_tco.jpg");
kosten.defBut("images/icons/kosten_out.gif","images/icons/kosten_over.gif");
if (document.getElementById("sBody"))
MM_createDropDown("sBody","sControl","left","click");
if (document.getElementById("qBody"))
MM_createDropDown("qBody","qControl","bottom","over");
g = new MM_rowMark ("#BCC7D0","","","");
}
Code: Alles auswählen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/format.css">
<script type="text/javascript" src="js/contenido.js">
</script>
</head>
7. Anpassen des Moduls:
Ausgabe der Cookies:
Im Modul werden die Seitentitel so wie in der Hauptnav. Ausgegeben. Möchte man
die Ausgabe der Headline so wie in der Artikelliste, bitte im Modul Output folgenden
Codeschnipsel ändern:
Code: Alles auswählen
--------------- original ------------
$db->query($query);
$db->next_record();
$value = $db->f("value");
if($value!=""){
$title = $db->f("title");
}
else{
$title=$value;
}
------------ geändert -------------------
$db->query($query);
$db->next_record();
$value = $db->f("value");
if($value==""){
$title = $db->f("title");
}
else{
$title=$value;
}
im Modul Output die Kategorie 12 verwendet. Siehe Codeschnipsel aus dem Modul
Code: Alles auswählen
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.title FROM $cfgTab_cat_art AS CATART, $cfgTab_art_lang AS ARTLANG ".
"WHERE CATART.idcat = '12' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' AND CATART.is_start = '0' ORDER BY CATART.idart";
// execute query
$db->query($query);
// get id's of sub articles
while ($db->next_record()) {
// $articleid = $db->f("idartlang");
$linkid = $db->f("idart");
$head = $db->f("title");
$l = "lang=";
$link = $sess->url("front_content.php?client=$client&$l$lang&idcat=12&idart=$linkid&m=$m&s=$s");
Viel Spass mit dem Modul