aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
committerplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
commit42abf4c57664d2596872d437f70b95193f9a5d18 (patch)
treea1262b8601d5ac5b04b5b2e71af52c453712b9df /picture.php
parent68ed2ea617ede199a0e2f15fdd4886095ae600cb (diff)
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
Diffstat (limited to '')
-rw-r--r--picture.php48
1 files changed, 33 insertions, 15 deletions
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(
-// '/([^,]+)/',
-// '<a href="'.
-// PHPWG_ROOT_PATH.'category.php?cat=search&amp;search=keywords:$1'
-// .'">$1</a>',
-// $picture['current']['keywords']
-// );
- $picture['current']['keywords'];
+ $tags = array();
+
+ while ($row = mysql_fetch_array($result))
+ {
+ array_push(
+ $tags,
+ '<a href="'
+ .make_index_URL(
+ array(
+ 'tags' => array(
+ array(
+ 'id' => $row['id'],
+ 'url_name' => $row['url_name'],
+ ),
+ )
+ )
+ )
+ .'">'.$row['name'].'</a>'
+ );
+ }
+
+ $infos['INFO_TAGS'] = implode(', ', $tags);
}
else
{
- $infos['INFO_KEYWORDS'] = l10n('N/A');
+ $infos['INFO_TAGS'] = l10n('N/A');
}
$template->assign_vars($infos);