ive been trying to integrate the newest gallery2 into my site for a few days. Ive tried G2mod and some other plug-ins but im having the same problem with all of them.
Basically the output from the server haults when it comes across either the module tag or my user defined tag. The html output just stops!
I took some code straight from the gallery2 embed example and made a user defined tag.
The code at the bottom of my post works perfectly in a seperate php file, but when its in a plugin, or user tag cmsms seems to fall over and not give any error
i added some "echo"s to try and work out where it was failing and it appears to fail at:
Code: Select all
$g2moddata = GalleryEmbed::handleRequest();Anybody know whats going on?
Code: Select all
require_once('/home/www/markfihh/t/gallery2/embed.php');
$data = array();
// if anonymous user, set g2 activeUser to ''
$uid = '';
// initiate G2
$ret = GalleryEmbed::init(array('g2Uri' => '/gallery/',
'embedUri' => '/main.php',
'activeUserId' => $uid));
if ($ret) {
$data['bodyHtml'] = $ret->getAsHtml();
return $data;
}
// user interface: you could disable sidebar in G2 and get it as separate HTML to put it into a block
GalleryCapabilities::set('showSidebarBlocks', false);
// handle the G2 request
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone'])) {
$data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
return $data;
}
// exit if it was an immediate view / request (G2 already outputted some data)
if ($g2moddata['isDone']) {
exit;
}
// put the body html from G2 into the xaraya template
$data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';
// get the page title, javascript and css links from the <head> html from G2
$title = ''; $javascript = array(); $css = array();
if (isset($g2moddata['headHtml'])) {
list($data['title'], $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
$data['headHtml'] = $g2moddata['headHtml'];
}
/* Add G2 javascript */
$data['javascript'] = '';
if (!empty($javascript)) {
foreach ($javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}
/* Add G2 css */
$data['css'] = '';
if (!empty($css)) {
foreach ($css as $style) {
$data['css'] .= "\n".$style;
}
}
// sidebar block
if (isset($g2moddata['sidebarBlocksHtml']) && !empty($g2moddata['sidebarBlocksHtml'])) {
$data['sidebarHtml'] = $g2moddata['sidebarBlocksHtml'];
}
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';
if (isset($data['bodyHtml'])) {
echo $data['bodyHtml'];
}

