Seite 1 von 2

4images mit phpbb header und footer

Verfasst: 06.11.2004 12:15
von mythorth
Hallo zusammen,

ich versuche grade verzweifelt 4images in PHPBB einzubinden und zwar so, dass der header und footer des Forum angezeigt wird und "dazwischen" die 4images gallery damit die user nicht den eindruck haben sie verlassen das forum wenn sie die gallery anschauen, hier der code den ich mir mal "ausgedacht" habe:

Code: Alles auswählen

<?php
//-----------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = '../phpbb/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//-----------------------------------------------------

$templates_used = 'home,category_bit,whos_online,thumbnail_bit';
$main_template = 'home';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();

if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
  $template = (isset($HTTP_GET_VARS['template'])) ? stripslashes(trim($HTTP_GET_VARS['template'])) : stripslashes(trim($HTTP_POST_VARS['template']));
  if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
    $template = "";
  }
  else {
    $main_template = $template;
  }
}
else {
  $template = "";
}
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
include(ROOT_PATH.'includes/page_header.php');

if (!empty($template)) {
  $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
  $site_template->register_vars("clickstream", $clickstream);
  $site_template->print_template($site_template->parse_template($main_template));
  include(ROOT_PATH.'includes/page_footer.php');
}

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories = get_categories(0);
if (!$categories)  {
  $categories = $lang['no_categories'];
}
$site_template->register_vars("categories", $categories);
unset($categories);

//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$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;
  }
}

$num_new_images = $config['image_cells'];
$sql = "SELECT 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 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").") 
        ORDER BY i.image_date DESC 
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images .= $lang['no_new_images'];
  $new_images .= "</td></tr></table>";
}
else  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";
} // end else

$site_template->register_vars("new_images", $new_images);
unset($new_images);

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
wie ihr seht habe ich in 4images einfach den ganz oberen teil eingefügt und zwar folgenden:

Code: Alles auswählen

//-----------------------------------------------------
define('IN_PHPBB', true);
$phpbb_root_path = '../phpbb/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//-----------------------------------------------------
und dann noch header:

Code: Alles auswählen

include($phpbb_root_path . 'includes/page_header.'.$phpEx);
und footer:

Code: Alles auswählen

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
er bekommt allerdings irgendein problem mit den templates denn ich bekomme folgende fehlermeldung:

Fatal error: Cannot redeclare class template in XXX.../4images/includes/template.php on line 28

Wo liegt also das Problem bzw wie binde ich 4images anständig ein, vielleicht sogar noch das die statusanzeige auch funktioniert also "user befindet ich in gallery" in "wer ist online ?"

Danke schonmal für die Hilfe.

Verfasst: 07.11.2004 09:09
von mythorth
ich hab mit der ganzen nummer echt nen riesen prob hier und hänge vollkommen fest, hab jetzt seit gestern immer neue ideen versucht, hat aber alles nicht funktioniert also wäre wirklich super wenn jemand nen kleinen tipp geben könnte wo der fehler liegt.....DANKE !

Verfasst: 07.11.2004 09:18
von beloe
hi,

dein problem ist ganz einfach:
in der datei "includes/template.php" wird von phpbb die klasse "template" erstellt, aber auch in "4images/includes/template.php".

[EDIT]änder einfach in der 2. datei den namen der klasse in template2 ab und änder in allen 4images dateien bei der deklaration der variable template zu template2.

für dein anderes problem, mit dem einbinden in "wer ist online" habe ich keine lösung, es ist aber definitiv möglich!

beloe

Verfasst: 07.11.2004 09:32
von mythorth
hi, danke schonmal für die antwort, hab das geändert in der template.php von 4images aber jetzt kommt folgende meldung:
DB Error: Bad SQL Query: SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images FROM phpbb_categories c LEFT JOIN 4images_images i ON (i.cat_id = c.cat_id AND i.image_date >= 1098952702 AND i.image_active = 1) GROUP BY c.cat_id ORDER BY c.cat_order, c.cat_name ASC
Unknown column 'c.cat_name' in 'field list'

Fatal error: Call to a member function on a non-object in /XXX.../phpbb/includes/page_header.php on line 67
mit der ursprünglichen 4images datei ohne header und footer von phpbb geht noch alles wie es soll.

Verfasst: 07.11.2004 09:40
von beloe
könntest du mal einen link zur datei, wo es angezeigt wird, posten

beloe

Verfasst: 07.11.2004 09:44
von mythorth
also hier die datei wie sie im original ist und funktioniert:

index.txt

und hier die neue die den oben beschriebenen fehler hervorruft:

index_forum.txt

Verfasst: 07.11.2004 09:50
von beloe
wieso heist es in der einen datei

Code: Alles auswählen

define('ROOT_PATH', './');
und in der anderen

Code: Alles auswählen

define('ROOT_PATH', '../4images/');
?

beloe

Verfasst: 07.11.2004 09:53
von mythorth
mh, ist wohl von einem meiner zahllosen versuchen übrig geblieben ich änder das auf "./" denn so war es im original.

Fehlermeldung jetzt:
DB Error: Bad SQL Query: SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images FROM phpbb_categories c LEFT JOIN 4images_images i ON (i.cat_id = c.cat_id AND i.image_date >= 1098954075 AND i.image_active = 1) GROUP BY c.cat_id ORDER BY c.cat_order, c.cat_name ASC
Unknown column 'c.cat_name' in 'field list'

Warning: Cannot modify header information - headers already sent by (output started at X../4images/includes/db_mysql.php:188) in X../4images/includes/sessions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at X../4images/includes/db_mysql.php:188) in X../4images/includes/sessions.php on line 169

Fatal error: Call to a member function on a non-object in X../phpbb/includes/page_header.php on line 67
hab die txt's auch auf den neusten stand gebracht

Verfasst: 07.11.2004 10:04
von beloe
DB Error: Bad SQL Query: SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images FROM phpbb_categories c LEFT JOIN 4images_images i ON (i.cat_id = c.cat_id AND i.image_date >= 1098954144 AND i.image_active = 1) GROUP BY c.cat_id ORDER BY c.cat_order, c.cat_name ASC
Unknown column 'c.cat_name' in 'field list'
existiert "cat_name" in der datenbank "phpbb_categories" -> nein
->in welcher datenbank existierst und dann prefix ändern.
Warning: Cannot modify header information - headers already sent by (output started at XXX/db_mysql.php:188) in XXX/sessions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at XXX/db_mysql.php:188) in XXX/sessions.php on line 169
-> was steht in den zeilen?
Fatal error: Call to a member function on a non-object in XXX/page_header.php on line 67
-> was steht in der zeile 67?

beloe

Verfasst: 07.11.2004 10:12
von mythorth
sessions.php zeile 168, 169:
setcookie($cookiename . '_data', serialize($sessiondata), $this->current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $this->session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
page_header.php zeile 67:
$template->assign_block_vars('switch_introportalmod_disable', array());
in welcher datei muss ich den prefix ändern ?

zwischendurch nochmal danke für deine mühe !