Author Topic: Put last images add to galerie In another php pag  (Read 11034 times)

0 Members and 1 Guest are viewing this topic.

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Put last images add to galerie In another php pag
« on: October 26, 2002, 10:10:12 PM »
Hello..
I need this urgently.. if you can help me i apreeciatte..

I need an code to put IN ANOTHER PHP PAGE the X photos add to the galerie..

Thanks everyone.

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Put last images add to galerie In another php pag
« Reply #1 on: October 27, 2002, 02:57:27 AM »
no one can help?

Offline BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Put last images add to galerie In another php pag
« Reply #2 on: October 27, 2002, 03:12:09 AM »
I would like to do this too.

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Put last images add to galerie In another php pag
« Reply #3 on: October 31, 2002, 02:47:22 AM »
................................
................................

Offline BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Put last images add to galerie In another php pag
« Reply #4 on: October 31, 2002, 11:29:42 AM »
is this what you want?

http://www.ukscrappers.co.uk/community/newimages-test.php

I have it running independently, and I HAVE had it running as past of a php-nuke block,  but I seem to have broken it...

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Put last images add to galerie In another php pag
« Reply #5 on: November 01, 2002, 02:10:14 AM »
Yes it is..
But without comment's.. only the foto and align like that

FOTO1 FOTO2 FOTO3 FOTO4

in cells but can you give me the source?
tks

Offline BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Put last images add to galerie In another php pag
« Reply #6 on: November 01, 2002, 08:01:15 PM »
OK - I'm happy to share the code as long as you understand that I am not a php coder, and don't really know what I am doing.  Basically I have just copied one of the existing modules (index.php) and removed all the bits I didn't want.

here's the module called newimage.php  - I have it in my php-nuke directory

Quote

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: index.php                                            *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *                                                                        *
 *    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.                              *
 *                                                                        *
 *************************************************************************/

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

define('GET_CACHES', 1);
define('ROOT_PATH', '../gallery/');
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(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 ---------------------------------
//-----------------------------------------------------

change this next line to the number of columns you want
Quote

$nuke_no_cols=1;
$imgtable_width = ceil(intval($config['image_table_width']) / $nuke_no_cols);
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;
  }
}


change this line to the number of images you want, it should be a multiple of the number of columns you specified above
Quote

/* $num_new_images = $config['image_cells']*3; */
$num_new_images = 4;

$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 == $nuke_no_cols) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($nuke_no_cols - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n \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');
?>



it uses a file in the gallery/templates directory which is called home2.html
this contains literally one word

Quote

                {new_images}              


I assume there's a way to do this without putting that word in a seperate file,  but since the file had a lot more in it initially and I just stripped it down to what I needed, that's how it's ended up.


Bev

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Put last images add to galerie In another php pag
« Reply #7 on: November 02, 2002, 02:55:49 AM »
tks

Offline rcull

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • http://www.buicks.net
Re: Put last images add to galerie In another php pag
« Reply #8 on: June 19, 2005, 05:21:22 PM »
This is almost working for me as long as the page doing the request is in the same directory level as the "includes" directory. It puts everything up on another .php page as it is supposed to, but includes a print of

{endif random_image}   
{endif categories}

The test which almost works is here page is here:
http://www.buicks.net/newsletter/2005/test2.php

But, when I move it to another directory level I get:
http://www.buicks.net/newsletter/test2.php

Thanks...