Changeset 1014 for trunk/picture.php


Ignore:
Timestamp:
Jan 27, 2006, 2:11:43 AM (18 years ago)
Author:
rvelices
Message:

improvement: got rid of num= _GET param in category.php (use only start=) so
that links to category for search engines are the same as in category
pagination

feature 77: standard navigation link : HTML Link types

improvement: add go to first and last image buttons in picture page

improvement: do not increase image hit in picture.php when rating, adding to
favorites, caddie, ...

improvement: show number of hits in most_visited (as best_rated shows the rate)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r1008 r1014  
    4444}
    4545//---------------------------------------- incrementation of the number of hits
    46 $query = '
    47 UPDATE '.IMAGES_TABLE.'
    48   SET hit = hit+1
    49   WHERE id = '.$_GET['image_id'].'
    50 ;';
    51 @pwg_query( $query );
     46if ( count(array_intersect(
     47             array_keys($_GET),
     48             array('add_fav', 'caddie', 'rate', 'representative', 'del') )
     49          )==0 )
     50{
     51  $query = '
     52  UPDATE '.IMAGES_TABLE.'
     53    SET hit = hit+1
     54    WHERE id = '.$_GET['image_id'].'
     55  ;';
     56  @pwg_query( $query );
     57}
    5258//-------------------------------------------------------------- initialization
    5359initialize_category( 'picture' );
     
    7076    break;
    7177  }
     78  if ($page['num']==0)
     79  {
     80    $url_first_last = PHPWG_ROOT_PATH.'picture.php';
     81    $url_first_last.= get_query_string_diff(array('image_id','add_fav',
     82                                                    'slideshow','rate'));
     83    $url_first_last.= '&image_id=';
     84    $template->assign_block_vars(
     85      'first',
     86      array(
     87        'U_IMG' => $url_first_last . $row['id'],
     88        ));
     89  }
    7290  $page['num']++;
    7391}
     92if ($page['cat_nb_images']>0 and $page['num'] < $page['cat_nb_images'] - 1)
     93{
     94  mysql_data_seek($result, $page['cat_nb_images'] - 1);
     95  $row = mysql_fetch_array($result);
     96  $url_first_last = PHPWG_ROOT_PATH.'picture.php';
     97  $url_first_last.= get_query_string_diff(array('image_id','add_fav',
     98                                                  'slideshow','rate'));
     99  $url_first_last.= '&amp;image_id=';
     100  $template->assign_block_vars(
     101    'last',
     102    array(
     103      'U_IMG' => $url_first_last . $row['id'],
     104      ));
     105}
     106
    74107// if this image_id doesn't correspond to this category, an error message is
    75108// displayed, and execution is stopped
     
    248281}
    249282
    250 $url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&amp;';
    251 $url_up.= 'num='.$page['num'];
     283$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'];
     284$url_up_start = floor( $page['num'] / $user['nb_image_page'] );
     285$url_up_start *= $user['nb_image_page'];
     286if ($url_up_start>0)
     287{
     288  $url_up .= '&amp;start='.$url_up_start;
     289}
     290
    252291if ( $page['cat'] == 'search' )
    253292{
     
    643682      'TITLE_IMG' => $picture['prev']['name'],
    644683      'IMG' => $picture['prev']['thumbnail'],
    645       'U_IMG' => $picture['prev']['url']
     684      'U_IMG' => $picture['prev']['url'],
     685      'U_IMG_SRC' => $picture['prev']['src']
    646686      ));
    647687}
     
    654694      'TITLE_IMG' => $picture['next']['name'],
    655695      'IMG' => $picture['next']['thumbnail'],
    656       'U_IMG' => $picture['next']['url']
     696      'U_IMG' => $picture['next']['url'],
     697      'U_IMG_SRC' => $picture['next']['src'] // allow navigator to preload
    657698      ));
    658699}
Note: See TracChangeset for help on using the changeset viewer.