Advanced search  


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: addendum to "thumb_title - viewed" output  (Read 5503 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
addendum to "thumb_title - viewed" output
« on: November 29, 2003, 03:22:08 pm »

code change: how the thumb_title and the n_views are rendered
css: class .thumb_title / new: .n_views

#449: the thumb_title line checks for "title" and "hits" and hence the span line always gets rendered (except for images that have not yet been viewed once).

Code: [Select]

                        $caption = ($rowset[$key]['title']||$rowset[$key]['hits']) ? "<span class=\"thumb_title\">".$rowset[$key]['title'].(($rowset[$key]['title'])?"":"").sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits'])."</span>" : '';

this may seem a bit like splitting hairs but... splitting that $caption check up in 2 phases (check title / check nviews) and generate html code accordingly seems to be a "cleaner" solution and one that gives the user more control over the "Look and Feel" of the output.

Due to lack of config settings for switching hit numbers on or off (maybe in a future release) i linked the "n_views" output to "comment_count" on/off (a temporary solution only).

Code: [Select]

                // Set picture caption
                if ($set_caption) foreach ($rowset as $key => $row){
                          $caption = ($rowset[$key]['title']) ? "<span class=\"thumb_title\">".$rowset[$key]['title'].(($rowset[$key]['title'])?"":"")."</span>" : '';
                        if ($CONFIG['display_comment_count']) {                          
                          $caption .= ($rowset[$key]['hits']) ? "<span class=\"n_views\">".sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits'])."</span>" : '';                        
                        if ($CONFIG['caption_in_thumbview']){
                           $caption .= $rowset[$key]['caption'] ? "<span class=\"thumb_caption\">".bb_decode(($rowset[$key]['caption']))."</span>" : '';
                        if ($CONFIG['display_comment_count']) {
                                $comments_nr = count_pic_comments($row['pid']);
                                if ($comments_nr > 0) $caption .= "<span class=\"thumb_num_comments\">".sprintf($lang_get_pic_data['n_comments'], $comments_nr )."</span>";
                        $rowset[$key]['caption_text'] = $caption;

i introduced a new class "n_views" enabling the user to control the "look" of the "viewed" output in css and I split the output up in two spans since I feel the thumb_title deserves a line on it's own and certainly it's own style.

of course the x Hits are still displayed in the same line as the title but in its own style and if you want it to be displayed under it just add a br tag to the n_views string in the language file.

all it needs now is a $CONFIG['display_hits_count'] and it's good to go.



  • Coppermine newbie
  • Offline Offline
  • Posts: 2
my solution to removing views from captions
« Reply #1 on: December 01, 2003, 07:06:48 am »

I added the following to sql/update.sql:
Code: [Select]

INSERT INTO CPG_config VALUES('views_in_caption', '0');

and then I accessed the update.php file via the web browser (ie.

Then I modified line #449 in to the following:
Code: [Select]
                       $caption = (($rowset[$key]['title']||$rowset[$key]['hits']) ? "<span class=\"thumb_title\">".$rowset[$key]['title'].(($rowset[$key]['title']&&$CONFIG['views_in_caption'])?"-".sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits']):"")."</span>" : '');
The option of turning it off and on via config interface is accomplished by adding the following to the appropriate language file (english.php around line 363 or so, in my case):
Code: [Select]

array('Display number of views in caption', 'views_in_caption', 1),


  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 95
Please help...
« Reply #2 on: December 18, 2003, 02:19:43 am »

I have 1.2.0 Final and its not solved, i dont know english well and i cant follow the instructions of these posts, what is the correct solution? The Eke post or the Chyne Post? Can someone put me the steps easily to do it? It will affect me in a future version if i change the code to further uptades? Thnks
Pages: [1]   Go Up

Page created in 0.027 seconds with 19 queries.