Changeset 2586


Ignore:
Timestamp:
Sep 25, 2008, 2:39:12 AM (16 years ago)
Author:
rvelices
Message:
  • sql optim: do not include category_cats (which makes a query) if current category does not have children (info known when building menubar)
  • in index.php - fill the template completely before including menubar/category_cats/thumbnails (some themes might want to use in the menubar some vars ...)
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r2572 r2586  
    104104  {
    105105    array_push($cats, $row);
     106    if ($row['id']==@$page['category']['id']) //save the number of subcats for later optim
     107      $page['category']['count_categories'] = $row['count_categories'];
    106108  }
    107109  usort($cats, 'global_rank_compare');
  • trunk/index.php

    r2517 r2586  
    157157    );
    158158}
    159 // include menubar
    160 include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
    161159
    162160if ('search' == $page['section'])
     
    218216    }
    219217    $template->assign( 'tag_search_results', $hints);
    220   }
    221 }
    222 
    223 //------------------------------------------------------ main part : thumbnails
    224 if ( 0==$page['start']
    225     and !isset($page['flat'])
    226     and !isset($page['chronology_field'])
    227     and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
    228   )
    229 {
    230   include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
    231 }
    232 if ( !empty($page['items']) )
    233 {
    234   include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
    235 }
    236 //------------------------------------------------------- category informations
    237 
    238 // slideshow
    239 // execute after init thumbs in order to have all picture informations
    240 if (!empty($page['cat_slideshow_url']))
    241 {
    242   if (isset($_GET['slideshow']))
    243   {
    244     redirect($page['cat_slideshow_url']);
    245   }
    246   else
    247   {
    248     $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
    249218  }
    250219}
     
    285254  $template->assign('CONTENT_DESCRIPTION', $page['comment'] );
    286255}
     256
     257// include menubar
     258include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
     259
     260//------------------------------------------------------ main part : thumbnails
     261if ( 0==$page['start']
     262    and !isset($page['flat'])
     263    and !isset($page['chronology_field'])
     264    and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
     265    and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
     266  )
     267{
     268  include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
     269}
     270if ( !empty($page['items']) )
     271{
     272  include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
     273}
     274//------------------------------------------------------- category informations
     275
     276// slideshow
     277// execute after init thumbs in order to have all picture informations
     278if (!empty($page['cat_slideshow_url']))
     279{
     280  if (isset($_GET['slideshow']))
     281  {
     282    redirect($page['cat_slideshow_url']);
     283  }
     284  else
     285  {
     286    $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
     287  }
     288}
     289
    287290//------------------------------------------------------------ log informations
    288291pwg_log();
Note: See TracChangeset for help on using the changeset viewer.