Ciao a tutti ho un quesito da chiedervi..

ho un file che è parte di joomla che ha la funzione di visualizzare un numero dichiarato di immagini scelte a caso da una tabella del database..

questo è il codice:

Codice PHP:
<?php


// no direct access
defined'_VALID_MOS' ) or die( 'Restricted access' );

// language-specific stuff
define ('_CLICK_OPEN_IMAGE','Guarda la galleria');
define ('_CLICK_OPEN_ALBUM','');

// Get parameters
$moduleclass_sfx $params->get'moduleclass_sfx' );
$pretext         $params->get'pretext' );
$size            $params->get'size' );
$width           $params->get'width' );
$count           $params->get'count' );
$linkimage       $params->get'linkimage' );
$border          $params->get'border' );
$showtitle       $params->get'showtitle' );
$showalbum       $params->get'showalbum' );
$showauthor      $params->get'showauthor' );
$showhits        $params->get'showhits' );
$showdate        $params->get'showdate' );
$albumlabel      $params->get'albumlabel' );
$authorlabel     $params->get'authorlabel' );
$hitslabel       $params->get'hitslabel' );
$datelabel       $params->get'datelabel' );
$orientation     $params->get'orientation' );
$exclusions      $params->get'exclusions' );
$approved        $params->get'approved' );

// Format the exclusions as a part of the DB query
if ($exclusions)
{
    
$exclusions str_replace(" ","",$exclusions);
    while (
substr($exclusions,0,1) == ",")
        
$exclusions substr($exclusions,1,strlen($exclusions)-1);
    while (
substr($exclusions,strlen($exclusions)-1) == ",")
        
$exclusions substr($exclusions,0,strlen($exclusions)-1);
    
$exclusions str_replace","") AND (catid != ","AND (catid != ".$exclusions.")");
}

// Approved only?
if ($approved)
    
$approved "AND approved";

// Query every published record in the image table
$database->setQuery("SELECT * FROM #__ponygallery WHERE published $approved $exclusions");
$images $database->loadObjectList();

// How many images are there?
$totalimages count($images);
$imagesused "~";

// We need to use a table for this to work
$content "<table width='100%'>\n<tr>\n";

// Display the random image
if ($width)
    
$width "width='$width'";

// Produce as many images as requested
for ($i=0$i<$count$i++)
{
    
// Select one at random
    
do
        
$selection $images[rand(1,$totalimages-1)];
    while (
stripos($imagesused,"~".$selection->id."~"));
    
$imagesused .= $selection->id."~";

    if ( 
$size == "thumb" )
    {
        
$imgsrc "



[img]"
.$GLOBALS[[/img]imgthumbname."' border=".$border.$width />\n";
    }
    else
    {
        
$imgsrc "[img]".$GLOBALS[[/img]imgfilename."'  border=".$border.$width />\n";
    }

    
// See if we need to make the image clickable
    
if ( $linkimage )
        
$content .= "<td>[url='".$GLOBALS[']id."' title='"._CLICK_OPEN_IMAGE."'>".$imgsrc."[/url]";
    else
        
$content .= "<td>$imgsrc";

    // See if we need to add any text
    if ( 
$showalbum )
    {
        
$database->setQuery( "SELECT name FROM #__ponygallery_catg WHERE cid=$selection->catid" );
        
$album $database->loadResult();
        if ( 
$linkimage $album "[url='".$GLOBALS[']catid."' title="._CLICK_OPEN_ALBUM.">".$album."[/url]";
        
$content .= "
".
$albumlabel.$album."\n";
    }
    if ( 
$showtitle  and $selection->imgtitle != '' )   $content .= "
".
$selection->imgtitle."\n";
    if ( 
$showauthor and $selection->imgauthor != '' )
    {
        // see if Community Builder is installed
        if (file_exists(
$GLOBALS['mosConfig_absolute_path']."/components/com_comprofiler"))
        {
            
$database->setQuery("SELECT FROM #__users WHERE username='$selection->owner'");
            
$database->loadObject($user);
            
$content .= "
"
.$authorlabel."[url='".$GLOBALS[']id'>".$selection->imgauthor."[/url]\n";
        }
        else
            
$content .= "
".
$authorlabel.$selection->imgauthor."\n";
    }
    if ( 
$showdate   and $selection->imgdate != '' )    $content .= "
".
$datelabel.date($showdate,$selection->imgdate)."\n";
    if ( 
$showhits   and $selection->imgcounter != '' ) $content .= "
".
$hitslabel.$selection->imgcounter."\n";

    if ((
$i < ($count-1)) && ($orientation == "vertical"))
        
$content .= "<hr></td>\n</tr>\n<tr>\n";
    else
        
$content .= "</td>\n";
}

$content .= "</tr></table>";

// Display any pretext specified
if (
$pretext)
    
$content = $pretext.$content;

?>

La mia domanda è:

sarebbe difficile modificarlo in modo tale che anzichè visualizzare un certo numero di immagini a caso, vengano visualizzate tutte le immagni presenti nella tabella e basta??

sono un pecorone in php e quindi non riesco a capire se è possibile farlo??

un grazie a chi mi aiuta!!!