Custom embedded page
davsoft
Joined: 2005-09-21
Posts: 6 |
Posted: Mon, 2006-01-23 11:50 |
I've created an embedded gallery page as per the documentation, it's located at http://qldstorms.com/gallery.php. My problem is that if you click on any of the links it goes back to normal standalone mode. I've checked the options in the URL rewrite options but can't see to see anything in there with regard to embedded mode. Where might I have gone wrong? Thanks, David |
|
Posts: 32509
disable and uninstall the url rewrite module.
you can use the url rewrite module only if your gallery.php script is in another folder than main.php of g2.
and also then you need to specifically configure embedded url rewrite according to the docs on codex.gallery2.org.
Posts: 6
I've done that, however my gallery.php script is outside the g2 folder. G2 is qldstorms.com/gallery/ and the embedded script is in qldstorms.com/gallery.php.
Here is my embedded page which was copied from the info on codex.gallery2.org:
<div id="main">
<?php
$g2_Config['path'] = '/hsphere/local/home/davsoft/qldstorms.com/gallery/';
$g2_Config['embedPath'] = '/';
$g2_Config['relativeG2Path'] = '/gallery/';
$g2_Config['embedUri'] = '/gallery.php';
//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
$ret = GalleryEmbed::init(array(
'embedPath' => $g2_Config['embedPath'],
'relativeG2Path' => $g2_Config['relativeG2Path'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'gallerySessionId' => $_COOKIE['PHPSESSID']
));
GalleryCapabilities::set('login',true);
// handle the G2 request
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone']))
{
print 'isDone is not defined, something very bad must have happened.';
exit;
}
// die if it was a binary data (image) request
if ($g2moddata['isDone'])
{
exit; /* uploads module does this too */
}
if ($ret->isError())
{
print $ret->getAsHtml();
}
?>
<?php
$headHtml = $g2moddata['headHtml'];
//$headHtml = str_ireplace('</title>', ' -- ' . 'My Site' . '</title>', $headHtml);
echo $headHtml;
?>
<?php
echo $g2moddata['bodyHtml'];
?>
</div>
Have I done something wrong here or is there something else I've missed? Thanks,
David
Posts: 32509
there are some things wrong, yes. e.g. you shouldn't start outputting any html to the browser before calling GalleryEmbed::handleRequest();
and for embedded url rewrite, please refer to the embedded url rewrite instructions on codex.