nachdem von diesem Forum nun schon so oft profitiert habe, will ich nun endlich auch mal ein Modul posten. Anbei nun also meine dynamische Popup-Steuerung:
Es handelt sich um ein Modul, das man z.B. im Template der Startseite verankern kann und das auf den jeweils als Startartikel definierten Artikel eines eigenen Haupt-Strukturpunktes verweist. Achja, sollte der Startartikel nicht online sein oder der Strukturpunkt keine Artikel enthalten, wird auch das Popup nicht geöfnnet. Man kann es zudem gesondert in der Modulsteuerung aus- oder anschalten. Das Fenster wird dann bei jedem Aufruf der Seite geöffnet. Diesem Strukturpunkt kann man wie gewohnt ein eigenes Layout->Template zuweisen, was dann im Popup verwendet wird... ich denke, den Rest kriegt ihr hin.
Ganz unten haben ich noch zusätzlich mein Popup-Template beigefügt, in dem ein Javascript dafür sorgt, dass im Popup enthaltene Links im Hauptfenster geöffnet werden.
Modul Input:
Code: Alles auswählen
?><?/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Popup-Steuerung
* Author(s) : Sebastian Gerhards, Medialis Marketing GmbH
* Copyright :
* Created : 08-07-2003
************************************************/
// selected category
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\"> ";
?>
<tr valign="top">
<td>Maße des Popups:</td>
<td><input maxlength="3" size="4" type="text" value="<? echo "CMS_VALUE[1]" ?>" name="<? echo "CMS_VAR[1]" ?>"> Höhe<br>
<input maxlength="3" size="4" type="text" value="<? echo "CMS_VALUE[2]" ?>" name="<? echo "CMS_VAR[2]" ?>"> Breite<br></td>
</tr>
<tr valign="top">
<td>Popup-Strukturpunkt:</td>
<td>
<select name="CMS_VAR[0]">
<?
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM $cfgTab_cat_tree AS A, ".
"$cfgTab_cat AS B, $cfgTab_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 desc";
// 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
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
?>
</select>
</td>
</tr>
<tr>
<td>Popup aktiv:</td>
<td><input type="checkbox" name="<? echo "CMS_VAR[3]" ?>" value="aktiv"
<?
if ("CMS_VALUE[3]" == "aktiv") echo " checked";
?>
></td>
</tr>
<?
echo "</table>";
Code: Alles auswählen
?><?/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Popup-Steuerung
* Author(s) : Sebastian Gerhards, Medialis Marketing GmbH
* Copyright :
* Created : 08-07-2003
************************************************/
//Checken, ob Ein Artikel vorliegt
// selected category
$selcat = "CMS_VALUE[0]";
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idside, ARTLANG.idsidelang FROM ".$cfgTab_cat_side." AS CATART, ".$cfgTab_side_lang." AS ARTLANG ".
"WHERE CATART.idcat = '".$selcat."' AND ARTLANG.idside = CATART.idside AND ARTLANG.idlang = '".$lang."' AND ".
"ARTLANG.online = '1' LIMIT 1";
// execute query
$db->query($query);
unset($articleID);
unset($linkID);
// any news?
$newscounter = ($db->num_rows($db));
if ($newscounter > 0) {
if ("CMS_VALUE[3]" == "aktiv") {//nur ausfuehren wenn Box ueberhaupt eingeblendet werden soll
if (("CMS_VALUE[1]" != "") && ("CMS_VALUE[2]" != "")) {
$window_height = "CMS_VALUE[1]";
$window_width = "CMS_VALUE[2]";
} else {
$window_height = "400";
$window_width = "300";
}
$link_url = "front_content.php?client=$client&lang=".$_GET['lang']."&idcat=".$selcat."&idside=".$_GET['idside']."";
?>
<script language="JavaScript1.2">
new_window('<? echo $link_url ?>','aktuelles','resizable=yes', <? echo $window_width ?>, <? echo $window_height?>, 'true');
</script>
<?
}
}
Code: Alles auswählen
?>
<html>
<head>
<title>Seitentitel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/styles.css" type="text/css">
<script src="js/standard.js" type="text/javascript"></script>
</head>
<?php
if (eregi("front_content.php",$PHP_SELF)) { ?>
<script language="JavaScript1.2">
function setATargets() {
mengeA = document.links.length;
for (i=0;i<mengeA;i++) {
hrefalt = document.links[i].href;
document.links[i].href = "javascript:top.opener.location.href='"+hrefalt+"'; top.opener.focus();";
}
}
</script>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" scroll="auto" onLoad="setATargets()">
<?php } else {?>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" scroll="auto">
<?php }?>
<? CMS_CONTAINER[1] //Contentbereich der Seite?><br><br>
<? CMS_CONTAINER[2] ?>
</body>
</html>
Viel Spaß damit
derseb