Changeset 1014


Ignore:
Timestamp:
01/27/06 02:11:43 (14 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)

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/category.php

    r1004 r1014  
    6565} 
    6666 
    67 // Sometimes, a "num" is provided in the URL. It is the number 
    68 // of the picture to show. This picture must be in the thumbnails page. 
    69 // We have to find the right $page['start'] that show the num picture 
    70 // in this category 
    71 if ( isset( $_GET['num'] ) 
    72      and is_numeric( $_GET['num'] ) 
    73      and $_GET['num'] >= 0 ) 
    74 { 
    75   $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] ); 
    76   $page['start']*= $user['nb_image_page']; 
    77 } 
    78  
    7967initialize_category(); 
    8068 
  • trunk/include/category_default.inc.php

    r1004 r1014  
    4040$query = ' 
    4141SELECT DISTINCT(id),path,file,date_available 
    42        ,tn_ext,name,filesize,storage_category_id,average_rate 
     42       ,tn_ext,name,filesize,storage_category_id,average_rate,hit 
    4343  FROM '.IMAGES_TABLE.' AS i 
    4444    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id 
     
    109109      $name = '('.$row['average_rate'].') '.$name; 
    110110    } 
     111    else 
     112    if ($page['cat'] == 'most_visited') 
     113    { 
     114      $name = '('.$row['hit'].') '.$name; 
     115    } 
    111116     
    112117    if ($page['cat'] == 'search') 
  • trunk/include/functions_html.inc.php

    r1004 r1014  
    8383      $navbar.= '<a href="'; 
    8484      $navbar.= $url.'&amp;start=0'; 
    85       $navbar.= '" class="'.$link_class.'">'.$lang['first_page']; 
     85      $navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page']; 
    8686      $navbar.= '</a>'; 
    8787    } 
     
    9797      $navbar.= '<a href="'; 
    9898      $navbar.= $url.'&amp;start='.$previous; 
    99       $navbar.= '" class="'.$link_class.'">'.$lang['previous_page']; 
     99      $navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page']; 
    100100      $navbar.= '</a>'; 
    101101    } 
     
    131131        $navbar.= '&nbsp;<a href="'; 
    132132        $navbar.= $url.'&amp;start='.$temp_start; 
    133         $navbar.= '" class="'.$link_class.'">'.$i.'</a>'; 
     133        $navbar.= '" class="'.$link_class.'"'; 
     134        if ($i == $cur_page - 1) 
     135        { 
     136          $navbar.= ' rel="prev"'; 
     137        } 
     138        if ($i == $cur_page + 1) 
     139        { 
     140          $navbar.= ' rel="next"'; 
     141        } 
     142        $navbar.='>'.$i.'</a>'; 
    134143      } 
    135144      else 
     
    160169      $navbar.= '<a href="'; 
    161170      $navbar.= $url.'&amp;start='.$next; 
    162       $navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>'; 
     171      $navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].'</a>'; 
    163172    } 
    164173    else 
  • 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.= '&amp;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} 
  • trunk/template/yoga/picture.tpl

    r985 r1014  
    1515 
    1616<div class="randomButtons"> 
    17   <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}"><img src="{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a> 
     17  <a href="{U_SLIDESHOW}" title="{L_SLIDESHOW}" rel="nofollow"><img src="{themeconf:icon_dir}/slideshow.png" class="button" alt="{L_SLIDESHOW}"></a> 
    1818  <a href="{U_METADATA}" title="{L_PICTURE_METADATA}"><img src="{themeconf:icon_dir}/metadata.png" class="button" alt="{L_PICTURE_METADATA}"></a> 
    1919<!-- BEGIN representative --> 
     
    3535 
    3636<div class="navButtons"> 
     37<!-- BEGIN last --> 
     38  <a class="navButton prev" href="{last.U_IMG}"><img src="{themeconf:icon_dir}/last.png" class="button" alt="{lang:last_page}"></a> 
     39<!-- END last --> 
    3740<!-- BEGIN next --> 
    38   <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a> 
     41  <a class="navButton next" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"><img src="{themeconf:icon_dir}/right.png" class="button" alt="next"></a> 
     42  <link rel="prefetch" href="{next.U_IMG_SRC}"><link rel="prefetch" href="{next.U_IMG}"> 
    3943<!-- END next --> 
    4044  <a class="navButton up" href="{U_UP}" title="{L_UP_HINT}"><img src="{themeconf:icon_dir}/up.png" class="button" alt="{L_UP_ALT}"></a> 
    4145<!-- BEGIN previous --> 
    42   <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a> 
     46  <a class="navButton prev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"><img src="{themeconf:icon_dir}/left.png" class="button" alt="previous"></a> 
    4347<!-- END previous --> 
     48<!-- BEGIN first --> 
     49  <a class="navButton prev" href="{first.U_IMG}" rel="start"><img src="{themeconf:icon_dir}/first.png" class="button" alt="{lang:first_page}"></a> 
     50<!-- END first --> 
    4451</div> 
    4552 
     
    6673 
    6774<!-- BEGIN previous --> 
    68 <a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}"> 
     75<a class="navThumb" id="thumbPrev" href="{previous.U_IMG}" title="{L_PREV_IMG}{previous.TITLE_IMG}" rel="prev"> 
    6976  <img src="{previous.IMG}" class="thumbLink" id="linkPrev" alt="{previous.TITLE_IMG}"> 
    7077</a> 
    7178<!-- END previous --> 
    7279<!-- BEGIN next --> 
    73 <a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}"> 
     80<a class="navThumb" id="thumbNext" href="{next.U_IMG}" title="{L_NEXT_IMG}{next.TITLE_IMG}" rel="next"> 
    7481  <img src="{next.IMG}" class="thumbLink" id="linkNext" alt="{next.TITLE_IMG}"> 
    7582</a> 
     
    147154{rate.SENTENCE} : 
    148155<!-- BEGIN rate_option --> 
    149 {rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}">{rate.rate_option.OPTION}</a> 
     156{rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}" rel="nofollow">{rate.rate_option.OPTION}</a> 
    150157<!-- END rate_option --> 
    151158</p> 
Note: See TracChangeset for help on using the changeset viewer.