46
Discussion & Troubleshooting / Re: Suchergebnissausgabe
« on: February 02, 2011, 10:35:52 PM »
hi
jetzt wird was auf dem server abgefragt, und als zeile mit leerausgabe angezeigt
http://www.grosspeterwitz.org/friedhof/4images/statistic.php
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: statistic.php *
* Copyright: (C) 2002-2009 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.9 *
* File Version: 1.0.0 (by Rembrandt www.vienna-pictures.com) *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$main_template = 'statistic'; // <-- Your Template Title
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('MAIN_SCRIPT', __FILE__);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
include(ROOT_PATH.'includes/page_header.php');
$txt_clickstream = $lang['statistic_page_title']; // <-- Clickstream Name
//################## EXAMPLE CUSTOM PHP CODE STARTS HERE ############################
$imgtable_width = ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$datum_heute = date("d.m.Y");
$sql = "SELECT i.image_gestorbenGP, i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1
$sql_where_query
AND c.cat_id = i.cat_id $cat_id_sql
ORDER BY STR_TO_DATE(image_gestorbenGP, '%d.%m.%Y') DESC
";
$result = $site_db->query($sql);
$liste = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
$count = 0;
$bgcounter = 0;
$config['image_cells'] = 1;
while ($image_row = $site_db->fetch_array($result)) {
$ausgabe="";
//array "$datum_gestorben" erstellen
$datum_gestorben = explode(".",$image_row['image_gestorbenGP']);
//$datum_gestorben[0] =tag; $datum_gestorben[1] =monat; $datum_gestorben[2] =Jahr
//jetzt wird der tag und das monat zusammen gesetzt
$gestorben = $datum_gestorben[0].$datum_gestorben[1];
//bspl. 04.03.1945 aus der DB ergibt: "0403"
//jetzt brauchen wir noch das aktuelle datum (mittels date()), mit dem wir genauso verfahren.
$datum_heute = explode(".", date("d.m.Y"));
// tag und das monat wieder zusammen setzen
$heute = $datum_heute[0].$datum_heute[1]; // ergibt zurzeit :) 0102
//mit der jahreszahl verfahren wir genauso:
$jahr = ($datum_heute[2]) - ($datum_gestorben[2]);
//jetzt vergleichen wir die zahl "$gestorben" und die zahl "$heute"
//sind die beiden zahlen gleich dann geben wir eine meldung aus.
if($gestorben == $heute ){
$ausgabe = "heute vor ".$jahr." jahren am ".$image_row['image_gestorbenGP']." ist ".$image_row['image_name']." gestorben";
}
//print_r($ausgabe);
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$liste .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$liste .= "<td width=\"".$imgtable_width."\" valign=\"top\"><a href=\"./details.php?image_id=$image_row[image_id]\">".$ausgabe."</a></td>\n";
// $liste .= "<td width=\"".$imgtable_width."\" valign=\"top\"></td>\n";
$count++;
if ($count == $config['image_cells']) {
$liste .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($i = 0; $i < $leftover; $i++) {
$liste .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$liste .= "</tr>\n";
}
}
$liste .= "</table>\n";
$content = $liste;
unset($liste);
// end if
//Here starts the lang register
$site_template->register_vars(array(
"content" => $content, // <-- It is important that the same name used as in PHP Code above (in this example "my_php")
"lang_statistic_page_title" => $lang['statistic_page_title'] // <-- Page Title
// <-- the "example_text" must still be registered in the "lang/your language/main.php"
));
//################## EXAMPLE CUSTOM PHP CODE END HERE ################################
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"content" => $content,
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
jetzt wird was auf dem server abgefragt, und als zeile mit leerausgabe angezeigt
http://www.grosspeterwitz.org/friedhof/4images/statistic.php
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: statistic.php *
* Copyright: (C) 2002-2009 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.9 *
* File Version: 1.0.0 (by Rembrandt www.vienna-pictures.com) *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$main_template = 'statistic'; // <-- Your Template Title
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('MAIN_SCRIPT', __FILE__);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
include(ROOT_PATH.'includes/page_header.php');
$txt_clickstream = $lang['statistic_page_title']; // <-- Clickstream Name
//################## EXAMPLE CUSTOM PHP CODE STARTS HERE ############################
$imgtable_width = ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$datum_heute = date("d.m.Y");
$sql = "SELECT i.image_gestorbenGP, i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1
$sql_where_query
AND c.cat_id = i.cat_id $cat_id_sql
ORDER BY STR_TO_DATE(image_gestorbenGP, '%d.%m.%Y') DESC
";
$result = $site_db->query($sql);
$liste = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
$count = 0;
$bgcounter = 0;
$config['image_cells'] = 1;
while ($image_row = $site_db->fetch_array($result)) {
$ausgabe="";
//array "$datum_gestorben" erstellen
$datum_gestorben = explode(".",$image_row['image_gestorbenGP']);
//$datum_gestorben[0] =tag; $datum_gestorben[1] =monat; $datum_gestorben[2] =Jahr
//jetzt wird der tag und das monat zusammen gesetzt
$gestorben = $datum_gestorben[0].$datum_gestorben[1];
//bspl. 04.03.1945 aus der DB ergibt: "0403"
//jetzt brauchen wir noch das aktuelle datum (mittels date()), mit dem wir genauso verfahren.
$datum_heute = explode(".", date("d.m.Y"));
// tag und das monat wieder zusammen setzen
$heute = $datum_heute[0].$datum_heute[1]; // ergibt zurzeit :) 0102
//mit der jahreszahl verfahren wir genauso:
$jahr = ($datum_heute[2]) - ($datum_gestorben[2]);
//jetzt vergleichen wir die zahl "$gestorben" und die zahl "$heute"
//sind die beiden zahlen gleich dann geben wir eine meldung aus.
if($gestorben == $heute ){
$ausgabe = "heute vor ".$jahr." jahren am ".$image_row['image_gestorbenGP']." ist ".$image_row['image_name']." gestorben";
}
//print_r($ausgabe);
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$liste .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$liste .= "<td width=\"".$imgtable_width."\" valign=\"top\"><a href=\"./details.php?image_id=$image_row[image_id]\">".$ausgabe."</a></td>\n";
// $liste .= "<td width=\"".$imgtable_width."\" valign=\"top\"></td>\n";
$count++;
if ($count == $config['image_cells']) {
$liste .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($i = 0; $i < $leftover; $i++) {
$liste .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$liste .= "</tr>\n";
}
}
$liste .= "</table>\n";
$content = $liste;
unset($liste);
// end if
//Here starts the lang register
$site_template->register_vars(array(
"content" => $content, // <-- It is important that the same name used as in PHP Code above (in this example "my_php")
"lang_statistic_page_title" => $lang['statistic_page_title'] // <-- Page Title
// <-- the "example_text" must still be registered in the "lang/your language/main.php"
));
//################## EXAMPLE CUSTOM PHP CODE END HERE ################################
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"content" => $content,
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>