From 6132e0daa602ba94479d670217b25b92269b463f Mon Sep 17 00:00:00 2001 From: z0rglub Date: Mon, 28 Jul 2003 21:30:19 +0000 Subject: adding keywords in the description of the picture git-svn-id: http://piwigo.org/svn/trunk@51 68402e56-0260-453c-a942-63ccdbb3a9ee --- picture.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/picture.php b/picture.php index 01ff49db1..d447a33a8 100644 --- a/picture.php +++ b/picture.php @@ -35,7 +35,7 @@ $query.= ';'; initialize_category( 'picture' ); $cat_directory = $page['cat_dir']; // by default //------------------------------------- main picture information initialization -$query = 'SELECT id,date_available,comment,hit'; +$query = 'SELECT id,date_available,comment,hit,keywords'; $query.= ',author,name,file,date_creation,filesize,width,height,cat_id'; $query.= ' FROM '.PREFIX_TABLE.'images'; $query.= $page['where']; @@ -56,6 +56,7 @@ $page['filesize'] = $row['filesize']; $page['width'] = $row['width']; $page['height'] = $row['height']; $page['cat_id'] = $row['cat_id']; +$page['keywords'] = $row['keywords']; // retrieving the number of the picture in its category (in order) $query = 'SELECT id'; $query.= ' FROM '.PREFIX_TABLE.'images'; @@ -397,6 +398,23 @@ $vtp->addSession( $handle, 'info_line' ); $vtp->setVar( $handle, 'info_line.name', $lang['filesize'].' : ' ); $vtp->setVar( $handle, 'info_line.content', $poids.' KB' ); $vtp->closeSession( $handle, 'info_line' ); +// keywords +if ( $page['keywords'] != '' ) +{ + $vtp->addSession( $handle, 'info_line' ); + $vtp->setVar( $handle, 'info_line.name', $lang['keywords'].' : ' ); + $keywords = explode( ',', $page['keywords'] ); + $content = ''; + $url = './category.php?cat=search&expand='.$_GET['expand']; + $url.= '&mode=OR&search='; + foreach ( $keywords as $i => $keyword ) { + $local_url = add_session_id( $url.$keyword ); + if ( $i > 0 ) $content.= ','; + $content.= ''.$keyword.''; + } + $vtp->setVar( $handle, 'info_line.content', $content ); + $vtp->closeSession( $handle, 'info_line' ); +} // number of visits $vtp->addSession( $handle, 'info_line' ); $vtp->setVar( $handle, 'info_line.name', $lang['visited'].' : ' ); -- cgit v1.2.3