From 114ae324452ac88fe7b672338cba931d838ee2a4 Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 15 Mar 2006 22:44:35 +0000 Subject: 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. $page['cat'] doesn't exist anymore. $page['section'] is among 'categories', 'tags' (TODO), 'list', 'most_seen'... And sub parameters are set : $page['category'] if $page['section'] is "categories". See URL analyse in include/section_init.inc.php for details. git-svn-id: http://piwigo.org/svn/trunk@1082 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/category_default.inc.php | 51 ++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'include/category_default.inc.php') diff --git a/include/category_default.inc.php b/include/category_default.inc.php index e401aec9b..599c527a9 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -26,7 +26,7 @@ // +-----------------------------------------------------------------------+ /** - * This file is included by category.php to show thumbnails for the default + * This file is included by the main page to show thumbnails for the default * case * */ @@ -81,25 +81,39 @@ foreach ($pictures as $row) } // url link on picture.php page - $url_link = PHPWG_ROOT_PATH.'picture.php?image_id='.$row['id']; + $url_link = PHPWG_ROOT_PATH.'picture.php?/'.$row['id']; - if (isset($page['cat'])) + switch ($page['section']) { - $url_link.= '&cat='.$page['cat']; - - if ($page['cat'] == 'search') + case 'categories' : + { + $url_link.= '/category/'.$page['category']; + break; + } + case 'tags' : + { + // TODO + break; + } + case 'search' : { - $url_link.= '&search='.$_GET['search']; + $url_link.= '/search/'.$page['search']; + break; } - else if ($page['cat'] == 'list') + case 'list' : { - $url_link.= '&list='.$_GET['list']; + $url_link.= '/list/'.implode(',', $page['list']); + break; + } + default : + { + $url_link.= '/'.$page['section']; } } - if (isset($_GET['calendar'])) + if (isset($page['chronology'])) { - $url_link.= '&calendar='.$_GET['calendar']; + $url_link.= '/chronology='.$page['chronology']; } $template->assign_block_vars( @@ -125,20 +139,23 @@ foreach ($pictures as $row) { $name = str_replace('_', ' ', get_filename_wo_extension($row['file'])); } - if ( isset($page['cat']) ) + + switch ($page['section']) { - if ($page['cat'] == 'best_rated') + case 'best_rated' : { $name = '('.$row['average_rate'].') '.$name; + break; } - elseif ($page['cat'] == 'most_visited') + case 'most_visited' : { $name = '('.$row['hit'].') '.$name; + break; } - - if ($page['cat'] == 'search') + case 'search' : { $name = replace_search($name, $_GET['search']); + break; } } @@ -151,7 +168,7 @@ foreach ($pictures as $row) } if ($user['show_nb_comments'] - and is_numeric($page['cat']) + and isset($page['category']) and $page['cat_commentable']) { $query = ' -- cgit v1.2.3