aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-09-25 00:39:12 +0000
committerrvelices <rv-github@modusoptimus.com>2008-09-25 00:39:12 +0000
commita3dc10babc0609f2a097bca76da1de8b2d92ace6 (patch)
treef1306ee84a47dfa818dbb234433fca2a35ac223c
parentc15f6faced7691ce67015fe1d1b61ff270ae5f96 (diff)
- 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 ...) git-svn-id: http://piwigo.org/svn/trunk@2586 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_category.inc.php2
-rw-r--r--index.php65
2 files changed, 36 insertions, 31 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 53f98a5c2..26c9478ef 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -103,6 +103,8 @@ WHERE '.$where.'
while ($row = mysql_fetch_assoc($result))
{
array_push($cats, $row);
+ if ($row['id']==@$page['category']['id']) //save the number of subcats for later optim
+ $page['category']['count_categories'] = $row['count_categories'];
}
usort($cats, 'global_rank_compare');
diff --git a/index.php b/index.php
index b74c370c5..e4bc95c6c 100644
--- a/index.php
+++ b/index.php
@@ -156,8 +156,6 @@ else
$url
);
}
-// include menubar
-include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
if ('search' == $page['section'])
{
@@ -220,35 +218,6 @@ if ( $page['section']=='search' and $page['start']==0 and
}
}
-//------------------------------------------------------ main part : thumbnails
-if ( 0==$page['start']
- and !isset($page['flat'])
- and !isset($page['chronology_field'])
- and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
- )
-{
- include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
-}
-if ( !empty($page['items']) )
-{
- include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
-}
-//------------------------------------------------------- category informations
-
-// slideshow
-// execute after init thumbs in order to have all picture informations
-if (!empty($page['cat_slideshow_url']))
-{
- if (isset($_GET['slideshow']))
- {
- redirect($page['cat_slideshow_url']);
- }
- else
- {
- $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
- }
-}
-
// navigation bar
$template->assign( 'NAV_BAR', $page['navigation_bar'] );
@@ -284,6 +253,40 @@ if (isset($page['comment']) and $page['comment'] != '')
{
$template->assign('CONTENT_DESCRIPTION', $page['comment'] );
}
+
+// include menubar
+include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
+
+//------------------------------------------------------ main part : thumbnails
+if ( 0==$page['start']
+ and !isset($page['flat'])
+ and !isset($page['chronology_field'])
+ and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
+ and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
+ )
+{
+ include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
+}
+if ( !empty($page['items']) )
+{
+ include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
+}
+//------------------------------------------------------- category informations
+
+// slideshow
+// execute after init thumbs in order to have all picture informations
+if (!empty($page['cat_slideshow_url']))
+{
+ if (isset($_GET['slideshow']))
+ {
+ redirect($page['cat_slideshow_url']);
+ }
+ else
+ {
+ $template->assign('U_SLIDESHOW', $page['cat_slideshow_url']);
+ }
+}
+
//------------------------------------------------------------ log informations
pwg_log();