Changeset 1119 for trunk/picture.php


Ignore:
Timestamp:
Apr 3, 2006, 12:26:19 AM (18 years ago)
Author:
plg
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r1107 r1119  
    699699$infos['INFO_FILE'] = $picture['current']['file'];
    700700
    701 // keywords
    702 if (!empty($picture['current']['keywords']))
    703 {
    704   $infos['INFO_KEYWORDS'] =
    705     // FIXME because of search engine partial rewrite, giving the author
    706     // name threw GET is not supported anymore. This feature should come
    707     // back later, with a better design (tag classification).
    708 //     preg_replace(
    709 //       '/([^,]+)/',
    710 //       '<a href="'.
    711 //         PHPWG_ROOT_PATH.'category.php?cat=search&amp;search=keywords:$1'
    712 //         .'">$1</a>',
    713 //       $picture['current']['keywords']
    714 //       );
    715     $picture['current']['keywords'];
     701// tags
     702$query = '
     703SELECT id, name, url_name
     704  FROM '.IMAGE_TAG_TABLE.'
     705    INNER JOIN '.TAGS_TABLE.' ON tag_id = id
     706  WHERE image_id = '.$page['image_id'].'
     707;';
     708$result = pwg_query($query);
     709
     710if (mysql_num_rows($result) > 0)
     711{
     712  $tags = array();
     713 
     714  while ($row = mysql_fetch_array($result))
     715  {
     716    array_push(
     717      $tags,
     718      '<a href="'
     719      .make_index_URL(
     720        array(
     721          'tags' => array(
     722            array(
     723              'id' => $row['id'],
     724              'url_name' => $row['url_name'],
     725              ),
     726            )
     727          )
     728        )
     729      .'">'.$row['name'].'</a>'
     730      );
     731  }
     732
     733  $infos['INFO_TAGS'] = implode(', ', $tags);
    716734}
    717735else
    718736{
    719   $infos['INFO_KEYWORDS'] = l10n('N/A');
     737  $infos['INFO_TAGS'] = l10n('N/A');
    720738}
    721739
Note: See TracChangeset for help on using the changeset viewer.