$data = runGallery();
$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';
if (isset($data['bodyHtml'])) {
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>{$data['title']}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{$data['javascript']}
{$data['css']}
</head>
<body>
{$data['bodyHtml']}
</body>
</html>
EOF;
}
function runGallery() {
require_once('embed.php');
$data = array();
// if anonymous user, set g2 activeUser to ''
$uid = '';
// initiate G2
$ret = GalleryEmbed::init(array('embedUri' => 'index.php',
'embedPath' => '/album2',
'relativeG2Path' => '/',
'loginRedirect' => '/index.php',
'activeUserId' => $uid));
if (!$ret->isSuccess()) {
$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 */
if (!empty($javascript)) {
foreach ($javascript as $script) {
$data['javascript'] .= "\n".$script;
}
}
/* Add G2 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;
include("header.php");
print $data['headHtml'];
print $data['bodyHtml'];
include("footer.php");
}
?>
Posts: 32509
as it says, output starts at line 2 of your index.php file.
you shouldn't output anything, no html, nothing, before the if ($g2data['isDone']) { exit; } check.
make sure config.php has no newline / space after the closing
?>
also make sure you have no lines before <?php or after ?> in your index.php
Posts: 2
Thank you Valiant,
I do not no why,but I always start(ed) at line 2 with <?php
I replaced it and it works - thank you