function runGallery() {
$data = array();
// if anonymous user, set g2 activeUser to ''
$uid = '';
// initiate G2
$ret = GalleryEmbed::init(array('g2Uri' => '/gallery2/',
'embedUri' => 'index.php',
'activeUserId' => $uid));
$ret = GalleryEmbed::setThemeForRequest('siriux');
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'];
}
return $data;
}
Posts: 8339
The breadcrumb html is part of the $g2moddata['bodyHtml']
you would need to try and parse it out, or use javascript to get the innerHTML of the breadcrumb's container and transport it elsewhere.
I have an easy to use G2 embed form.
I also have a function in my jQuery mediaBlock for reproducing breadcrumbs by id:
Regular mediaBlock here.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 2
Thanks dude Im going to play with the code tomorrow.