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: Last viewed within 6 hours only  (Read 2614 times)

0 Members and 1 Guest are viewing this topic.

dreams83

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 54
Last viewed within 6 hours only
« on: June 18, 2007, 01:25:12 am »

Code: [Select]
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
Code: [Select]
<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
« Last Edit: June 26, 2007, 03:53:24 pm by GauGau »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Last viewed within 6 hours only
« Reply #1 on: June 18, 2007, 10:54:40 am »

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
Code: [Select]
        '{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
Code: [Select]
<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
Code: [Select]
'last6_lnk' => 'Last view(6 hr)',
'last6_title' => 'Last view within 6 hours',

You are Done !

It would be better to change this
Code: [Select]
$rowset = CPGPluginAPI::filter('thumb_caption_topn',$rowset);
to this
Code: [Select]
$rowset = CPGPluginAPI::filter('thumb_caption_last6',$rowset);
that would help plugin API to see your mod for further plugin codding ;)
« Last Edit: June 18, 2007, 11:02:07 am by Sami »
Logged
‍I don't answer to PM with support question
Please post your issue to related board

dreams83

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 54
Re: Last viewed within 6 hours only
« Reply #2 on: June 19, 2007, 10:24:17 pm »

Thank You,

Got it Now.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.