Code: Alles auswählen
<?php
class printerFriendlyInput {
function printerFriendlyInput() {
// Datenbankklasse initialisieren
$this->db = new DB_Contenido;
}
function getLayouts() {
global $cfg;
$this->db->query("" .
"SELECT idlay, name FROM {$cfg['tab']['lay']} " .
"ORDER BY" .
" name ASC");
while ($this->db->next_record()) {
$returnvalue[$this->db->f('idlay')] = $this->db->f('name');
}
return $returnvalue;
}
function makeSelect($preselection) {
$layout = $this->getLayouts();
echo "<option value=\"\">--- kein PrinterFriendly ---</option>";
foreach ($layout as $key => $value) {
if ($preselection == $key) {
echo "<option value=\"$key\" selected=\"selected\">$value</option>";
} else {
echo "<option value=\"$key\">$value</option>";
}
}
}
}
$printerFriendlyInput = new printerFriendlyInput();
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">";
echo "<tr><td>PrinterFriendlyLayout:</td>";
echo "<td><select size=\"1\" name=\"CMS_VAR[0]\" />";
$printerFriendlyInput->makeSelect("CMS_VALUE[0]");
echo "</td>";
echo "</table>";
?>
out
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : w3concepts.printerFriendly.v3
* Author : Andreas Kummer
* Copyright : mumprecht & kummer
* w3concepts
* Created : 2004- 12-01
* Modified : 2004-12-01
* ***********************************************/
class printerFriendly {
function printerFriendly() {
// Initialisierung
if (!$this->getInitValues()) return false;
// Link für Druckausgabe ausgeben
echo $this->getPrinterFriendlyLink();
// Abbrechen, falls keine printerFriendly-
// ausgabe gewünscht ist
if (empty($_GET['printerfriendly'])) return false;
// Datenbankklasse initialisieren
$this->db = new DB_Contenido;
// PrintLayout mit Inhalt füllen
// und an Browser ausgeben
echo $this->fillPrintLayout();
// Ablauf des Scriptes abbrechen
exit;
}
function getInitValues() {
// hier den primärschlüssel des printLayouts einfügen
$primaryKey = 36;
$this->printLayoutID = $primaryKey;
if ($this->printLayoutID == '') return false;
return true;
}
function getContents() {
$buffer = ob_get_contents();
ob_end_clean();
$counter = 1;
while (substr_count($buffer,"<!-- content$counter -->")) {
$part = explode("<!-- content$counter -->",$buffer);
$content[$counter] = $part[1];
$counter++;
}
return $content;
}
function getPrintLayout() {
global $cfg, $idart, $lang;
$this->db->query("SELECT code FROM {$cfg['tab']['lay']} WHERE idlay = {$this->printLayoutID}");
if (!$this->db->next_record()) return false;
$code = $this->db->f('code');
$this->db->query("SELECT pagetitle FROM {$cfg['tab']['art_lang']} WHERE idart = $idart AND idlang = $lang");
$title = '';
if ($this->db->next_record()) $title = $this->db->f('pagetitle');
$part = explode('<title>',$code);
$part2 = explode('</title>',$code);
return $part[0].'<title>'.$title.'</title>'.$part2[1];
}
function fillPrintLayout() {
$contents = $this->getContents();
foreach ($contents as $key => $content) {
$search[$key] = "###content$key###";
}
return str_replace($search,$contents,$this->getPrintLayout());
}
function getPrinterFriendlyLink() {
global $idcat, $idart, $lang, $client, $sess, $wc_print;
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$idcat&idart=$idart&printerfriendly=true");
return "<a href=\"$link\" target=\"_new\">$wc_print</a>";
}
}
$printerFriendly = new printerFriendly();
?>

Finde ihn aber nicht so ganz.
Im Error log steht :
Code: Alles auswählen
[25-Apr-2005 16:00:32] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
[25-Apr-2005 16:00:37] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
[25-Apr-2005 16:00:38] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
[25-Apr-2005 16:05:14] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
[25-Apr-2005 16:05:20] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
[25-Apr-2005 16:05:23] PHP Parse error: parse error, unexpected '<' in /home/www/web15/html/cms/contenido/includes/functions.mod.php(155) : eval()'d code on line 1
Hat einer ne Idee?