where to set pageWindowSize?

deezNutz
deezNutz's picture

Joined: 2005-07-06
Posts: 26
Posted: Sat, 2005-09-24 01:20

I'd like to override pageWindowSize for modules/core/classes/GalleryTheme.class

Where would I set these value? I tried to set it in themes.inc:

function MatrixTheme() {
global $gallery;

$this->setId('matrix');
$this->setName($gallery->i18n('Matrix'));
$this->setDescription($gallery->i18n('Standard Gallery2 look and feel'));
$this->setVersion('1.0.0');
$this->setRequiredCoreApi(array(6, 5));
$this->setRequiredThemeApi(array(2, 1));
$this->setStandardSettings(
array('rows' => 3, 'columns' => 3,
'showImageOwner' => 0, 'showAlbumOwner' => 1,
'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '',
'colorpack' => '',
'pageWindowSize' => 20,
'showMicroThumbs' => 0,
'sidebarBlocks' => serialize(array(
array('search.SearchBlock', array('showAdvancedLink' => true)),
array('core.ItemLinks', array('useDropdown' => false)),
array('core.PeerList', array()),
array('imageblock.ImageBlock', array()))),
'albumBlocks' => serialize(array(
array('comment.ViewComments', array()))),
'photoBlocks' => serialize(array(
array('exif.ExifInfo', array()),
array('comment.ViewComments', array())))));
}

This did not work for me. Any suggestions?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-09-24 09:41

jumpRange and totalPages must be set, to be able to set pageWindowSize too.

the corresponding code is
if (isset($load['jumpRange']) && isset($theme['totalPages'])) {

load -> jumpRange (4th argument of loadCommonTemplateData())
params -> pageWindowSize (3rd argument of loadCommonTemplateData())
totalPages -> set by loadTemplate, usually set for album pages.

 
deezNutz
deezNutz's picture

Joined: 2005-07-06
Posts: 26
Posted: Sun, 2005-09-25 21:52

This didn't really help me out.

jumpRange and totalPages is set in the code and pageWindowSize defaults to 6 since the variable is not defined.

where would I define and set this variable?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-09-26 05:47

totalPages is a result of the number of items in your album and the number of items you choose to display per page.
pageWindowSize (number) can be set by you in the params array of loadCommonTemplateData()
and jumpRange (true, false) can be set by you in the load array of loadCommonTemplateData().

 
deezNutz
deezNutz's picture

Joined: 2005-07-06
Posts: 26
Posted: Mon, 2005-09-26 22:52

Ok, Now we're back to my original question.

I tried to set pageWindowSize in $params (in theme.inc) but it didn't work. What did I do wrong? I don't want to hardcode a value (I did it for now) just in case I start using a different theme...

/*
* --------------------------------------------------------------------------------------
* 'jumpRange'
*/
if (isset($load['jumpRange']) && isset($theme['totalPages'])) {
$page = GalleryUtilities::getRequestVariables('page');
if (empty($page)) {
$page = 1;
}
$windowSize = isset($params['pageWindowSize']) ? $params['pageWindowSize'] : 20;

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-09-16 21:18

you need to set the $params['pageWindowSize'] in function showAlbumPage() before the loadCommonTemplateData() call.

or

set it in the theme constructor before the theme gets installed.

 
jayp

Joined: 2005-10-24
Posts: 52
Posted: Sat, 2006-09-16 22:15

Thanks a million Valiant! It just wasn't clear to me at all where this needed to be placed. I was adding in elsewhere in the theme.inc file, in a place where other variables in the $param array were getting declared.

So adding

$params = array_merge(array('pageWindowSize' => 25), $params);

right before the call to the loadCommonTemplateData() function. It worked liked a charm. But then, you already knew it would. :)

Thanks again for the help. I greatly appreciate it.

 
nad13

Joined: 2005-11-19
Posts: 53
Posted: Thu, 2006-09-28 19:25

Hello,

I will like to increase the number of page 1… 234567… 10 for example 35

I put the fontion in theme.inc but that does not go.
how then I to make?
or is my error
thank you
best regard
nad

Quote:
<?php
/*
* $RCSfile: theme.inc,v $
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2006 Bharat Mediratta
*
* 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; either version 2 of the License, or (at
* your option) any later version.
*
* 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @version $Revision: 1.54 $ $Date: 2006/03/22 03:52:37 $
* @package Gallery
* @author Bharat Mediratta <bharat@menalto.com>
*/

/**
* This implements the standard gallery theme
*
* @package GalleryTheme
* @subpackage Theme
*/
class MatrixTheme extends GalleryTheme {

/**
* Constructor
*/
function MatrixTheme() {
global $gallery;

$this->setId('matrix');
$this->setName($gallery->i18n('Matrix'));
$this->setDescription($gallery->i18n('Standard Gallery2 look and feel'));
$this->setVersion('1.1.0');
$this->setRequiredCoreApi(array(7, 0));
$this->setRequiredThemeApi(array(2, 1));
$this->setStandardSettings(
array('rows' => 3, 'columns' => 3,
'showImageOwner' => 0, 'showAlbumOwner' => 1,
'albumFrame' => '', 'itemFrame' => '', 'photoFrame' => '',
'colorpack' => '',
'showMicroThumbs' => 0,
'sidebarBlocks' => serialize(array(
array('search.SearchBlock', array('showAdvancedLink' => true)),
array('core.ItemLinks', array('useDropdown' => false)),
array('core.PeerList', array()),
array('imageblock.ImageBlock', array()))),
'albumBlocks' => serialize(array(
array('comment.ViewComments', array()))),
'photoBlocks' => serialize(array(
array('exif.ExifInfo', array()),
array('comment.ViewComments', array())))));
}

/**
* @see GalleryTheme::showAlbumPage
*/
function showAlbumPage(&$template, $item, $params, $childIds) {
$ret = $this->loadCommonTemplateData(
$template, $item, $params,
array('owner', 'viewCount', 'childCount', 'descendentCount', 'parents',
'systemLinks', 'itemLinks', 'itemSummaries', 'permissions',
'thumbnails', 'pageNavigator', 'jumpRange'),
$childIds);
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

/* Add in our extra stuff */
$theme =& $template->getVariableByReference('theme');
$theme['columnWidthPct'] = floor(100 / $params['columns']);

/* Add our header and styles */
return array(null, 'theme.tpl');
}

/**
* @see GalleryTheme::showPhotoPage
*/
function showPhotoPage(&$template, $item, $params) {
$dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions',
'itemLinksDetailed', 'itemNavigator', 'imageViews');
if (!empty($params['showMicroThumbs'])) {
$dataTypes[] = 'navThumbnails';
}
$ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes);
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

return array(null, 'theme.tpl');
}

/**
* @see GalleryTheme::showModulePage
*/
function showModulePage(&$template, $item, $params, $templateFile) {
$params = array_merge(array('pageWindowSize' => 35), $params);
$ret = $this->loadCommonTemplateData(
$template, $item, $params, array('parents', 'systemLinks'));
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

return array(null, 'theme.tpl');
}

/**
* @see GalleryTheme::showAdminPage
*/
function showAdminPage(&$template, $item, $params, $templateFile) {
$ret = $this->loadCommonTemplateData(
$template, $item, $params, array('parents', 'systemLinks'));
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

return array(null, 'theme.tpl');
}

/**
* @see GalleryTheme::showErrorPage
*/
function showErrorPage(&$template) {
return array(null, 'error.tpl');
}

/**
* @see GalleryTheme::showProgressBarPage
*/
function showProgressBarPage(&$template, $item, $params) {
$ret = $this->loadCommonTemplateData(
$template, $item, $params, array('parents', 'systemLinks'));
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

return array(null, 'theme.tpl');
}
}
?>

Gallery version = 2.1.2 noyau 1.1.0.2
PHP version = 5.1.6 apache
Serveur Web = Servage.net Cluster (Enhanced Apache)
Base de données = mysql 5.0.15, lock.system=flock
Boîtes à outils = ArchiveUpload, Getid3, NetPBM, ImageMagick, Thumbnail, Gd
Accélération = none, none
Système d'exploitation = Linux node2.c17 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:08:39 EDT 2005 i686
Thème par défaut = matrix
Langage = fr_FR
Navigateur Web = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

 
ichthyous

Joined: 2006-06-16
Posts: 324
Posted: Tue, 2007-07-10 17:45

I have been looking for the answer to this for quite some time...thanks for the solution! Now all my page numbers appear on each page and the problem I had with duplicate page number links has stopped. Does anyone have a recommendation for a max number of pages to display at any one time in terms of usability?
Andrew
Architectural Photography
Cityscape and Night Photography
Landscape Photography

 
Fotographer

Joined: 2007-03-23
Posts: 110
Posted: Sat, 2008-10-25 06:00

I've been through this and other posts in the forum similar to this, and I simply just don't understand.
Maybe I’m not thinking hard enough about it.

But what I was wondering is, how would I get the pagination in my theme (classic)
To look like this:

Quote:
[<< First][< Previous] [1] [2] [3] [4] [5] [...] [21] [Next >][Last >>]

Ohh. And if anyone wants to see: http://gallery.picsbypros.com

 
Fotographer

Joined: 2007-03-23
Posts: 110
Posted: Sat, 2008-10-25 05:58

I'm gonna bump this and hope for someone to come to my rescue.