close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Gallery was working fine & now there's an error - no idea why plz help

Thread began 4/12/2010 1:46 pm by info355813 | Last modified 4/13/2010 10:10 am by Jason Byrnes | 896 views | 2 replies |

info355813

Gallery was working fine & now there's an error - no idea why plz help

Hello, I've used powergallery in a clients site. Been working fine during the build of the site & for the past week since we went live. Now we're getting an error. Nothing has been changed to any of the files for the gallery or anything like that.

"Warning: Invalid argument supplied for foreach() in /home/USR/public_html/gallery/galleries/global.php on line 55" error in every gallery.

Why is it doing this / what happened? I can't figure it out. Please help ASAP. The site & one of the galleries can be viewed at: [url]
Thanks.

Sign in to reply to this post

info355813

I replaced the global.php file with the one from the PowerGallery update & now the error is gone. I would still like to know what happened & why the gallery just stopped working & that error came up. Nothing was changed. Is there a bug in this software? Here's a copy of the entire global.php that had the error. Please advise.

<?php
require_once(realpath($abs_prefix . '../') . '/Connections/powergallery.php');
mysql_select_db($database_powergallery);

$GLOBALS['wa_settings'] = array();
$result = mysql_query('SELECT * FROM wa_settings');
while($row = mysql_fetch_assoc($result)) {
$GLOBALS['wa_settings'][$row['name']] = $row['value'];
}

#####

$pg_config = array(
'path' => $GLOBALS['wa_settings']['pg_root'],
'html_prefix' => $GLOBALS['wa_settings']['pg_root'] . substr($abs_file, strpos($abs_file, '/galleries/') + 1) . '/'
);

#####

if(!function_exists('get_gallery')) {
function get_gallery($url) {
global $abs_prefix, $pg_config;
$gallery = array(
'title' => '',
'images' => array()
);

//load using url (requires fopen wrapper support)
$sxe = @simplexml_load_file($url);

//failed (likely due to no fopen wrapper support)
//try loading via include file and XML string
if(!$sxe) {
ob_start();
$connections_prefix = realpath($abs_prefix . '../') + '/';
$args = substr($url, strpos($url, '?') + 1);
$args_array = explode('&', $args);
foreach($args_array as $arg) {
$arg_array = explode('=', $arg);
$_GET[$arg_array[0]] = $arg_array[1];
}
$_SERVER['PHP_SELF'] = $pg_config['path'] . 'fakey.php';
$no_xml_header = true;
include(realpath($abs_prefix . '../mediarss.php'));
$sxe = simplexml_load_string(ob_get_contents());
ob_end_clean();
}

if($sxe) {
//gallery info
$gallery['title'] = $sxe->channel->title;

//images
$images = array();
foreach($sxe->channel->item as $item) {
$media = $item->children('http://search.yahoo.com/mrss/');
$thumbnail = $media->thumbnail->attributes();
$full = $media->content->attributes();
$supersize = $media->supersize ? $media->supersize->attributes() : false;
$images[] = array(
'title' => htmlspecialchars(strval($media->title)),
'description' => htmlspecialchars(strval($media->description)),
'thumb' => array('url' => strval($thumbnail['url']), 'width' => strval($thumbnail['width']), 'height' => strval($thumbnail['height'])),
'fullsize' => array('url' => strval($full['url']), 'width' => strval($full['width']), 'height' => strval($full['height'])),
'supersize' => empty($supersize) ? array() : array('url' => strval($supersize['url']), 'width' => strval($supersize['width']), 'height' => strval($supersize['height']))
);
}
$gallery['images'] = $images;
}

return $gallery;
}
}

if(!function_exists('get_mediarss_url')) {
function get_mediarss_url($args) {
return $GLOBALS['wa_settings']['pg_rooturl'] . 'mediarss.php?' . $args;
}
}
?>

Sign in to reply to this post

Jason ByrnesWebAssist

impossible to say what the problem was to be honest. I don't see any difference in the global.php code you posted and the one I have.

My only guess is that the PHP server had a hiccup.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...