Ignore:
Timestamp:
Mar 15, 2006, 11:44:35 PM (19 years ago)
Author:
plg
Message:

new: cleaner URL. Instead of category.php?cat=search&search=123&start=42,
you now have category.php?/search/123/start-42. Functions make_index_url and
make_picture_url build these new URLs. Functions duplicate_picture_url and
duplicate_index_url provide shortcuts to URL creation. The current main page
page is still category.php but this can be modified easily in make_index_url
function. In this first version, no backward compatibility. Calendar
definition in URL must be discussed with rvelices.

improvement: picture.php redesigned. First actions like "set as
representative" or "delete a comment" which all lead to a redirection. Then
the page (the big mess) and includes of new sub pages to manage specific
parts of the page (metadata, user comments, rates).

new: with the cleaner URL comes a new terminology. $pagecat doesn't
exist anymore. $pagesection is among 'categories', 'tags' (TODO),
'list', 'most_seen'... And sub parameters are set : $pagecategory if
$pagesection is "categories". See URL analyse in
include/section_init.inc.php for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_default.inc.php

    r1056 r1082  
    2727
    2828/**
    29  * This file is included by category.php to show thumbnails for the default
     29 * This file is included by the main page to show thumbnails for the default
    3030 * case
    3131 *
     
    8282 
    8383  // url link on picture.php page
    84   $url_link = PHPWG_ROOT_PATH.'picture.php?image_id='.$row['id'];
     84  $url_link = PHPWG_ROOT_PATH.'picture.php?/'.$row['id'];
    8585
    86   if (isset($page['cat']))
     86  switch ($page['section'])
    8787  {
    88     $url_link.= '&cat='.$page['cat'];
    89 
    90     if ($page['cat'] == 'search')
     88    case 'categories' :
    9189    {
    92       $url_link.= '&search='.$_GET['search'];
     90      $url_link.= '/category/'.$page['category'];
     91      break;
    9392    }
    94     else if ($page['cat'] == 'list')
     93    case 'tags' :
    9594    {
    96       $url_link.= '&list='.$_GET['list'];
     95      // TODO
     96      break;
     97    }
     98    case 'search' :
     99    {
     100      $url_link.= '/search/'.$page['search'];
     101      break;
     102    }
     103    case 'list' :
     104    {
     105      $url_link.= '/list/'.implode(',', $page['list']);
     106      break;
     107    }
     108    default :
     109    {
     110      $url_link.= '/'.$page['section'];
    97111    }
    98112  }
    99113 
    100   if (isset($_GET['calendar']))
     114  if (isset($page['chronology']))
    101115  {
    102     $url_link.= '&calendar='.$_GET['calendar'];
     116    $url_link.= '/chronology='.$page['chronology'];
    103117  }
    104118   
     
    126140      $name = str_replace('_', ' ', get_filename_wo_extension($row['file']));
    127141    }
    128     if ( isset($page['cat']) )
     142
     143    switch ($page['section'])
    129144    {
    130       if ($page['cat'] == 'best_rated')
     145      case 'best_rated' :
    131146      {
    132147        $name = '('.$row['average_rate'].') '.$name;
     148        break;
    133149      }
    134       elseif ($page['cat'] == 'most_visited')
     150      case 'most_visited' :
    135151      {
    136152        $name = '('.$row['hit'].') '.$name;
     153        break;
    137154      }
    138      
    139       if ($page['cat'] == 'search')
     155      case 'search' :
    140156      {
    141157        $name = replace_search($name, $_GET['search']);
     158        break;
    142159      }
    143160    }
     
    152169   
    153170  if ($user['show_nb_comments']
    154       and is_numeric($page['cat'])
     171      and isset($page['category'])
    155172      and $page['cat_commentable'])
    156173  {
Note: See TracChangeset for help on using the changeset viewer.