•  » Utilisation
  •  » [Catégories] Pour un meilleur classement / affichage

#16 2005-11-08 22:28:56

Reflex
Membre
2005-10-16
290

Re: [Catégories] Pour un meilleur classement / affichage

Non, j'ai le dernier Firefox.

Hors ligne

#17 2005-11-08 22:35:25

plg
Équipe Piwigo
Nantes, France, Europe
2002-04-05
12671

Re: [Catégories] Pour un meilleur classement / affichage

alors tu as mal copier/coller le code que je t'ai donné à ajouter dans functions_html.inc.php, il te manque la fin du bloc "if".


Les historiens ont établi que Pierrick était le premier utilisateur connu de Piwigo.

Hors ligne

#18 2005-11-08 22:38:58

VDigital
Former Piwigo Team
Montpellier (FR)
2005-05-04
15127

Re: [Catégories] Pour un meilleur classement / affichage

z0rglub a écrit:

Tu dois avois une vieille version d'IE.

Je suis très surpris de ta remarque 8;-)
Depuis quand IE reçoit du code php à interpréter?


Vincent -« Plus vidéaste averti que photographe amateur... »
La galerie - Le blog   

Piwigo est une application libre de gestion de photos en ligne.

Hors ligne

#19 2005-11-08 22:58:58

plg
Équipe Piwigo
Nantes, France, Europe
2002-04-05
12671

Re: [Catégories] Pour un meilleur classement / affichage

J'ai été un peu vite, j'ai pas suffisamment expliquer... Le "code" dans ce forum est affiché dans une balise HTML spéciale avec une hauteur maximal et ensuite il faut scroller pour voir la suite. Je ne suis pas sûr que cela soit supporté par toutes les versions d'IE.


Les historiens ont établi que Pierrick était le premier utilisateur connu de Piwigo.

Hors ligne

#20 2005-11-08 23:04:33

VDigital
Former Piwigo Team
Montpellier (FR)
2005-05-04
15127

Re: [Catégories] Pour un meilleur classement / affichage

Je ne suis pas sûr que la 4 ne supportait pas déjà, mais il fallait préciser (je me doutais quand même que ta remarque n'était pas liée au php).


Vincent -« Plus vidéaste averti que photographe amateur... »
La galerie - Le blog   

Piwigo est une application libre de gestion de photos en ligne.

Hors ligne

#21 2005-11-09 10:13:04

Reflex
Membre
2005-10-16
290

Re: [Catégories] Pour un meilleur classement / affichage

z0rglub a écrit:

alors tu as mal copier/coller le code que je t'ai donné à ajouter dans functions_html.inc.php, il te manque la fin du bloc "if".

Effectivement c'était le cas...
Voici ce que ça donne maintenant:

http://www.cichlides.com/forum/files/arborescence_161.png

Ca a rajouté des guillemets, ce que je ne souhaite absolument pas.
Il faut que les espèces soient écrites en italique sauf celles pour lesquelles j'ai mis moi-même des guillemets !

Le nom des espèces est en fait écrit de cette manière à la base:
- fainzilberi
- "black dorsal"
- "zebra chilumba"
- "zebra gold"

et il faudrait que ça apparaisse comme ça:

- fainzilberi
- "black dorsal"
- "zebra chilumba"
- "zebra gold"

Voici mon "defaut.css" actuel:

Code:

/* BACKGROUND */

body { background-color:#000000;} /*General background color*/
.main, .throw, .admin {  background-color:#3F3F3F;} /*Main background color*/
.row1,input,select,textarea, .table1, .home { background-color:#5F5F5F;} /* Tables & forms */
.table2, .commentTitle { background-color: #797979;} /* Alternate table & comments  */
.errors { background-color:red;} /* Errors display */
.titreMenu,.titrePage,.imgMenu a:hover { background-image: url(theme/tableh1_bg.gif);} /* Titles background image  */
.bouton, .imgMenu a, #imgBarMenu { background-image: url(theme/button_bg.gif);} /* Buttons background image */

/* FONT COLORS */

body { color:#E0E0E0;} /* General font color */
input,select,textarea { color:#FFFFCC;} /* Forms font color */
.titreMenu, .titreMenu a, .info, .admin{ color:#FFF48E;} /* Menu & sections titles */
.titrePage, .titreMenu a:hover { color:#E0E0E0;} /* Page title */
.comment{ color:#C6B78E;} /* Comments */
.commentDate { color:#999999;} /* Comments date */
.throw { color:#FFFFCC;} /* First line of tables */
.bouton, .errors { color:#FFFFFF;} /* Buttons & errors */

/* Update results (admin side only) */
.update_summary_new, .best_gen_time
{ color:#9cb4ce;}

/* Update results (admin side only) */
.update_summary_del,.worst_gen_time
{ color:#ffe1e1;}

/* ANCHORS */

a { text-decoration:none; color:#FFFFFF;}
a:hover { text-decoration:none; color:#FFF48E;}
a.none:hover { text-decoration:none;}
a.image:hover { text-decoration:none;}
a.thumbLink:hover { text-decoration:none;}

/* FONT STYLES */

body /* Main font style */
{
  font-family: Verdana, Geneva, Arial, sans-serif;
  font-size:12px;
  margin:5px;
}

h1 /* H1 tag style (admin side only) */
{
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  text-decoration:none; 
  line-height:  120%;
  font-size:18px;
  font-weight: bold;
}

h2 /* H2 tag style (admin side only) */
{
  font-family: Arial, Helvetica, sans-serif;
  text-decoration:none; 
  line-height:  120%; 
  font-size:12px;
  font-weight: bold;
}

.titreMenu /* Menu titles */
{
  font-size:12px;
  font-weight:600;
}

.titrePage /* Page titles */
{
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  font-weight:600;
  font-size:16px;
}

.commentTitle /* Comments title */
{
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  font-weight:bold;
}

.menu, .thumbnail, .totalImages { font-size:11px;}
.small{ font-size:10px;}
.menuCategorySelected, .throw, .admin, .errors { font-weight:bold;}
.menuCategoryNotSelected, .dateSelected, .pageNumberSelected, .thumb_picture, .thumb_category  { font-weight:normal;}
.commentDate, .bouton  { font-weight:lighter;}
.commentImage { font-style:italic; font-size:16px;}
.nameImage { font-size:20px;}
.info { font-size:16px;}
.copyright { font-size:10px; text-align:center; letter-spacing:-1px;}
div.information {  font-size:14px; font-weight:bold;}

/*----------------------------------------------*/
/* Under this point, do not modify the values   */
/* unless you are aware of what you are doing!  */
/*----------------------------------------------*/

/* POSITION */

#gauche,#droite
{
  float:left;
  width:30%;
  text-align:left;
  white-space:nowrap;
}

#centre
{
  float:left;
  width:39%;
  text-align:center;
}

#droite{text-align:right;}
#left {float:left; }
#right{float:right; }

/* GENERAL LAYOUT STYLES */

.main 
{
  border: 1px solid #E0E0E0; 
  width:100%;
  padding-bottom:30px;
  text-align:center;
  display:block;
}

.home
{
  border: 1px solid #000000;
  display:block;
  text-align:center;
  width:100%;
}

.navigationBar 
{
  text-align:center;
  margin-top:10px;
  margin-bottom:10px;
}

.info 
{
  margin:5px 0px 5px 0px;
  /* white-space:nowrap; */
  text-align:center;
}

.errors 
{
  text-align:left;
  margin-top:5px;
  margin-bottom:5px;
  border:1px solid black;
}

div.information {
  text-align:left;
  margin:10px;
  padding:5px;
}

span.dateSelected, span.pageNumberSelected {
  text-decoration:underline;
}
/* MENU LAYOUT STYLES */

.titreMenu,.titrePage
{
  padding-right: 10px;
  padding-left: 10px;
  border-bottom: 1px solid #000000;
  border-right: 1px solid #000000;
  height: 25px;
  line-height: 25px;
  text-align:center;
}
.titrePage {text-align:left;}

.menu 
{
  margin:10px 5px 10px 5px;
  white-space:nowrap;
  text-align:left;
}

ul.menu 
{
  text-align:left;
  list-style-type: square ;
  padding-left:15px;
  margin:5px;
}

.totalImages {
  text-align:center;
  margin-top:5px;
}

 /* IMAGE LAYOUT STYLES */
 
.image 
{
  border : 3px solid #FFFFFF;
  margin : 10px 4px 10px 4px;
}

#imgBarMenu
{
  width:100%;
  display:block;
  height:25px;
  border-bottom: 1px solid #000000;
}
  
.imgMenu
{
  width:48px;
  border:none;
  float:left;
}

.imgMenu img
{
 border:none;
 text-align:center;
 margin-top:4px;
}
  
.imgMenu a
{
  display:block;
  height: 25px;
  border-bottom: 1px solid #000000;
  border-left: 1px solid #838383;
  border-right: 1px solid #000000;
}

.imgMenu a:hover
{
  border-bottom: 1px solid #3F3F3F;
  border-left: 1px solid #3F3F3F;
  border-right: 1px solid #3F3F3F;
}

.commentImage {
  text-align:justify;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* TABLE LAYOUT STYLES */

.table1
{
  border: 1px solid #000000;
  display:block;
}
  
.table2 {
  border: 1px solid #000000; 
  margin:  0px 10px 0px 0px;
  padding:0px;
}

.tablecompact{
  width:100%;
  border-collapse:collapse;
}

.row1,.row2 {
  text-align:left;
  padding:5px 0px 5px 0px;
  height:20px;
} 

.throw {
  text-align:center;
  border-top: 1px solid #000000; 
  border-bottom: 1px solid #000000; 
  height:20px;
}

td.throw{
  text-align:left;
  width:auto;
}

/* THUMBNAILS LAYOUT STYLES */

.thumbnail {
  text-align:center;
  vertical-align: baseline;
  white-space: nowrap;
}

table.thumbnail {
  border-collapse:separate;
  display:inline-table;
}

.thumbLink {
  border-style: solid;
  border-width:1px;
  border-color: #A0A0A0;
  margin: 2px;
}

/* COMMENTS LAYOUT STYLES */

.commentTitle {  padding: 15px 5px 10px 5px; }
.commentDate {
  text-align:right;
  border-top: 1px solid #000000; 
  border-bottom: 1px solid #000000;
}

/* FORM LAYOUT STYLES */

form
{
  text-align:left;
  padding:10px;
}

.bouton
{
  border: 1px solid #404750;
  padding-left: 3px;
  padding-right: 3px;
  background-position : bottom;
  margin-top:10px;
}

input,select,textarea 
{
 text-indent:2px;
 border: 1px solid #797979;
 padding: 0;
}

.radio{  border:0;}

/* ADMIN LAYOUT STYLES */

.adminMenu 
{
  text-align:center;
  font-size:12px;
}

div.adminMenu{ margin:10px 50px 10px 50px; }

.admin 
{
margin:0px 0px 12px 0px;
text-align: center;
padding:0px;
}

div.remoteOutput, div.remoteLocal {
  border:1px solid black;
  margin:10px;
  text-align:left;
  padding:5px;
}

div.remoteLocal {
  text-align:center;
}

/* for debugging purpose */
pre { text-align:left; }

UL.menu A.provenance {
  font-weight: bold;
}

UL.menu A.genre {
  font-style: italic;
}

UL.menu A.espece:before {
  content: '"';
}

UL.menu A.espece:after {
  content: '"';
}
UL.menu A.especeGuillemet {
  font-style: normal;
  font-weight: normal;
}
 
UL.menu A.espece {
  font-style: italic;
}

Et voilà mon "functions_html.inc.php" actuel:

Code:

<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery                           |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch        : BSF (Best So Far)
// | file          : $RCSfile: functions_html.inc.php,v $
// | last update   : $Date: 2005/01/08 00:18:39 $
// | last modifier : $Author: plg $
// | revision      : $Revision: 1.22 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

function get_icon( $date )
{
  global $user, $conf, $lang;

  if (!preg_match('/\d{4}-\d{2}-\d{2}/', $date))
  {
    return '';
  }

  list( $year,$month,$day ) = explode( '-', $date );
  $unixtime = mktime( 0, 0, 0, $month, $day, $year );
  
  $diff = time() - $unixtime;
  $day_in_seconds = 24*60*60;
  $output = '';
  $title = $lang['recent_image'].'&nbsp;';
  if ( $diff < $user['recent_period'] * $day_in_seconds )
  {
    $icon_url = './template/'.$user['template'].'/theme/';
    $icon_url.= 'recent.gif';
    $title .= $user['recent_period'];
    $title .=  '&nbsp;'.$lang['days'];
    $size = getimagesize( $icon_url );
    $output = '<img title="'.$title.'" src="'.$icon_url.'" style="border:0;';
    $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
  }
  return $output;
}

function create_navigation_bar($url, $nb_element, $start,
                               $nb_element_page, $link_class)
{
  global $lang, $conf;

  $pages_around = $conf['paginate_pages_around'];
  
  $navbar = '';
  
  // current page detection
  if (!isset($start)
      or !is_numeric($start)
      or (is_numeric($start) and $start < 0))
  {
    $start = 0;
  }
  
  // navigation bar useful only if more than one page to display !
  if ($nb_element > $nb_element_page)
  {
    // current page and last page
    $cur_page = ceil($start / $nb_element_page) + 1;
    $maximum = ceil($nb_element / $nb_element_page);

    // link to first page ?
    if ($cur_page != 1)
    {
      $navbar.= '<a href="';
      $navbar.= add_session_id($url.'&amp;start=0');
      $navbar.= '" class="'.$link_class.'">'.$lang['first_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['first_page'];
    }
    $navbar.= ' | ';
    // link on previous page ?
    if ( $start != 0 )
    {
      $previous = $start - $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id( $url.'&amp;start='.$previous );
      $navbar.= '" class="'.$link_class.'">'.$lang['previous_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['previous_page'];
    }
    $navbar.= ' | ';

    if ($cur_page > $pages_around + 1)
    {
      $navbar.= '&nbsp;<a href="';
      $navbar.= add_session_id($url.'&amp;start=0');
      $navbar.= '" class="'.$link_class.'">1</a>';
      if ($cur_page > $pages_around + 2)
      {
        $navbar.= ' ...';
      }
    }
    
    // inspired from punbb source code
    for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1;
         $i < $stop;
         $i++)
    {
      if ($i < 1 or $i > $maximum)
      {
        continue;
      }
      else if ($i != $cur_page)
      {
        $temp_start = ($i - 1) * $nb_element_page;
        $navbar.= '&nbsp;<a href="';
        $navbar.= add_session_id($url.'&amp;start='.$temp_start);
        $navbar.= '" class="'.$link_class.'">'.$i.'</a>';
      }
      else
      {
        $navbar.= '&nbsp;<span class="pageNumberSelected">';
        $navbar.= $i.'</span>';
      }
    }

    if ($cur_page < ($maximum - $pages_around))
    {
      $temp_start = ($maximum - 1) * $nb_element_page;
      if ($cur_page < ($maximum - $pages_around - 1))
      {
        $navbar.= ' ...';
      }
      $navbar.= ' <a href="';
      $navbar.= add_session_id($url.'&amp;start='.$temp_start);
      $navbar.= '" class="'.$link_class.'">'.$maximum.'</a>';
    }
    
    $navbar.= ' | ';
    // link on next page ?
    if ( $nb_element > $nb_element_page
         && $start + $nb_element_page < $nb_element )
    {
      $next = $start + $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id( $url.'&amp;start='.$next );
      $navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
    }
    else
    {
      $navbar.= $lang['next_page'];
    }
    
    $navbar.= ' | ';
    // link to last page ?
    if ($cur_page != $maximum)
    {
      $temp_start = ($maximum - 1) * $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id($url.'&amp;start='.$temp_start);
      $navbar.= '" class="'.$link_class.'">'.$lang['last_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['last_page'];
    }
  }
  return $navbar;
}

//
// Pick a language, any language ...
//
function language_select($default, $select_name = "language")
{
  $available_lang = get_languages();

  $lang_select = '<select name="' . $select_name . '" onchange="this.form.submit()">';
  foreach ($available_lang as $code => $displayname)
  {
    $selected = ( strtolower($default) == strtolower($code) ) ? ' selected="selected"' : '';
    $lang_select .= '<option value="' . $code . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  }
  $lang_select .= '</select>';

  return $lang_select;
}

//
// Pick a template/theme combo, 
//
function style_select($default_style, $select_name = "style")
{
  $templates = get_templates();

  $style_selected = '<select name="' . $select_name . '" >';
  foreach ($templates as $template)
  {
    $selected = ( $template == $default_style ) ? ' selected="selected"' : '';
    $style_selected.= '<option value="'.$template.'"'.$selected.'>';
    $style_selected.= $template.'</option>';
  }
  $style_selected .= '</select>';
  return $style_selected;
}

/**
 * returns the list of categories as a HTML string
 *
 * categories string returned contains categories as given in the input
 * array $cat_informations. $cat_informations array must be an association
 * of {category_id => category_name}. If url input parameter is empty,
 * returns only the categories name without links.
 *
 * @param array cat_informations
 * @param string url
 * @param boolean replace_space
 * @return string
 */
function get_cat_display_name($cat_informations,
                              $url = 'category.php?cat=',
                              $replace_space = true)
{
  global $conf;
  
  $output = '';
  $is_first = true;
  foreach ($cat_informations as $id => $name)
  {
    if ($is_first)
    {
      $is_first = false;
    }
    else
    {
      $output.= $conf['level_separator'];
    }

    if ($url == '')
    {
      $output.= $name;
    }
    else
    {
      $output.= '
<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">'.$name.'</a>';
    }
  }
  if ($replace_space)
  {
    return replace_space($output);
  }
  else
  {
    return $output;
  }
}

/**
 * returns the list of categories as a HTML string, with cache of names
 *
 * categories string returned contains categories as given in the input
 * array $cat_informations. $uppercats is the list of category ids to
 * display in the right order. If url input parameter is empty, returns only
 * the categories name without links.
 *
 * @param string uppercats
 * @param string url
 * @param boolean replace_space
 * @return string
 */
function get_cat_display_name_cache($uppercats,
                                    $url = 'category.php?cat=',
                                    $replace_space = true)
{
  global $cat_names, $conf;

  if (!isset($cat_names))
  {
    $query = '
SELECT id,name
  FROM '.CATEGORIES_TABLE.'
;';
    $result = pwg_query($query);
    while ($row = mysql_fetch_array($result))
    {
      $cat_names[$row['id']] = $row['name'];
    }
  }
  
  $output = '';
  $is_first = true;
  foreach (explode(',', $uppercats) as $category_id)
  {
    $name = $cat_names[$category_id];
    
    if ($is_first)
    {
      $is_first = false;
    }
    else
    {
      $output.= $conf['level_separator'];
    }

    if ($url == '')
    {
      $output.= $name;
    }
    else
    {
      $output.= '
<a class=""
   href="'.add_session_id(PHPWG_ROOT_PATH.$url.$category_id).'">'.$name.'</a>';
    }
  }
  if ($replace_space)
  {
    return replace_space($output);
  }
  else
  {
    return $output;
  }
}

/**
 * returns the HTML code for a category item in the menu (for category.php)
 *
 * HTML code generated uses logical list tags ul and each category is an
 * item li. The paramter given is the category informations as an array,
 * used keys are : id, name, nb_images, date_last
 *
 * @param array categories
 * @return string
 */
function get_html_menu_category($categories)
{
  global $page, $lang;

  $ref_level = 0;
  $menu = '
             <ul class="menu">';
  
  foreach ($categories as $category)
  {
    $level = substr_count($category['global_rank'], '.');
    if ($level > $ref_level)
    {
      $menu.= '
             <ul class="menu">';
    }
    else if ($level < $ref_level)
    {
      // we may have to close more than one level at the same time...
      $menu.= str_repeat("\n</ul>",($ref_level-$level));
    }
    $ref_level = $level;
    
    $menu.= '

           <li>';
  
    $url = add_session_id(PHPWG_ROOT_PATH.'category.php?cat='.$category['id']);

    $class = '';
    if (isset($page['cat'])
        and is_numeric($page['cat'])
        and $category['id'] == $page['cat'])
    {
      $class = 'menuCategorySelected';
    }
    else
    {
      $class = 'menuCategoryNotSelected';
    }
    switch ($level)
    {
      case 0 :
      {
        $class = 'provenance';
        break;  
      }
      case 1 : 
      {
        $class = 'genre';
        break;  
      }
      case 2 :
      {
        $class = 'espece';
        break;  
      }
      default :
      {
        $class = '';
      }
    }

    if (strstr($category['name'], '"'))
    {
      $class = 'especeGuillemet';
    }
    $menu.= '
           <a href="'.$url.'"
              title="'.$lang['hint_category'].'"
              class="'.$class.'">
             '.$category['name'].'
           </a>';

    if ($category['nb_images'] > 0)
    {
      $menu.= '
             <span class="menuInfoCat"
                   title="'.$category['nb_images'].'
                          '.$lang['images_available'].'">
             ['.$category['nb_images'].']
             </span>
             '.get_icon($category['date_last']);
    }

    $menu.= '</li>';
  }
  
  $menu.= '
             </ul>';
  
  return $menu;
}

/**
 * returns HTMLized comment contents retrieved from database
 *
 * newlines becomes br tags, _word_ becomes underline, /word/ becomes
 * italic, *word* becomes bolded
 *
 * @param string content
 * @return string
 */
function parse_comment_content($content)
{
  $content = nl2br($content);
  
  // replace _word_ by an underlined word
  $pattern = '/_([^\s]*)_/';
  $replacement = '<span style="text-decoration:underline;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);
  
  // replace *word* by a bolded word
  $pattern = '/\*([^\s]*)\*/';
  $replacement = '<span style="font-weight:bold;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);
  
  // replace /word/ by an italic word
  $pattern = '/\/([^\s]*)\//';
  $replacement = '<span style="font-style:italic;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);

  return $content;
}
?>

Je suis désolè de vous relancer sans cesse, mais je suis persuadé qu'il faudrait 3 fois rien pour que ça marche exactement comme je le veux. Vraiment merci.

Hors ligne

#22 2005-11-09 12:17:13

VDigital
Former Piwigo Team
Montpellier (FR)
2005-05-04
15127

Re: [Catégories] Pour un meilleur classement / affichage

Il n'est pas plus simple dans la gestion des catégories du menu Admin, d'éditer le nom de tes catégories et de mettre ou d'enlever tes doubles apostrophes plutôt que de demander les pieds au mur, les mains au parquet, la tête dans l'évier, et le reste au lit.
On va avoir besoin de beaucoup d'apirine avec toi.

Allez sans rancune. 8-)


Vincent -« Plus vidéaste averti que photographe amateur... »
La galerie - Le blog   

Piwigo est une application libre de gestion de photos en ligne.

Hors ligne

#23 2005-11-09 12:59:32

Reflex
Membre
2005-10-16
290

Re: [Catégories] Pour un meilleur classement / affichage

VDigital a écrit:

Il n'est pas plus simple dans la gestion des catégories du menu Admin, d'éditer le nom de tes catégories et de mettre ou d'enlever tes doubles apostrophes

Non, car actuellement il se trouve que les guillemets apparaissent systématiquement:

espèce se transformant en "espèce" (ajout de guillemets & écriture en italique)
&
"espèce" se transformant en ""espèce"" (doublement des guillemets & écriture en italique)


j'ai besoin que:

espèce apparaisse en tant que espèce (pas de guillemets & écriture en italique)
&
"espèce" apparaisse en tant que "espèce" (guillemets existants & écriture normale)


PS: rien n'est souligné ou à souligner dans la galerie.

Hors ligne

#24 2005-11-10 00:13:34

Reflex
Membre
2005-10-16
290

Re: [Catégories] Pour un meilleur classement / affichage

Bon, j'ai enlevé ça de "default.ccs":

Code:

UL.menu A.espece:before {
  content: '"';
}

UL.menu A.espece:after {
  content: '"';

Ce qui fait que je n'ai que les guillemets que je mets moi-même.
Toutes les espèces sont en italique, j'aurais juste besoin que celles qui contiennent des guillemets soient écrites normalement et ce sera parfait...

default.ccs:

Code:

/* BACKGROUND */

body { background-color:#000000;} /*General background color*/
.main, .throw, .admin {  background-color:#3F3F3F;} /*Main background color*/
.row1,input,select,textarea, .table1, .home { background-color:#5F5F5F;} /* Tables & forms */
.table2, .commentTitle { background-color: #797979;} /* Alternate table & comments  */
.errors { background-color:red;} /* Errors display */
.titreMenu,.titrePage,.imgMenu a:hover { background-image: url(theme/tableh1_bg.gif);} /* Titles background image  */
.bouton, .imgMenu a, #imgBarMenu { background-image: url(theme/button_bg.gif);} /* Buttons background image */

/* FONT COLORS */

body { color:#E0E0E0;} /* General font color */
input,select,textarea { color:#FFFFCC;} /* Forms font color */
.titreMenu, .titreMenu a, .info, .admin{ color:#FFF48E;} /* Menu & sections titles */
.titrePage, .titreMenu a:hover { color:#E0E0E0;} /* Page title */
.comment{ color:#C6B78E;} /* Comments */
.commentDate { color:#999999;} /* Comments date */
.throw { color:#FFFFCC;} /* First line of tables */
.bouton, .errors { color:#FFFFFF;} /* Buttons & errors */

/* Update results (admin side only) */
.update_summary_new, .best_gen_time
{ color:#9cb4ce;}

/* Update results (admin side only) */
.update_summary_del,.worst_gen_time
{ color:#ffe1e1;}

/* ANCHORS */

a { text-decoration:none; color:#FFFFFF;}
a:hover { text-decoration:none; color:#FFF48E;}
a.none:hover { text-decoration:none;}
a.image:hover { text-decoration:none;}
a.thumbLink:hover { text-decoration:none;}

/* FONT STYLES */

body /* Main font style */
{
  font-family: Verdana, Geneva, Arial, sans-serif;
  font-size:12px;
  margin:5px;
}

h1 /* H1 tag style (admin side only) */
{
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  text-decoration:none; 
  line-height:  120%;
  font-size:18px;
  font-weight: bold;
}

h2 /* H2 tag style (admin side only) */
{
  font-family: Arial, Helvetica, sans-serif;
  text-decoration:none; 
  line-height:  120%; 
  font-size:12px;
  font-weight: bold;
}

.titreMenu /* Menu titles */
{
  font-size:12px;
  font-weight:600;
}

.titrePage /* Page titles */
{
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  font-weight:600;
  font-size:16px;
}

.commentTitle /* Comments title */
{
  font-family: Arial, Helvetica, sans-serif;
  font-size:12px;
  font-weight:bold;
}

.menu, .thumbnail, .totalImages { font-size:11px;}
.small{ font-size:10px;}
.menuCategorySelected, .throw, .admin, .errors { font-weight:bold;}
.menuCategoryNotSelected, .dateSelected, .pageNumberSelected, .thumb_picture, .thumb_category  { font-weight:normal;}
.commentDate, .bouton  { font-weight:lighter;}
.commentImage { font-style:italic; font-size:16px;}
.nameImage { font-size:20px;}
.info { font-size:16px;}
.copyright { font-size:10px; text-align:center; letter-spacing:-1px;}
div.information {  font-size:14px; font-weight:bold;}

/*----------------------------------------------*/
/* Under this point, do not modify the values   */
/* unless you are aware of what you are doing!  */
/*----------------------------------------------*/

/* POSITION */

#gauche,#droite
{
  float:left;
  width:30%;
  text-align:left;
  white-space:nowrap;
}

#centre
{
  float:left;
  width:39%;
  text-align:center;
}

#droite{text-align:right;}
#left {float:left; }
#right{float:right; }

/* GENERAL LAYOUT STYLES */

.main 
{
  border: 1px solid #E0E0E0; 
  width:100%;
  padding-bottom:30px;
  text-align:center;
  display:block;
}

.home
{
  border: 1px solid #000000;
  display:block;
  text-align:center;
  width:100%;
}

.navigationBar 
{
  text-align:center;
  margin-top:10px;
  margin-bottom:10px;
}

.info 
{
  margin:5px 0px 5px 0px;
  /* white-space:nowrap; */
  text-align:center;
}

.errors 
{
  text-align:left;
  margin-top:5px;
  margin-bottom:5px;
  border:1px solid black;
}

div.information {
  text-align:left;
  margin:10px;
  padding:5px;
}

span.dateSelected, span.pageNumberSelected {
  text-decoration:underline;
}
/* MENU LAYOUT STYLES */

.titreMenu,.titrePage
{
  padding-right: 10px;
  padding-left: 10px;
  border-bottom: 1px solid #000000;
  border-right: 1px solid #000000;
  height: 25px;
  line-height: 25px;
  text-align:center;
}
.titrePage {text-align:left;}

.menu 
{
  margin:10px 5px 10px 5px;
  white-space:nowrap;
  text-align:left;
}

ul.menu 
{
  text-align:left;
  list-style-type: square ;
  padding-left:15px;
  margin:5px;
}

.totalImages {
  text-align:center;
  margin-top:5px;
}

 /* IMAGE LAYOUT STYLES */
 
.image 
{
  border : 3px solid #FFFFFF;
  margin : 10px 4px 10px 4px;
}

#imgBarMenu
{
  width:100%;
  display:block;
  height:25px;
  border-bottom: 1px solid #000000;
}
  
.imgMenu
{
  width:48px;
  border:none;
  float:left;
}

.imgMenu img
{
 border:none;
 text-align:center;
 margin-top:4px;
}
  
.imgMenu a
{
  display:block;
  height: 25px;
  border-bottom: 1px solid #000000;
  border-left: 1px solid #838383;
  border-right: 1px solid #000000;
}

.imgMenu a:hover
{
  border-bottom: 1px solid #3F3F3F;
  border-left: 1px solid #3F3F3F;
  border-right: 1px solid #3F3F3F;
}

.commentImage {
  text-align:justify;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* TABLE LAYOUT STYLES */

.table1
{
  border: 1px solid #000000;
  display:block;
}
  
.table2 {
  border: 1px solid #000000; 
  margin:  0px 10px 0px 0px;
  padding:0px;
}

.tablecompact{
  width:100%;
  border-collapse:collapse;
}

.row1,.row2 {
  text-align:left;
  padding:5px 0px 5px 0px;
  height:20px;
} 

.throw {
  text-align:center;
  border-top: 1px solid #000000; 
  border-bottom: 1px solid #000000; 
  height:20px;
}

td.throw{
  text-align:left;
  width:auto;
}

/* THUMBNAILS LAYOUT STYLES */

.thumbnail {
  text-align:center;
  vertical-align: baseline;
  white-space: nowrap;
}

table.thumbnail {
  border-collapse:separate;
  display:inline-table;
}

.thumbLink {
  border-style: solid;
  border-width:1px;
  border-color: #A0A0A0;
  margin: 2px;
}

/* COMMENTS LAYOUT STYLES */

.commentTitle {  padding: 15px 5px 10px 5px; }
.commentDate {
  text-align:right;
  border-top: 1px solid #000000; 
  border-bottom: 1px solid #000000;
}

/* FORM LAYOUT STYLES */

form
{
  text-align:left;
  padding:10px;
}

.bouton
{
  border: 1px solid #404750;
  padding-left: 3px;
  padding-right: 3px;
  background-position : bottom;
  margin-top:10px;
}

input,select,textarea 
{
 text-indent:2px;
 border: 1px solid #797979;
 padding: 0;
}

.radio{  border:0;}

/* ADMIN LAYOUT STYLES */

.adminMenu 
{
  text-align:center;
  font-size:12px;
}

div.adminMenu{ margin:10px 50px 10px 50px; }

.admin 
{
margin:0px 0px 12px 0px;
text-align: center;
padding:0px;
}

div.remoteOutput, div.remoteLocal {
  border:1px solid black;
  margin:10px;
  text-align:left;
  padding:5px;
}

div.remoteLocal {
  text-align:center;
}

/* for debugging purpose */
pre { text-align:left; }

UL.menu A.provenance {
  font-weight: bold;
}

UL.menu A.genre {
  font-style: italic;
}

UL.menu A.especeGuillemet {
  font-style: normal;
  font-weight: normal;
}
 
UL.menu A.espece {
  font-style: italic;
}

functions_html.inc.php:

Code:

<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery                           |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch        : BSF (Best So Far)
// | file          : $RCSfile: functions_html.inc.php,v $
// | last update   : $Date: 2005/01/08 00:18:39 $
// | last modifier : $Author: plg $
// | revision      : $Revision: 1.22 $
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

function get_icon( $date )
{
  global $user, $conf, $lang;

  if (!preg_match('/\d{4}-\d{2}-\d{2}/', $date))
  {
    return '';
  }

  list( $year,$month,$day ) = explode( '-', $date );
  $unixtime = mktime( 0, 0, 0, $month, $day, $year );
  
  $diff = time() - $unixtime;
  $day_in_seconds = 24*60*60;
  $output = '';
  $title = $lang['recent_image'].'&nbsp;';
  if ( $diff < $user['recent_period'] * $day_in_seconds )
  {
    $icon_url = './template/'.$user['template'].'/theme/';
    $icon_url.= 'recent.gif';
    $title .= $user['recent_period'];
    $title .=  '&nbsp;'.$lang['days'];
    $size = getimagesize( $icon_url );
    $output = '<img title="'.$title.'" src="'.$icon_url.'" style="border:0;';
    $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
  }
  return $output;
}

function create_navigation_bar($url, $nb_element, $start,
                               $nb_element_page, $link_class)
{
  global $lang, $conf;

  $pages_around = $conf['paginate_pages_around'];
  
  $navbar = '';
  
  // current page detection
  if (!isset($start)
      or !is_numeric($start)
      or (is_numeric($start) and $start < 0))
  {
    $start = 0;
  }
  
  // navigation bar useful only if more than one page to display !
  if ($nb_element > $nb_element_page)
  {
    // current page and last page
    $cur_page = ceil($start / $nb_element_page) + 1;
    $maximum = ceil($nb_element / $nb_element_page);

    // link to first page ?
    if ($cur_page != 1)
    {
      $navbar.= '<a href="';
      $navbar.= add_session_id($url.'&amp;start=0');
      $navbar.= '" class="'.$link_class.'">'.$lang['first_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['first_page'];
    }
    $navbar.= ' | ';
    // link on previous page ?
    if ( $start != 0 )
    {
      $previous = $start - $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id( $url.'&amp;start='.$previous );
      $navbar.= '" class="'.$link_class.'">'.$lang['previous_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['previous_page'];
    }
    $navbar.= ' | ';

    if ($cur_page > $pages_around + 1)
    {
      $navbar.= '&nbsp;<a href="';
      $navbar.= add_session_id($url.'&amp;start=0');
      $navbar.= '" class="'.$link_class.'">1</a>';
      if ($cur_page > $pages_around + 2)
      {
        $navbar.= ' ...';
      }
    }
    
    // inspired from punbb source code
    for ($i = $cur_page - $pages_around, $stop = $cur_page + $pages_around + 1;
         $i < $stop;
         $i++)
    {
      if ($i < 1 or $i > $maximum)
      {
        continue;
      }
      else if ($i != $cur_page)
      {
        $temp_start = ($i - 1) * $nb_element_page;
        $navbar.= '&nbsp;<a href="';
        $navbar.= add_session_id($url.'&amp;start='.$temp_start);
        $navbar.= '" class="'.$link_class.'">'.$i.'</a>';
      }
      else
      {
        $navbar.= '&nbsp;<span class="pageNumberSelected">';
        $navbar.= $i.'</span>';
      }
    }

    if ($cur_page < ($maximum - $pages_around))
    {
      $temp_start = ($maximum - 1) * $nb_element_page;
      if ($cur_page < ($maximum - $pages_around - 1))
      {
        $navbar.= ' ...';
      }
      $navbar.= ' <a href="';
      $navbar.= add_session_id($url.'&amp;start='.$temp_start);
      $navbar.= '" class="'.$link_class.'">'.$maximum.'</a>';
    }
    
    $navbar.= ' | ';
    // link on next page ?
    if ( $nb_element > $nb_element_page
         && $start + $nb_element_page < $nb_element )
    {
      $next = $start + $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id( $url.'&amp;start='.$next );
      $navbar.= '" class="'.$link_class.'">'.$lang['next_page'].'</a>';
    }
    else
    {
      $navbar.= $lang['next_page'];
    }
    
    $navbar.= ' | ';
    // link to last page ?
    if ($cur_page != $maximum)
    {
      $temp_start = ($maximum - 1) * $nb_element_page;
      $navbar.= '<a href="';
      $navbar.= add_session_id($url.'&amp;start='.$temp_start);
      $navbar.= '" class="'.$link_class.'">'.$lang['last_page'];
      $navbar.= '</a>';
    }
    else
    {
      $navbar.= $lang['last_page'];
    }
  }
  return $navbar;
}

//
// Pick a language, any language ...
//
function language_select($default, $select_name = "language")
{
  $available_lang = get_languages();

  $lang_select = '<select name="' . $select_name . '" onchange="this.form.submit()">';
  foreach ($available_lang as $code => $displayname)
  {
    $selected = ( strtolower($default) == strtolower($code) ) ? ' selected="selected"' : '';
    $lang_select .= '<option value="' . $code . '"' . $selected . '>' . ucwords($displayname) . '</option>';
  }
  $lang_select .= '</select>';

  return $lang_select;
}

//
// Pick a template/theme combo, 
//
function style_select($default_style, $select_name = "style")
{
  $templates = get_templates();

  $style_selected = '<select name="' . $select_name . '" >';
  foreach ($templates as $template)
  {
    $selected = ( $template == $default_style ) ? ' selected="selected"' : '';
    $style_selected.= '<option value="'.$template.'"'.$selected.'>';
    $style_selected.= $template.'</option>';
  }
  $style_selected .= '</select>';
  return $style_selected;
}

/**
 * returns the list of categories as a HTML string
 *
 * categories string returned contains categories as given in the input
 * array $cat_informations. $cat_informations array must be an association
 * of {category_id => category_name}. If url input parameter is empty,
 * returns only the categories name without links.
 *
 * @param array cat_informations
 * @param string url
 * @param boolean replace_space
 * @return string
 */
function get_cat_display_name($cat_informations,
                              $url = 'category.php?cat=',
                              $replace_space = true)
{
  global $conf;
  
  $output = '';
  $is_first = true;
  foreach ($cat_informations as $id => $name)
  {
    if ($is_first)
    {
      $is_first = false;
    }
    else
    {
      $output.= $conf['level_separator'];
    }

    if ($url == '')
    {
      $output.= $name;
    }
    else
    {
      $output.= '
<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">'.$name.'</a>';
    }
  }
  if ($replace_space)
  {
    return replace_space($output);
  }
  else
  {
    return $output;
  }
}

/**
 * returns the list of categories as a HTML string, with cache of names
 *
 * categories string returned contains categories as given in the input
 * array $cat_informations. $uppercats is the list of category ids to
 * display in the right order. If url input parameter is empty, returns only
 * the categories name without links.
 *
 * @param string uppercats
 * @param string url
 * @param boolean replace_space
 * @return string
 */
function get_cat_display_name_cache($uppercats,
                                    $url = 'category.php?cat=',
                                    $replace_space = true)
{
  global $cat_names, $conf;

  if (!isset($cat_names))
  {
    $query = '
SELECT id,name
  FROM '.CATEGORIES_TABLE.'
;';
    $result = pwg_query($query);
    while ($row = mysql_fetch_array($result))
    {
      $cat_names[$row['id']] = $row['name'];
    }
  }
  
  $output = '';
  $is_first = true;
  foreach (explode(',', $uppercats) as $category_id)
  {
    $name = $cat_names[$category_id];
    
    if ($is_first)
    {
      $is_first = false;
    }
    else
    {
      $output.= $conf['level_separator'];
    }

    if ($url == '')
    {
      $output.= $name;
    }
    else
    {
      $output.= '
<a class=""
   href="'.add_session_id(PHPWG_ROOT_PATH.$url.$category_id).'">'.$name.'</a>';
    }
  }
  if ($replace_space)
  {
    return replace_space($output);
  }
  else
  {
    return $output;
  }
}

/**
 * returns the HTML code for a category item in the menu (for category.php)
 *
 * HTML code generated uses logical list tags ul and each category is an
 * item li. The paramter given is the category informations as an array,
 * used keys are : id, name, nb_images, date_last
 *
 * @param array categories
 * @return string
 */
function get_html_menu_category($categories)
{
  global $page, $lang;

  $ref_level = 0;
  $menu = '
             <ul class="menu">';
  
  foreach ($categories as $category)
  {
    $level = substr_count($category['global_rank'], '.');
    if ($level > $ref_level)
    {
      $menu.= '
             <ul class="menu">';
    }
    else if ($level < $ref_level)
    {
      // we may have to close more than one level at the same time...
      $menu.= str_repeat("\n</ul>",($ref_level-$level));
    }
    $ref_level = $level;
    
    $menu.= '

           <li>';
  
    $url = add_session_id(PHPWG_ROOT_PATH.'category.php?cat='.$category['id']);

    $class = '';
    if (isset($page['cat'])
        and is_numeric($page['cat'])
        and $category['id'] == $page['cat'])
    {
      $class = 'menuCategorySelected';
    }
    else
    {
      $class = 'menuCategoryNotSelected';
    }
    switch ($level)
    {
      case 0 :
      {
        $class = 'provenance';
        break;  
      }
      case 1 : 
      {
        $class = 'genre';
        break;  
      }
      case 2 :
      {
        $class = 'espece';
        break;  
      }
      default :
      {
        $class = '';
      }
    }

    if (strstr($category['name'], '"'))
    {
      $class = 'especeGuillemet';
    }
    $menu.= '
           <a href="'.$url.'"
              title="'.$lang['hint_category'].'"
              class="'.$class.'">
             '.$category['name'].'
           </a>';

    if ($category['nb_images'] > 0)
    {
      $menu.= '
             <span class="menuInfoCat"
                   title="'.$category['nb_images'].'
                          '.$lang['images_available'].'">
             ['.$category['nb_images'].']
             </span>
             '.get_icon($category['date_last']);
    }

    $menu.= '</li>';
  }
  
  $menu.= '
             </ul>';
  
  return $menu;
}

/**
 * returns HTMLized comment contents retrieved from database
 *
 * newlines becomes br tags, _word_ becomes underline, /word/ becomes
 * italic, *word* becomes bolded
 *
 * @param string content
 * @return string
 */
function parse_comment_content($content)
{
  $content = nl2br($content);
  
  // replace _word_ by an underlined word
  $pattern = '/_([^\s]*)_/';
  $replacement = '<span style="text-decoration:underline;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);
  
  // replace *word* by a bolded word
  $pattern = '/\*([^\s]*)\*/';
  $replacement = '<span style="font-weight:bold;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);
  
  // replace /word/ by an italic word
  $pattern = '/\/([^\s]*)\//';
  $replacement = '<span style="font-style:italic;">\1</span>';
  $content = preg_replace($pattern, $replacement, $content);

  return $content;
}
?>

Merci à ceux qui voudront bien m'aider à conclure...  :D

Hors ligne

  •  » Utilisation
  •  » [Catégories] Pour un meilleur classement / affichage

Pied de page des forums

Propulsé par FluxBB

github twitter newsletter Faire un don Piwigo.org © 2002-2024 · Contact