From 42abf4c57664d2596872d437f70b95193f9a5d18 Mon Sep 17 00:00:00 2001 From: plegall Date: Sun, 2 Apr 2006 22:26:19 +0000 Subject: improvement: tags replace keywords. Better data model, less limitations. Each image can be associated to as many tag as needed. Tags can contain non ASCII characters. Oriented navigation with tags by association. git-svn-id: http://piwigo.org/svn/trunk@1119 68402e56-0260-453c-a942-63ccdbb3a9ee --- picture.php | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'picture.php') diff --git a/picture.php b/picture.php index 91a944bc9..bb4f8ead7 100644 --- a/picture.php +++ b/picture.php @@ -698,25 +698,43 @@ $infos['INFO_VISITS'] = $picture['current']['hit']; // file $infos['INFO_FILE'] = $picture['current']['file']; -// keywords -if (!empty($picture['current']['keywords'])) +// tags +$query = ' +SELECT id, name, url_name + FROM '.IMAGE_TAG_TABLE.' + INNER JOIN '.TAGS_TABLE.' ON tag_id = id + WHERE image_id = '.$page['image_id'].' +;'; +$result = pwg_query($query); + +if (mysql_num_rows($result) > 0) { - $infos['INFO_KEYWORDS'] = - // FIXME because of search engine partial rewrite, giving the author - // name threw GET is not supported anymore. This feature should come - // back later, with a better design (tag classification). -// preg_replace( -// '/([^,]+)/', -// '$1', -// $picture['current']['keywords'] -// ); - $picture['current']['keywords']; + $tags = array(); + + while ($row = mysql_fetch_array($result)) + { + array_push( + $tags, + ''.$row['name'].'' + ); + } + + $infos['INFO_TAGS'] = implode(', ', $tags); } else { - $infos['INFO_KEYWORDS'] = l10n('N/A'); + $infos['INFO_TAGS'] = l10n('N/A'); } $template->assign_vars($infos); -- cgit v1.2.3