PHP question from a novice

I have a Joomla! 3.x platform using Phoca Gallery 4.1.2. When I migrated to Joomla! 3.x, my template begin to get the following warnings if a gallery had more than 3 rows of photos:

[code]Warning: Illegal string offset ‘active’ in /home4/cscj01/public_html/templates/phoca_rhein/html/pagination.php on line 129

Warning: Illegal string offset ‘active’ in /home4/cscj01/public_html/templates/phoca_rhein/html/pagination.php on line 135[/code]

Here are the contents of pagination.php:[php]<?php
/**

  • @version $Id: pagination.php 9764 2007-12-30 07:48:11Z ircmaxell $
  • @package Joomla
  • @copyright Copyright © 2005 - 2008 Open Source Matters. All rights reserved.
  • @license GNU/GPL, see LICENSE.php
  • Joomla! is free software. This version may have been modified pursuant
  • to the GNU General Public License, and as distributed it includes or
  • is derivative of works licensed under the GNU General Public License or
  • other free or open source software licenses.
  • See COPYRIGHT.php for copyright notices and details.
    */

// no direct access
defined(’_JEXEC’) or die(‘Restricted access’);

/**

  • This is a file to add template specific chrome to pagination rendering.
  • pagination_list_footer
  • Input variable $list is an array with offsets:
  •  $list[limit]		: int
    
  •  $list[limitstart]	: int
    
  •  $list[total]		: int
    
  •  $list[limitfield]	: string
    
  •  $list[pagescounter]	: string
    
  •  $list[pageslinks]	: string
    
  • pagination_list_render
  • Input variable $list is an array with offsets:
  •  $list[all]
    
  •  	[data]		: string
    
  •  	[active]	: boolean
    
  •  $list[start]
    
  •  	[data]		: string
    
  •  	[active]	: boolean
    
  •  $list[previous]
    
  •  	[data]		: string
    
  •  	[active]	: boolean
    
  •  $list[next]
    
  •  	[data]		: string
    
  •  	[active]	: boolean
    
  •  $list[end]
    
  •  	[data]		: string
    
  •  	[active]	: boolean
    
  •  $list[pages]
    
  •  	[{PAGE}][data]		: string
    
  •  	[{PAGE}][active]	: boolean
    
  • pagination_item_active
  • Input variable $item is an object with fields:
  •  $item->base	: integer
    
  •  $item->link	: string
    
  •  $item->text	: string
    
  • pagination_item_inactive
  • Input variable $item is an object with fields:
  •  $item->base	: integer
    
  •  $item->link	: string
    
  •  $item->text	: string
    
  • This gives template designers ultimate control over how pagination is rendered.
  • NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
    */

function pagination_list_footer($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = “<div class=“list-footer”>\n”;

if ($lang->isRTL())
{
	$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
	$html .= $list['pageslinks'];
	$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
}
else
{
	$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
	$html .= $list['pageslinks'];
	$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
}

$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
$html .= "\n</div>";

return $html;

}

function pagination_list_render($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = “<div class=“pagination”>”;

// Reverse output rendering for right-to-left display
if($lang->isRTL())
{
	$html .= '&laquo; '.$list['start']['data'];
	$html .= '&nbsp;'.$list['previous']['data'];

	$list['pages'] = array_reverse( $list['pages'] );

	foreach( $list['pages'] as $page ) {
		if($page['data']['active']) {
			$html .= '<strong>';
		}

		$html .= '&nbsp;'.$page['data'];

		if($page['data']['active']) {
			$html .= '</strong>';
		}
	}

	$html .= '&nbsp;'.$list['next']['data'];
	$html .= '&nbsp;'.$list['end']['data'];
	$html .= ' &raquo;';
}
else
{
	$html .= '&laquo; '.$list['start']['data'];
	$html .= $list['previous']['data'];

	foreach( $list['pages'] as $page )
	{
	       if($page['data']['active']) {
			$html .= '<strong>';
		}

		$html .= $page['data'];

		if($page['data']['active']) {
			$html .= '</strong>';
		}
	}

	$html .= $list['next']['data'];
	$html .= $list['end']['data'];
	$html .= ' &raquo;';
}

$html .= "</div>";
return $html;

}

function pagination_item_active(&$item) {
return “<a href=”".$item->link."" title="".$item->text."">".$item->text."";
}

function pagination_item_inactive(&$item) {
return “”.$item->text."";
}
?>[/php]The footer is correct, and all images are available to view. From what little I understand, the variable active in the array of type boolean contains an illegal offset value for the variable data of type string. I do not know about PHP, but in my programming experience, a variable of type boolean can only contain a value of 1 or o. The problem is, I don’t know enough about the scripting languages to even attempt to debug this. Can anyone help here by spotting what is wrong or suggest where I should look to determine what is happening? Thank you for any assistance you can give.

I would start with trying to find out what values you have at the point of error.

Something like

if not isset($page[‘data’][‘active’]) { die(print_r($page)) }

Sponsor our Newsletter | Privacy Policy | Terms of Service