[url]Album name[/url] under lastalb thumb [url]Album name[/url] under lastalb thumb
 

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

Main Menu

[url]Album name[/url] under lastalb thumb

Started by 3git, May 09, 2010, 03:08:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

3git

Hello,

At first I'd like to thank all Devs for great work around CPG. I'm using it for 3-4 years now (1.4x) and now I'm moving to 1.5x.

My problem is a long term issue I have. Never asked for help here because it wasn't so urgent and besides that I like founding things by myself (as possible of course). Now, when I decided to move to 1.5x with EnlargeIt plugin I started to drill the problem again.

So the problem is to have album name as a link to the album under the thumbnail in lastabl table. Before Enlargeit people used to click on thumb to get to the newest album thumb view. Now, when you click on thumb you get full sized pic without redirection. I don't want people to search the newest album in the categories, because it can be kind confusing after few years of just clicking on thumb. I was concidering to ask about enlargeit help, to disable it on main page, but as the problem is more on lastalb side I'd like to solve it that way (I needed to put some extra info under thumbs, especially lastalb panel and never accomplished).

What I tried:

-search the forum to solve my problem many times with various search queries
-mess with sample/theme.php, template.html
-mess with igames/theme.php, template.html <- my theme
-mess with includes/functions.php <- I think that's the one, but never did what I want, maybe my php knowledge is too poor.
-mess with includes/theme.inc.php

The other day I've found how to put some extra fields under thumbs in thumbview or lasthits (I found post how to remove IP from lasthits and tried to do the same (add) on lastabl but with no result). About lastalb I found various posts, but mostly about sorting etc, not my problem.

My old gallery 1.4x -> www.3git.org (polish site)
My new gallery 1.5x -> caiman.net.pl (as well polish, don't mind header from 3git, I'll mess the layout at the end)

Any ideas welcome, if you just point me what to do I'll be glad as well.

Αndré

Quote from: 3git on May 09, 2010, 03:08:24 PM
when you click on thumb you get full sized pic
Does it happen when you disable EnlargeIt!, too?

3git

No, it does not. That's why I'd like to have album name as a link below thumb, so people can jump into new album instead of searching it in cats. 

3git

I think I got it working...

I changed in includes/functions.php

global $thumb;  // make $thumb accessible to plugins
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if (in_array($aid, $album_types['albums'])) {
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                       $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
                    } else {
                       $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = (is_numeric($page)) ? "&amp;page=$page" : '';
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
                }
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => $target,
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                );
            }

        } else {  // mode != 'thumb'

            // Used for mode = 'user' from list_users() in index.php
            $params = array(
                '{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
                '{THUMB}'      => $thumb['image'],
                '{CAPTION}'    => $thumb['caption'],
                '{ADMIN_MENU}' => '',
            );

        }

to:

    global $thumb;  // make $thumb accessible to plugins
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if (in_array($aid, $album_types['albums'])) {
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
                );
            } else {
                // determine if thumbnail link targets should open in a pop-up
                if ($CONFIG['thumbnail_to_fullsize'] == 1) { // code for full-size pop-up
                    if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) {
                       $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['login_needed'],'','','','').'\');';
                    } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) {
                        $target = 'javascript:;" onclick="alert(\''.sprintf($lang_errors['access_intermediate_only'],'','','','').'\');';
                    } else {
                       $target = 'javascript:;" onclick="MM_openBrWindow(\'displayimage.php?pid=' . $thumb['pid'] . '&fullsize=1\',\'' . uniqid(rand()) . '\',\'scrollbars=yes,toolbar=no,status=no,resizable=yes,width=' . ((int)$thumb['pwidth']+(int)$CONFIG['fullsize_padding_x']) .  ',height=' .   ((int)$thumb['pheight']+(int)$CONFIG['fullsize_padding_y']). '\');';
                    }
                } elseif ($aid == 'random') {
                    $target = "displayimage.php?pid={$thumb['pid']}$uid_link#top_display_media";
                } elseif ($aid == 'lastcom' || $aid == 'lastcomby') {
                    $page = cpg_get_comment_page_number($thumb['msg_id']);
                    $page = (is_numeric($page)) ? "&amp;page=$page" : '';
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link&amp;msg_id={$thumb['msg_id']}$page#comment{$thumb['msg_id']}";
                } else {
                    $target = "displayimage.php?album=$aid$cat_link$date_link&amp;pid={$thumb['pid']}$uid_link#top_display_media";
                }
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => $target,
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
                );
            }

        } else {  // mode != 'thumb'

            // Used for mode = 'user' from list_users() in index.php
            $params = array(
                '{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}'   => "index.php?cat={$thumb['cat']}",
                '{THUMB}'      => $thumb['image'],
                '{CAPTION}'    => $thumb['caption'],
                '{ADMIN_MENU}' => '',
'{ALBUM_NAM}' => $thumb['title'], /HERE++++++++++++++++++++
            );

        }


and then in same file:

<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                       
{CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->


to:

<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                        [b]<a href="{LINK_TGT}">{ALBUM_NAM}<br /></a>[/b] /HERE++++++++++++++++++++
{CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->


NOW, it only works for LASTALB (in LASTHITS remains blank space <- any idea?)

To work it out with EnlargeIt I changed this:

plugins/enlargeit/codebase.php

<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a {LINK_ONCLICK} href="{LINK_TGT}">{THUMB}<br /></a>
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->


to

<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a {LINK_ONCLICK} href="{LINK_TGT}">{THUMB}<br /></a>
<a href="{LINK_TGT}">{ALBUM_NAM}<br /></a> /HERE++++++++++++++++++++
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->



Now I need to get rid of album name from {CAPTION} and make it work on lasthits (but I don't mind it's not there)

3git

Sorry for so many posts (can edit?)

FIRSTLY - the file to edit in previous post is themes.inc.php NOT includes/functions.php (too many windows open, my bad)

Secondly, to kick out title from {CAPTION} I edited:

includes/functions.php (for sure this time)

function build_caption(&$rowset, $must_have = array(), $mode = 'files')
{
    global $CONFIG, $THEME_DIR, $lang_date, $lang_get_pic_data, $cpg_udb;

    foreach ($rowset as $key => $row) {

        $caption = '';

        if ($CONFIG['display_filename']) {
            $caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
        }

        if (!empty($row['title'])) {
            $caption .= '<span class="thumb_title">' . $row['title'] . '</span>';
        }


to

function build_caption(&$rowset, $must_have = array(), $mode = 'files')
{
    global $CONFIG, $THEME_DIR, $lang_date, $lang_get_pic_data, $cpg_udb;

    foreach ($rowset as $key => $row) {

        $caption = '';

        if ($CONFIG['display_filename']) {
            $caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
        }

        if (!empty($row['title'])) {
            $caption .= '<span class="thumb_title"></span>'; /HERE+++++++++++++++++
        }


If any one can help with fixing lasthits I'd be glad. I mean now it does not show title of the album linked to it's thumbview.

Joachim Müller


3git

If it's really the same (theme.inc.php = theme/theme.php) I'll try to figure it out with theme.php only, but as far as I remember theme.php changes didn't work (possible?).

Anyway, thanks for the advice Joachim.

Αndré

Imo EnlargeIt! should be adjusted to refer to the lastalb meta album instead of opening the album thumbnail.

3git

Yes Αndré, that's why I post here. It should at least have an option to disable on index.php or meta or whatever.

Joachim Müller

But that's not a matter of theming, but a matter of plugin design, isn't it? I'm not sure if Timo (the author of enlargeIt) is aware of this thread.

Joachim

3git

You're right Joachim. Plugin is very good, but I'd like to customize it a little bit.

Now I've found out that when I do:

$alb_name = $thumb['title'];
                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $alb_name,

besides


                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $thumb['title'],

I get right album name only for lastalb panel, but random, lasthits etc shows {ALB_NAME} below thumb. Before that (second option) I got album name under lastalb thumb and empty space in others.

Now my question is: Could anyone point me how to ask DB for right album name? So I can do something like:

$query  = "SELECT from........
$alb_name = $query

                $params = array(
                    '{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}'   => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}'      => $thumb['image'],
                    '{CAPTION}'    => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu'],
                    '{ALB_NAME}'   => $alb_name,

Maybe that will help to show proper album name. One more thing, If I choose for expample $thumb['filename'] besides $thumb['title'] everything works great ;/ ...wierd.


Αndré

Quote from: Joachim Müller on May 10, 2010, 02:41:35 PM
I'm not sure if Timo (the author of enlargeIt) is aware of this thread.

I already posted in the EnlargeIt! thread:
Quote from: Αndré on May 10, 2010, 12:04:41 PM
Timo, please note that issue.

3git

It's not just enlargeIt issue, I just want this 'album name link' under lastalb thumb (done) and metas (lasthits, random etc). EnlargeIt just made me to work on this as far as it disables thumb link to thumbnails.php.

But still, any help welcome.