Annonce

#1 2004-04-04 13:42:31

Marc 77
Membre
Nemours, France
2003-01-04
391

Lenteur

Bonjour,
Mon site existe depuis 10 mois et je constate depuis un certain temps une lenteur dans l'ouverture du lien "Miniatures" puis "Mise à jour".
Il se passe des fois 15 à 30 secondes avant le retour d'informations.
Je suis en adsl 1024 et je n'ai pas de problème de vitesse avec le forum PhpBB hébergé sur le même serveur (Haisoft).
D'où peut venir le problème?

http://www.dimage-a1.com

Je précise que quand je fait "tout mettre à jour", si je n'attend pas la confirmation la mise à jour est quand même faite.


BSF Test
Dimage A1 AMD 2200Win XP Pro + SP2 PhpWg 1.3.2 IE 6

Hors ligne

#2 2004-04-04 17:16:57

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

Re: Lenteur

en même temps, tu utilises une version RC, passes à une version finale, 1.3.1 de préférence. (utilises l'outil de mise à jour de 1.3.0 vers 1.3.1)


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

Hors ligne

#3 2004-04-05 16:14:35

Marc 77
Membre
Nemours, France
2003-01-04
391

Re: Lenteur

C'est fait, mais dans la page Identification.php j'ai une double entête de "header.htm". Puis une fois fois identifié j'ai au dessus de l'entête le message:
Erreur de session n° SESSION4:
La variable home_url que vous souhaitez valoriser n'existe pas dans la zone |root|.
Pour plus d'informations, consultez la doc en ligne

La seule modif que j'ai faite est de recharger l'ancien template avec l'ancien fichier header.htm.
http://www.dimage-a1.com/Gallery/identification.php

Login: Marc77  Mdp 227722  (ce n'est pas un compte admin)


BSF Test
Dimage A1 AMD 2200Win XP Pro + SP2 PhpWg 1.3.2 IE 6

Hors ligne

#4 2004-04-05 16:33:27

Webabar
Membre
France
2004-03-24
214

Re: Lenteur

Pour ta variable home_url, le parser gueule seulement sur la page category.php, bien que l'entete soit en double sur toutes les pages...

Mais les modifs, tu ne les as faites que dans header.html ?

Tu pourrais nous envoyer le code de ta page et du template stp (juste le debut, ca devrait etre suffisant...) ?
Et celui du header.html ?


Y'a des détails qui trompent pas...
Ma galerie PWG :
http://pagesperso.laposte.net/cezanne92/

Hors ligne

#5 2004-04-05 18:43:33

Marc 77
Membre
Nemours, France
2003-01-04
391

Re: Lenteur

Pour le header.htm:

<!-- header -->

<ul>
    <p align="left"><img src="http://www.dimage-a1.com/Gallery/a1.gif" width="250" height="177" border="0">                 <span style="font-size:36pt;"><i><font color="gray">Galerie
    A1, A2</font></i></span></p>
    <hr>
    <p align="left"> <a href="http://www.dimage-a1.com/"><b><i><span style="font-size:18pt;"><font color="gray" face="Times New Roman">Dimage
    A1.com </font></span></i></b></a><font color="gray" face="Times New Roman"><b><i><span style="font-size:18pt;">    </span></i></b></font><a href="http://www.dimage-a1.com/Forum/index.php"><b><i><span style="font-size:18pt;"><font color="gray" face="Times New Roman">Forum</font></span></i></b></a></p>
</ul>

Je l'utilisai tel quel avec la RC 1.3 sans problème. Pour l'autre code, quel fichier veux tu?


BSF Test
Dimage A1 AMD 2200Win XP Pro + SP2 PhpWg 1.3.2 IE 6

Hors ligne

#6 2004-04-06 10:04:23

Webabar
Membre
France
2004-03-24
214

Re: Lenteur

Par exemple category.php et .vtp (vu que c'est lui qui envoie un msg d'erreur...)

Tu aurais pas 2 fois un include du header.html ?


Y'a des détails qui trompent pas...
Ma galerie PWG :
http://pagesperso.laposte.net/cezanne92/

Hors ligne

#7 2004-04-06 13:01:13

Marc 77
Membre
Nemours, France
2003-01-04
391

Re: Lenteur

Categorie.vtp dans "Themes":

Code:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset={#charset}" />
    {#style}
    <title>{#title}</title>
  </head>
  <body>
    {#header}
    <table style="width:100%;">
      <tr>
        <td valign="top" style="width:1%;padding:10px;">
          {#frame_start}100%{#frame_begin}
            <div class="titreMenu">{#categories}</div>
            <div class="menu">
              <!--VTP_category-->{#indent}<!--VTP_bullet_w_link--><a href="{#bullet_link}"><img src="{#bullet_url}" style="border:none;" alt=">" /></a><!--/VTP_bullet_w_link--><!--VTP_bullet_wo_link--><img src="{#bullet_url}" style="border:none;" alt=">" /><!--/VTP_bullet_wo_link--> <a href="{#link_url}"><span title="{#hint_category}" style="{#name_style}">{#link_name}</span> <span class="menuInfoCat">[ <!--VTP_subcat--><span title="{#nb_subcats} {#sub-cat}">{#nb_subcats}</span> - <!--/VTP_subcat--><span title="{#total_cat} {#images_available}">{#total_cat}</span> ]</span></a>{#cat_icon}<br />
              <!--/VTP_category-->
              <div class="totalImages">[ {#nb_total_pictures} {#total} ]</div>
              <!--VTP_favorites-->
              <br /> <img src="{#lien_collapsed}" al=">" /> <a href="{#url}"><span title="{#favorite_cat_hint}" style="font-weight:bold;">{#favorite_cat}</span></a> <span class="menuInfoCat">[ {#nb_favorites} ]</span>
              <!--/VTP_favorites-->
              <br /> <img src="{#lien_collapsed}" al=">" /> <span style="font-weight:bold;">{#stats}</span></a>
              <br />     <img src="{#lien_collapsed}" al=">" /> <a href="{#most_visited_url}"><span title="{#most_visited_cat_hint}" style="font-weight:bold;">{#top_number} {#most_visited_cat}</span></a>
              <br />     <img src="{#lien_collapsed}" al=">" /> <a href="{#recent_url}"><span title="{#recent_cat_hint}" style="font-weight:bold;">{#recent_cat}</span></a> {#icon_short}
            </div>
          {#frame_end}
          <div style="margin-bottom:5px;"> </div>
          {#frame_start}100%{#frame_begin}
            <div class="titreMenu">{#title_menu}</div>
            <div class="menu">
              <!--VTP_summary-->
               <img src="{#lien_collapsed}" alt=">"/> <a href="{#url}" title="{#title}">{#name}</a><br />
              <!--/VTP_summary-->
              <!--VTP_upload-->
             <br /> <img src="{#lien_collapsed}" alt=">"/> <a href="{#url}" class="back" style="color:red;">{#upload_picture}</a>
              <!--/VTP_upload-->
            </div>
          {#frame_end}
        </td>
        <td style="padding:5px;width:99%;" valign="top">
          <table style="width:100%;">
            <tr>
              <td align="center">
                {#frame_start}1%{#frame_begin}
                  <div class="titrePage">{#cat_title}</div>
                {#frame_end}
                <div style="margin-bottom:5px;"> </div>
                <!--VTP_thumbnails-->
                <table class="thumbnail">
                  <!--VTP_line-->
                  <tr>
                    <!--VTP_thumbnail-->
                    <td valign="bottom" class="thumbnail">
                      <a href="{#url}" class="back">
                      <img src="{#src}"
                           alt="{#alt}"
                           title="{#title}"
                           class="imgLink"/><br />
                      {#name}
                      </a>
                      {#icon}
                      <!--VTP_nb_comments-->
                      <br />{#nb} {#comments}
                      <!--/VTP_nb_comments-->
                    </td>
                    <!--/VTP_thumbnail-->
                  </tr>
                  <!--/VTP_line-->
                </table>
                <!--/VTP_thumbnails-->
              </td>
            </tr>
            <tr>
              <td align="left">
                <!--VTP_cat_infos-->
                  <!--VTP_navigation-->
                  <div class="navigationBar">{#navigation_bar}</div>
                  <!--/VTP_navigation-->
                  <!--VTP_comment-->
                  <div class="comments">{#cat_comment}</div>
                  <!--/VTP_comment-->
                  <div class="infoCat">
                  {#nb_image_category} "{#cat_name}" : {#cat_nb_images}
                  </div>
                <!--/VTP_cat_infos-->
              </td>
            </tr>
            <tr>
              <td align="right">
                {#frame_start}1%{#frame_begin}
                  <div class="info">
                    {#connected_user} {#username}<br />
                    {#recent_image} {#short_period} {#days}
                      {#icon_short}<br />
                    {#recent_image} {#long_period} {#days}
                      {#icon_long}<br />
                    {#send_mail} <a href="mailto:{#mail_webmaster}?subject={#title_send_mail}"><span style="font-weight:bold;">{#webmaster}</span></a>
                  </div>
                {#frame_end}
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <div class="copyright">{#generation_time} {#time}</div>
    <!-- Please, do not remove this copyright. If you really want to,
         contact me pierrick@z0rglub.com to find a solution on how
         to show the origin of the script...-->
    <div class="copyright">Powered by <a href="{#site_url}" class="back">PhpWebGallery</a> {#version}</div>
    {#footer}
  </body>
</html>

Categorie.php à la racine de PhpWebGallery:

Code:

<?php
/***************************************************************************
 *                               category.php                              *
 *                            -------------------                          *
 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
 *                                                                         *
 *   $Id: category.php,v 1.23.2.11 2004/02/27 17:36:55 z0rglub Exp $
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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;                                         *
 *                                                                         *
 ***************************************************************************/
//----------------------------------------------------------- personnal include
include_once( './include/init.inc.php' );
//---------------------------------------------------------------------- logout
if ( isset( $_GET['act'] )
     and $_GET['act'] == 'logout'
     and isset( $_COOKIE['id'] ) )
{
  // cookie deletion if exists
  setcookie( 'id', '', 0, cookie_path() );
  $url = 'category.php';
  header( 'Request-URI: '.$url );  
  header( 'Content-Location: '.$url );  
  header( 'Location: '.$url );
  exit();
}
//-------------------------------------------------- access authorization check
if ( isset( $_GET['cat'] ) ) check_cat_id( $_GET['cat'] );
check_login_authorization();
if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
{
  check_restrictions( $page['cat'] );
}
//-------------------------------------------------------------- initialization
// detection of the start picture to display
if ( !isset( $_GET['start'] )
     or !is_numeric( $_GET['start'] )
     or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
  $page['start'] = 0;
else
  $page['start'] = $_GET['start'];
// Sometimes, a "num" is provided in the URL. It is the number
// of the picture to show. This picture must be in the thumbnails page.
// We have to find the right $page['start'] that show the num picture
// in this category
if ( isset( $_GET['num'] )
     and is_numeric( $_GET['num'] )
     and $_GET['num'] >= 0 )
{
  $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] );
  $page['start']*= $user['nb_image_page'];
}

initialize_category();

// creation of the array containing the cat ids to expand in the menu
// $page['tab_expand'] contains an array with the category ids
// $page['expand'] contains the string to display in URL with comma
$page['tab_expand'] = array();
if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' )
{
  $tab_expand = explode( ',', $_GET['expand'] );
  foreach ( $tab_expand as $id ) {
    if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id );
  }
}
if ( isset($page['cat']) && is_numeric( $page['cat'] ) )
{
  // the category displayed (in the URL cat=23) must be seen in the menu ->
  // parent categories must be expanded
  $uppercats = explode( ',', $page['uppercats'] );
  foreach ( $uppercats as $uppercat ) {
    array_push( $page['tab_expand'], $uppercat );
  }
}
$page['tab_expand'] = array_unique( $page['tab_expand'] );
$page['expand'] = implode( ',', $page['tab_expand'] );
// in case of expanding all authorized cats
// The $page['expand'] equals 'all' and
// $page['tab_expand'] contains all the authorized cat ids
if ( $user['expand']
     or ( isset( $_GET['expand'] ) and $_GET['expand'] == 'all' ) )
{
  $page['tab_expand'] = array();
  $page['expand'] = 'all';
}
// creating the structure of the categories (useful for displaying the menu)
// creating the plain structure : array of all the available categories and
// their relative informations, see the definition of the function
// get_user_plain_structure for further details.
$page['plain_structure'] = get_user_plain_structure();
$page['structure'] = create_user_structure( '' );
$page['structure'] = update_structure( $page['structure'] );

//----------------------------------------------------- template initialization

//
// Start output of page
//
$title = $page['title'];
include('include/page_header.php');

$handle = $vtp->Open( './template/'.$user['template'].'/category.vtp' );
initialize_template();
$tpl = array(
  'categories','hint_category','sub-cat','images_available','total',
  'title_menu','nb_image_category','send_mail','title_send_mail',
  'connected_user','recent_image','days',
  'favorite_cat_hint','favorite_cat','stats','most_visited_cat_hint',
  'most_visited_cat','recent_cat','recent_cat_hint','upload_picture',
  'comments' );
templatize_array( $tpl, 'lang', $handle );

$tpl = array( 'mail_webmaster','webmaster','top_number');
templatize_array( $tpl, 'conf', $handle );

$tpl = array( 'short_period','long_period','lien_collapsed', 'username' );
templatize_array( $tpl, 'user', $handle );

$tpl = array( 'navigation_bar','cat_comment','cat_nb_images' );
templatize_array( $tpl, 'page', $handle );

// special global template vars
$vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) );
$icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) );
$vtp->setGlobalVar( $handle, 'icon_long', $icon_long );
$nb_total_pictures = count_user_total_images();
$vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures );

//------------------------------------------------------------- categories menu
$vtp->setVar( $handle, 'home_url', add_session_id( 'category.php' ) );
// normal categories
foreach ( $page['structure'] as $category ) {
  // display category is a function relative to the template
  display_category( $category, ' ', $handle );
}
// favorites cat
if ( !$user['is_the_guest'] )
{
  $vtp->addSession( $handle, 'favorites' );
  $url = './category.php?cat=fav&expand='.$page['expand'];
  $vtp->setVar( $handle, 'favorites.url', add_session_id( $url ) );
  // searching the number of favorite picture
  $query = 'SELECT COUNT(*) AS count';
  $query.= ' FROM '.PREFIX_TABLE.'favorites';
  $query.= ' WHERE user_id = '.$user['id'].';';
  $result = mysql_query( $query );
  $row = mysql_fetch_array( $result );
  $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] );
  $vtp->closeSession( $handle, 'favorites' );
}
// most visited pictures category
$url = './category.php?cat=most_visited&expand='.$page['expand'];
$vtp->setGlobalVar( $handle, 'most_visited_url', add_session_id( $url ) );
// recent pictures
$url = './category.php?cat=recent&expand='.$page['expand'];
$vtp->setGlobalVar( $handle, 'recent_url', add_session_id( $url ) );
//--------------------------------------------------------------------- summary
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.url', './identification.php' );
if ( !$user['is_the_guest'] )
{
  $vtp->setVar( $handle, 'summary.title', '' );
  $vtp->setVar( $handle, 'summary.name',replace_space($lang['change_login']));
}
else
{
  $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] );
  $vtp->setVar( $handle, 'summary.name',  replace_space( $lang['menu_login']));
}
$vtp->closeSession( $handle, 'summary' );
// links for registered users
if ( !$user['is_the_guest'] )
{
  // logout link
  $vtp->addSession( $handle, 'summary' );
  $vtp->setVar( $handle, 'summary.url', './category.php?act=logout' );
  $vtp->setVar( $handle, 'summary.title', '' );
  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) );
  $vtp->closeSession( $handle, 'summary' );
  // customization link
  $vtp->addSession( $handle, 'summary' );
  $url = './profile.php';
  if (isset($page['cat']) && isset($page['expand']))
    $url.='?cat='.$page['cat'].'&expand='.$page['expand'];
  if ( isset($page['cat']) && $page['cat'] == 'search' )
  {
    $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
  }
  $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) );
  $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] );
  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) );
  $vtp->closeSession( $handle, 'summary' );
}
// search link
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) );
$vtp->setVar( $handle, 'summary.title', $lang['hint_search'] );
$vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) );
$vtp->closeSession( $handle, 'summary' );
// comments link
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.url', add_session_id( './comments.php' ) );
$vtp->setVar( $handle, 'summary.title', $lang['hint_comments'] );
$vtp->setVar( $handle, 'summary.name', replace_space( $lang['comments'] ) );
$vtp->closeSession( $handle, 'summary' );
// about link
$vtp->addSession( $handle, 'summary' );
$vtp->setVar( $handle, 'summary.url', './about.php?'.
              str_replace( '&', '&', $_SERVER['QUERY_STRING'] ) );
$vtp->setVar( $handle, 'summary.title', $lang['hint_about'] );
$vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) );
$vtp->closeSession( $handle, 'summary' );
// administration link
if ( $user['status'] == 'admin' )
{
  $vtp->addSession( $handle, 'summary' );
  $vtp->setVar( $handle, 'summary.url',
                add_session_id( './admin/admin.php' ) );
  $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] );
  $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) );
  $vtp->closeSession( $handle, 'summary' );
}
//-------------------------------------------------------------- category title
if ( isset ( $page['cat'] ) )
{
  if ( is_numeric( $page['cat'] ) )
  {
    $cat_title = get_cat_display_name( $page['cat_name'], '<br />',
                                    'font-style:italic;' );
    $vtp->setGlobalVar( $handle, "cat_title", $cat_title );
  }
  else
  {
    if ( $page['cat'] == 'search' )
    {
      $page['title'].= ' : <span style="font-style:italic;">';
      $page['title'].= $_GET['search']."</span>";
    }
    $page['title'] = replace_space( $page['title'] );
    $vtp->setGlobalVar( $handle, "cat_title", $page['title'] );
  }
}
else
{
  $vtp->setGlobalVar( $handle, "cat_title",
                      replace_space( $lang['no_category'] ) );
}
//------------------------------------------------------------------ thumbnails
if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 )
{
  $array_cat_directories = array();
  
  $query = 'SELECT distinct(id),file,date_available,tn_ext,name,filesize';
  $query.= ',storage_category_id';
  $query.= ' FROM '.PREFIX_TABLE.'images AS i';
  $query.=' INNER JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id';
  $query.= $page['where'];
  $query.= $conf['order_by'];
  $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page'];
  $query.= ';';
  $result = mysql_query( $query );

  $vtp->addSession( $handle, 'thumbnails' );
  $vtp->addSession( $handle, 'line' );
  // iteration counter to use a new <tr> every "$nb_image_line" pictures
  $cell_number = 1;
  // iteration counter to be sure not to create too much lines in the table
  $line_number = 1;
  while ( $row = mysql_fetch_array( $result ) )
  {
    // retrieving the storage dir of the picture
    if ( !isset($array_cat_directories[$row['storage_category_id']]))
    {
      $array_cat_directories[$row['storage_category_id']] =
        get_complete_dir( $row['storage_category_id'] );
    }
    $cat_directory = $array_cat_directories[$row['storage_category_id']];

    $file = get_filename_wo_extension( $row['file'] );
    // name of the picture
    if ( isset( $row['name'] ) and $row['name'] != '' ) $name = $row['name'];
    else $name = str_replace( '_', ' ', $file );

    if ( $page['cat'] == 'search' )
    {
      $name = replace_search( $name, $_GET['search'] );
    }
    // thumbnail url
    $thumbnail_url = $cat_directory;
    $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail'];
    $thumbnail_url.= $file.'.'.$row['tn_ext'];
    // message in title for the thumbnail
    $thumbnail_title = $row['file'];
    if ( $row['filesize'] == '' )
      $poids = floor( filesize( $cat_directory.$row['file'] ) / 1024 );
    else
      $poids = $row['filesize'];
    $thumbnail_title .= ' : '.$poids.' KB';
    // url link on picture.php page
    $url_link = './picture.php?cat='.$page['cat'];
    $url_link.= '&image_id='.$row['id'].'&expand='.$page['expand'];
    if ( $page['cat'] == 'search' )
    {
      $url_link.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
    }
    // date of availability for creation icon
    list( $year,$month,$day ) = explode( '-', $row['date_available'] );
    $date = mktime( 0, 0, 0, $month, $day, $year );
    // sending vars to display
    $vtp->addSession( $handle, 'thumbnail' );
    $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
    $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url );
    $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] );
    $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
    $vtp->setVar( $handle, 'thumbnail.name', $name );
    $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );

    if ( $conf['show_comments'] and $user['show_nb_comments'] )
    {
      $vtp->addSession( $handle, 'nb_comments' );
      $query = 'SELECT COUNT(*) AS nb_comments';
      $query.= ' FROM '.PREFIX_TABLE.'comments';
      $query.= ' WHERE image_id = '.$row['id'];
      $query.= " AND validated = 'true'";
      $query.= ';';
      $row = mysql_fetch_array( mysql_query( $query ) );
      $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] );
      $vtp->closeSession( $handle, 'nb_comments' );
    }
    
    $vtp->closeSession( $handle, 'thumbnail' );
    
    if ( $cell_number++ == $user['nb_image_line'] )
    {
      // creating a new line
      $vtp->closeSession( $handle, 'line' );
      // the number of the next cell is 1
      $cell_number = 1;
      // we only create a new line if it does not exceed the maximum line
      // per page for the logged user
      if ( $line_number++ < $user['nb_line_page'] )
      {
        $vtp->addSession( $handle, 'line' );
      }
    }
  }
  $vtp->closeSession( $handle, 'thumbnails' );
}
//-------------------------------------------------------------- empty category
elseif ( ( isset( $page['cat'] )
           and is_numeric( $page['cat'] )
           and $page['cat_nb_images'] == 0
           and $page['plain_structure'][$page['cat']]['nb_sub_categories'] > 0)
         or (!isset($_GET['cat'])))
{
  $vtp->addSession( $handle, 'thumbnails' );
  $vtp->addSession( $handle, 'line' );

  $subcats=array();
  if (isset($page['cat'])) $subcats = get_non_empty_subcat_ids( $page['cat'] );
  else                     $subcats = get_non_empty_subcat_ids( '' );
  $cell_number = 1;
  $i = 0;
  foreach ( $subcats as $subcat_id => $non_empty_id ) {
    $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"';
    $name.= ' alt=">"/> ';
    $name.= '[ <span style="font-weight:bold;">';
    $name.= $page['plain_structure'][$subcat_id]['name'];
    $name.= '</span> ]';

    // searching the representative picture of the category
    $query = 'SELECT representative_picture_id';
    $query.= ' FROM '.PREFIX_TABLE.'categories';
    $query.= ' WHERE id = '.$non_empty_id;
    $query.= ';';
    $row = mysql_fetch_array( mysql_query( $query ) );
    
    $query = 'SELECT file,tn_ext,storage_category_id';
    $query.= ' FROM '.PREFIX_TABLE.'images, '.PREFIX_TABLE.'image_category';
    $query.= ' WHERE category_id = '.$non_empty_id;
    $query.= ' AND id = image_id';
    // if the category has a representative picture, this is its thumbnail
    // that will be displayed !
    if ( isset( $row['representative_picture_id'] ) )
      $query.= ' AND id = '.$row['representative_picture_id'];
    else
      $query.= ' ORDER BY RAND()';
    $query.= ' LIMIT 0,1';
    $query.= ';';
    $image_result = mysql_query( $query );
    $image_row    = mysql_fetch_array( $image_result );

    $file = get_filename_wo_extension( $image_row['file'] );

    // creating links for thumbnail and associated category
    $thumbnail_link = get_complete_dir( $image_row['storage_category_id'] );
    $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail'];
    $thumbnail_link.= $file.'.'.$image_row['tn_ext'];

    $thumbnail_title = $lang['hint_category'];

    $url_link = './category.php?cat='.$subcat_id;
    if ( isset($page['cat'])&& !in_array( $page['cat'], $page['tab_expand'] ) )
    {
      array_push( $page['tab_expand'], $page['cat'] );
      $page['expand'] = implode( ',', $page['tab_expand'] );
    }
    $url_link.= '&expand='.$page['expand'];
    // we add the category to explore in the expand list
    if ( $page['expand'] != '' ) $url_link.= ',';
    $url_link.= $subcat_id;

    $date = $page['plain_structure'][$subcat_id]['date_last'];

    // sending vars to display
    $vtp->addSession( $handle, 'thumbnail' );
    $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) );
    $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_link );
    $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] );
    $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title );
    $vtp->setVar( $handle, 'thumbnail.name', $name );
    $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) );
    $vtp->closeSession( $handle, 'thumbnail' );

    if ( $cell_number++ == $user['nb_image_line'] )
    {
      $vtp->closeSession( $handle, 'line' );
      $cell_number = 1;
      // we open a new line if the subcat was not the last one
      if ( $i++ < count( $subcats ) - 1 )
      {
        $vtp->addSession( $handle, 'line' );
      }
    }
  }
  if ( $i < count( $subcats ) - 1 )
  {
    $vtp->closeSession( $handle, 'line' );
  }
  $vtp->closeSession( $handle, 'thumbnails' );
}
//------------------------------------------------------- category informations
if ( isset ( $page['cat'] ) )
{
  $vtp->addSession( $handle, 'cat_infos' );
  // navigation bar
  if ( $page['navigation_bar'] != '' )
  {
    $vtp->addSession( $handle, 'navigation' );
    $vtp->closeSession( $handle, 'navigation' );
  }
  // category comment
  if ( isset( $page['comment'] ) and $page['comment'] != '' )
  {
    $vtp->addSession( $handle, 'comment' );
    $vtp->setVar( $handle, 'comment.cat_comment', $page['comment'] );
    $vtp->closeSession( $handle, 'comment' );
  }
  // total number of pictures in the category
  if ( is_numeric( $page['cat'] ) )
  {
    $vtp->setVar( $handle, 'cat_infos.cat_name',
                  get_cat_display_name( $page['cat_name'], ' - ',
                                        'font-style:italic;' ) );
    // upload a picture in the category
    if ( $page['cat_site_id'] == 1
         and $conf['upload_available']
         and $page['cat_uploadable'] )
    {
      $vtp->addSession( $handle, 'upload' );
      $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand'];
      $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) );
      $vtp->closeSession( $handle, 'upload' );
    }
  }
  else
  {
    $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] );
  }
  
  $vtp->closeSession( $handle, 'cat_infos' );
}
//------------------------------------------------------------ log informations
pwg_log( 'category', $page['title'] );
mysql_close();
//----------------------------------------------------------- html code display
$output.= $vtp->Display( $handle, 0 );

include('include/page_tail.php');
?>

BSF Test
Dimage A1 AMD 2200Win XP Pro + SP2 PhpWg 1.3.2 IE 6

Hors ligne

#8 2004-04-06 13:45:47

Webabar
Membre
France
2004-03-24
214

Re: Lenteur

J'avais pas vu qu'en fait tu avais récupéré l'ancien template !!!!

Du coup, il y manque effectivement la variable home_url et le systeme de template a pas l'air d'aimer ca (dommage...)


    <table style="width:100%;">
      <tr>
        <td valign="top" style="width:1%;padding:10px;">
          {#frame_start}100%{#frame_begin}
            <div class="titreMenu">
              <a href="{#home_url}">{#categories}</a>
            </div>

Bon, en gros, faudrait que je vois tout ton système de templates...  Si tu veux bien me l'envoyer, envoie moi un MP et je te filerai mon mail pour pouvoir m'envoyer ça...

Mais dans la mesure ou tu a gardé le template "de base", mis à part la feuille de style et les .gif, le plus simple serait de reprendre le template de base de la 1.3 et d'y remplacer la feuille de style et les gif.
Souviens-toi que tu peux créer plusieurs templates en même temps en ajoutant un dossier à la racine de "template" (pour faire tes tests).  Attention, ta feuille de style doit s'appeler comme le template...

Voilou...


Y'a des détails qui trompent pas...
Ma galerie PWG :
http://pagesperso.laposte.net/cezanne92/

Hors ligne

#9 2004-04-11 11:20:18

Marc 77
Membre
Nemours, France
2003-01-04
391

Re: Lenteur

Je viens de réparer l'affichage du double en-tête: j'ai copié le code de header.htm dans header.vtp et j'ai laissé vierge header.htm.
Maintenand, je n'ai plus que cette erreur :

Erreur de session n° SESSION4:
La variable home_url que vous souhaitez valoriser n'existe pas dans la zone |root|.

qui subsiste. Vais-je y arriver? :D

Quand à la lenteur, il serait du à un problème de serveur de mon hébergeur (qui sera réparé ce week-end).


BSF Test
Dimage A1 AMD 2200Win XP Pro + SP2 PhpWg 1.3.2 IE 6

Hors ligne

Pied de page des forums

Propulsé par FluxBB

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