coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: montoya701 on June 20, 2006, 05:28:28 PM

Title: description and name in popup
Post by: montoya701 on June 20, 2006, 05:28:28 PM
Is it possible and how to have name and desription(with that picture) in popup. It would be nice if there is somethnig like a template page for popup so it could be edited.

thanks
Title: Re: description and name in popup
Post by: Paver on June 20, 2006, 05:29:26 PM
The template function for the popup is theme_display_fullsize_pic.  If you don't have it in themes/yourtheme/theme.php, then copy the whole function from the sample theme and edit to your liking.

edit: To add the name and description, you can use the query results already grabbed in the function and stored in $row.  The name is the field 'title' and the description is the field 'caption'.  For example, modify the content block as shown, adding the last two echo lines:
              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
                echo 
$row['title']."<br />\n";
                echo 
$row['caption']."<br />\n";
               
?>
Title: Re: description and name in popup
Post by: montoya701 on June 20, 2006, 05:44:09 PM
sorry man, but i don't understand you.
I find code for opening thumbs in fullsize popoup(theme.php in template),but what shoud i do with theme_display_fullsize_pic. where to put in theme.php code?
Title: Re: description and name in popup
Post by: Vargha on June 20, 2006, 05:52:45 PM
Paver edited his post, read again
u put the 'theme_display_fullsize_pic'
in your themes/yourtheme/theme.php
below the ?>
Title: Re: description and name in popup
Post by: Paver on June 20, 2006, 06:00:23 PM
As Vargha said, all variables and functions you want to customize should be copied from the sample theme.  You can copy them anywhere in your theme.php, but you need to make sure you do it properly for PHP (and not put a function inside another function for example).  If you don't know PHP well, the easiest thing to do is to always copy the new variable or function at the very end, before the last line: ?> - as Vargha said.
Title: Re: description and name in popup
Post by: montoya701 on June 20, 2006, 06:19:15 PM
ok, thanks

i just start editing. i'll let you known soon what i done
Title: Re: description and name in popup
Post by: montoya701 on June 20, 2006, 06:39:11 PM
it looks i am an idiot, but i'm not. i known how to edit php but it's problem i don't known yet how it works (this gallery).
When i paste this code in theme.php(at the end) i get (javascript close window) like a error in top of template.

All i have to do is to edit theme.php, nothing else?
Title: Re: description and name in popup
Post by: Paver on June 20, 2006, 07:08:02 PM
Yes, you only edit one file: themes/yourtheme/theme.php.

If you want to start over, recover the original theme.php from the theme you are using.  Then copy the code below into the file, at the very end, just before the last line: ?>
// Display the full size image
function theme_display_fullsize_pic()
{
    global $CONFIG, $THEME_DIR, $ALBUM_SET;
    global $lang_errors, $lang_fullsize_popup, $lang_charset;

    if (isset($_GET['picfile']))
    {
        if (!GALLERY_ADMIN_MODE) cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);

    $picfile = $_GET['picfile'];
    $picname = $CONFIG['fullpath'] . $picfile;
    $imagesize = @getimagesize($picname);
    $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]);
    }
    elseif (isset($_GET['pid']))
    {
    $pid = (int)$_GET['pid'];
    $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='$pid' $ALBUM_SET";
    $result = cpg_db_query($sql);

    if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);

    $row = mysql_fetch_array($result);
    $pic_url = get_pic_url($row, 'fullsize');
    $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"';
    $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom);
    }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <script type="text/javascript" src="scripts.js"></script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; height:100%; width:100%; border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  </style>
  </head>
  <body>
    <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
    </script>
    <table>
      <tr>
            <td>
          <div id="content">
              <?php     echo  '<a href="javascript: window.close()"><img src="'
                
htmlspecialchars($imagedata['path']) . '" '
                
$imagedata['geometry']
                . 
'alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
                echo 
$row['title']."<br />\n";
                echo 
$row['caption']."<br />\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

This is the entire function, including the two lines I added to the default function.  Once you see that working, you can modify those two lines as desired, making sure to obey PHP syntax rules.
Title: Re: description and name in popup
Post by: montoya701 on June 20, 2006, 08:28:49 PM
that's it. Thanks Paver for solving my problem(like "pimp my ride" :)) )

This problem is officially SOLVED.
Title: Re: description and name in popup
Post by: Joachim Müller on June 20, 2006, 10:32:17 PM
Quote from: Vargha on June 20, 2006, 05:52:45 PM
below the ?>
should read
Quotebefore ?> into a new line
Title: Re: description and name in popup
Post by: DaDragonPrincess on July 11, 2006, 04:10:24 AM
I don't get it myself, I also wants to custimize my pop up window for images,but don't know where to find the coding for it. Where do we go to find it, do we go under themes? Where do we find themes/yourtheme/theme.php and etc?
Title: Re: description and name in popup
Post by: Joachim Müller on July 11, 2006, 07:21:54 AM
Quote from: DaDragonPrincess on July 11, 2006, 04:10:24 AM
Where do we find themes/yourtheme/theme.php and etc?
Inside the themes folder, there are several themes by default (e.g. classic, igames, water_drop). One of those themes is the theme you are using. This is what we refer to as "yourtheme", so if you are using a theme named "foobar", the file you need to edit themes/foobar/theme.php. If this is too complicated for you I suggest finding some paid help.
Title: Re: description and name in popup
Post by: DaDragonPrincess on July 11, 2006, 09:58:28 PM
Ok I'm under the theme i'm using and this is all thats there,nothing of what you just mention:

../ Up a Level 4.00k 755  Jun 20 12:44 2006 princess princess 
images 4.00k 755 Protect
Rename Jun 20 12:44 2006 princess princess 
style.css 11.5k 644 Edit
Rename
Copy Jul 11 06:34 2006 princess princess 
template.html 1.63k 644 Edit
Rename
Copy Jul 10 08:44 2006 princess princess 
theme.php
Title: Re: description and name in popup
Post by: Nibbler on July 11, 2006, 11:10:11 PM
theme.php is right there  ::)