Last viewed within 6 hours only Last viewed within 6 hours only
 

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

Last viewed within 6 hours only

Started by dreams83, June 18, 2007, 01:25:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dreams83

case 'last6': // Last viewed pictures in the last 6 hours
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['last6'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['last6'];
                }
$last24 = time() - 21600;
                $query ="SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE (approved = 'YES' AND hits > 0 AND UNIX_TIMESTAMP(mtime) > $last24) $META_ALBUM_SET $keyword";

                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', hits, aid, filename, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE (approved = 'YES' AND hits > 0 AND UNIX_TIMESTAMP(mtime) > $last24) $META_ALBUM_SET $keyword ORDER BY UNIX_TIMESTAMP(mtime) DESC, filename  $limit";
                $result = cpg_db_query($query);

                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('hits'));

                $rowset = CPGPluginAPI::filter('thumb_caption_topn',$rowset);

                return $rowset;
                break;


I added that to the "functions.inc.php" file and test it manually and it work, but I do not know how to generate a link automatically like the one for most viewed.

Seem like it is
<li><a href="{TOPN_TGT}" title="{TOPN_LNK}">{TOPN_LNK}</a></li>

like that in the theme.php in the theme folder. But I do not know how to generate the link like

http://www.ehmongmusic.com/thumbnails.php?album=last6&cat=0

automatically. Can someone help me?

Thank You

Sami

#1
You should Edit your theme.php and

-Add theme_main_menu() function to themes/your theme/theme.php from themes/sample/theme.php (if you don't have it already)

- Edit that function and add this to $param array of else statement

        '{LAST6_TGT}' => "thumbnails.php?album=last6$cat_l2",
        '{LAST6_TITLE}' => $lang_main_menu['last6_title'],
        '{LAST6_LNK}' => $lang_main_menu['last6_lnk'],


- Add the link to your custom $template_sub_menu by adding this

<li><a href="{LAST6_TGT}" title="{LAST6_TITLE}">{LAST6_LNK}</a></li>


- Edit language file (i.e. english.php) and add 'last6_title' and 'last6_lnk' to $lang_main_menu array ,something like this

'last6_lnk' => 'Last view(6 hr)',
'last6_title' => 'Last view within 6 hours',


You are Done !

It would be better to change this

$rowset = CPGPluginAPI::filter('thumb_caption_topn',$rowset);

to this

$rowset = CPGPluginAPI::filter('thumb_caption_last6',$rowset);

that would help plugin API to see your mod for further plugin codding ;)
‍I don't answer to PM with support question
Please post your issue to related board

dreams83