'/gallery2/main.php', 'embedUri'=>'/gallery2/embed_samples/g2_html_segments_example.php', 'fullInit'=>'false')); if ($ret) { print $ret->getAsHtml(); } $gallery->setConfig('showSidebarBlocks', false); // you can hide the sidebarblocks in fact you must to use $g2data['sidebarBlocksHtml'] $gallery->setConfig('login', true); // you can allow for login if you want $gallery->setConfig('defaultAlbumId', 32); // set the default home album $gallery->setConfig('breadcrumbRootId', 32); // set the default g2_itemId breadcrumb root /* Theme */ /* First get the theme params in case we want to override some of them. */ list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('theme', 'matrix'); if ($ret) { print 'Failed to load theme params'.$ret->getAsHtml(); } $params['columns'] = 2; $params['rows'] = 4; $ret = GalleryEmbed::setThemeForRequest('matrix', $params); if ($ret) { print 'Failed to set theme'.$ret->getAsHtml(); } $g2data = GalleryEmbed::handleRequest(); if ($g2data['isDone']) { exit; } GalleryEmbed::done(); ?>

Using Gallery2's Embed API

Embed sample index ⟐ Embed template ⟐ Simple embed tool
Connect w/ Gallery2
<?php
require_once ('/usr/local/www/public_html/gallery2/embed.php'); // Path to Gallery's embed.php
$ret = GalleryEmbed::init(array('g2Uri'=>'http://www.flashyourweb.com/gallery2/main.php', 'embedUri'=>'http://www.flashyourweb.com/gallery2/embed_samples/g2_html_segments_example.php', 'fullInit'=>'false'));
if ($ret) {
print $ret->getAsHtml();
}
$gallery->setConfig('showSidebarBlocks', false); // you can hide the sidebarblocks in fact you must to use $g2data['sidebarBlocksHtml']
$gallery->setConfig('login', true); // you can allow for login if you want
$gallery->setConfig('defaultAlbumId', 32); // set the default home album
$ret = GalleryEmbed::setThemeForRequest('matrix');
if ($ret) {
print 'Failed to set theme'.$ret->getAsHtml();
}
$g2data = GalleryEmbed::handleRequest();
if ($g2data['isDone']) {
exit;
}
GalleryEmbed::done();
?>
<?php echo $g2data['headHtml']; ?>
             
$g2data['sidebarBlocksHtml']

Requires $gallery->setConfig('showSidebarBlocks', false); as seen above.

Basically you would only use this if you were planning on placing your sidebar in a specific location in your layout. Otherwise the sidebar is included in bodyHtml.

<?php
if(isset($g2data['sidebarBlocksHtml'])){
foreach ($g2data['sidebarBlocksHtml'] as $snippet) {
echo $snippet;
}
}
?>
<?php echo $g2data['bodyHtml']; ?>