Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Randon-pictures block from a standalone COPPERMINE installation  (Read 3378 times)

0 Members and 1 Guest are viewing this topic.

moschos

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Randon-pictures block from a standalone COPPERMINE installation
« on: December 10, 2004, 11:47:01 pm »

Hello..!! Three days now I am trying to make block-random-pictures.php to run without errors but without luck.. I have a standalone installation of Coppermine 1.3.2 in my site http://www.nuked.gr/cpg132/ and I want to display radom pictures from the Gallery to my main page (phpnuke based) on http://www.nuked.gr
I modified block-random-pic.php to include the load.init from the cpg132 standalone installation but now I am getting the error :

Parse error: parse error, unexpected T_STRING in /home/jnukedag/public_html/blocks/block-Random_pictures.php on line 55

The code I try to make it work (I LOAD IT AS A BLOCK FROM THE ADMINISTRATOR BLOCK PAGE) is the following :

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/* Block to fit perfectly in the center of the site, remember that not all
   blocks looks good on Center, just try and see yourself what fits your needs */

if (eregi("block-Random_pictures.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}

require('/home/nuked/public_html/cpg132/include/init.inc.php');
$numberpic=5; // you can change the number of pictures here
global $prefix, $dbi;

function truncate_string444($str)
{
   $maxlength = 20; // maximum lenght of name in block
   
   if (strlen($str) > $maxlength)
      return substr($str, 0, $maxlength)." ...";
   else
      return $str;
}

$content="<center>";
$result = sql_query("SELECT count(*) from cpg_pictures", $dbi);
   $nbEnr = mysql_fetch_array($result);
   $count = $nbEnr[0];

while ($stop<$numberpic)
{
   srand(time()+$stop);
   $random_number = rand(0, $count-1);
   $result2 = sql_query("SELECT pid, aid, filepath, filename  from cpg_pictures WHERE approved='YES' LIMIT $random_number,1", $dbi);
  $picture = mysql_fetch_array($result2);
 
   $img = "<img src=\"{$picture['filepath']}thumb_{$picture['filename']}\"  border=\"0\">";
   $content .= "<a href=\"http://www.nuked.gr/cpg132/displayimage.php&album=random&cat=&pos=-{$picture['pid']}\">$img<br>" . truncate_string444($picture['filename']) . "</a><br><br>";

$stop++;
}
?>


ANY HELP WILL BE MUCH MUCH APPRECIATED..!! Thanks a lot !
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Randon-pictures block from a standalone COPPERMINE installation
« Reply #1 on: December 11, 2004, 03:53:12 am »

1.  Check for empty space after the closing ?>.  The code you posted only has 54 lines, but your error message says line 55.

2.  Try this:
Code: [Select]
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/* Block to fit perfectly in the center of the site, remember that not all
   blocks looks good on Center, just try and see yourself what fits your needs */

if (eregi("block-Random_pictures.php"$PHP_SELF)) {
    
Header("Location: index.php");
    die();
}

require(
'/home/nuked/public_html/cpg132/include/init.inc.php');
$numberpic=5// you can change the number of pictures here
global $prefix$dbi;

function 
truncate_string444($str)
{
   
$maxlength 20// maximum lenght of name in block
   
   
if (strlen($str) > $maxlength)
      return 
substr($str0$maxlength)." ...";
   else
      return 
$str;
}

$content="<center>";
$result sql_query("SELECT count(*) from cpg_pictures"$dbi);
   
$nbEnr mysql_fetch_array($result);
   
$count $nbEnr;

while (
$stop<$numberpic)
{
   
srand(time()+$stop);
   
$random_number rand(0$count-1);
   
$result2 sql_query("SELECT pid, aid, filepath, filename  from cpg_pictures WHERE approved='YES' LIMIT $random_number,1"$dbi);
   
$picture mysql_fetch_array($result2);
 
   
$img '<img src="' $picture['filepath'] . 'thumb_' $picture['filename'] . '"  border="0">';
   
$content .= '<a href="http://www.nuked.gr/cpg132/displayimage.php&album=random&cat=&pos=-' $picture['pid'] . '">' $img '<br>' truncate_string444($picture['filename']) . '</a><br><br>';

   
$stop++;
}
?>

A side note - you should post your PHP code using the insert code button.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Randon-pictures block from a standalone COPPERMINE installation
« Reply #2 on: December 11, 2004, 09:59:29 am »

Obviously you're using the nuke port of coppermine, which goes unsupported here. Please read the sticky on the deprecated nuke support board I'm moving this thread to.

Joachim

Edit by kegobeer: Joachim, he has the standalone gallery but wants to display random images on his nuke site.  This should be moved back to the original post location.  Also, can you give me permissions to reply to threads on this board?
« Last Edit: December 11, 2004, 02:11:55 pm by kegobeer »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Randon-pictures block from a standalone COPPERMINE installation
« Reply #3 on: December 16, 2004, 08:01:41 am »

oops, sorry. Moving the thread back to where it was originally posted.

@Kegobeer: I didn't realize you don't have permissions to reply here, will change permissions asap.

Joachim
Logged
Pages: [1]   Go Up
 

Page created in 0.047 seconds with 20 queries.