Posted on: 07/10/05 07:48am
By: Anonymous (duvide)
I would like to include Gallery 2 in staticpages because I want to use the same gallery for different sites.
I acitvated php in static pages and added the following code to a static page but I get only a whit page (no error):
require_once(dirname(__FILE__) . '/../../gallery2/embed.php');
$ret = GalleryEmbed::init(array(
'embedUri' => 'index.php', embedPath => '/', 'relativeG2Path' => 'gallery2/',
'loginRedirect' => 'index.php', 'activeUserId' => ''));
if ($ret->isError()) {
$ret->getAsHtml(); // has error details..
exit;
}
$g2data = GalleryEmbed::handleRequest();
if ($g2data['isDone']) {
exit; // G2 has already sent output (redirect or binary data)
}
// Use $g2data['headHtml'] and $g2data['bodyHtml']
// to display G2 content inside embedding application
// if you don't want to use $g2data['headHtml'] directly, you can get the css,
// javascript and page title separately by calling...
if (isset($g2moddata['headHtml'])) {
list($title, $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
}
print "<html><head>";
print $g2moddata['headHtml'];
print "</head><body>";
print $g2moddata['bodyHtml'];
print "</body></html>";
Also, is it possible to have the same forum on different sites? Maybe also in a staticpage.
Syncronized user data is not important.
Thank you all/Frank
Gallery 2 in static pages ?
Posted on: 07/11/05 11:33am
By: DTrumbower
That not quite how php works in static pages.
Try this.
Convert your print statments to a variable and then return the variable.
$display = "<html><head>";
$display .= $g2moddata['headHtml'];
$display .= "</head><body>";
$display .= $g2moddata['bodyHtml'];
$display .= "</body></html>";
return $display;
Gallery 2 in static pages ?
Posted on: 07/11/05 12:31pm
By: Anonymous (duvide)
Thank you for the reply
I exchanged your code with my print stuff but I don't know where else I have to "convert the variable"?
I still get only an empty page with this.
Regards/Frank
Gallery 2 in static pages ?
Posted on: 07/11/05 04:00pm
By: Dirk
[QUOTE BY= DTrumbower] That not quite how php works in static pages.[/QUOTE]
We've introduced a second PHP mode back in 1.3.9, so both variants work now (provided you chose the correct mode).
And for the OP: Start here:
Blank page[*1]
bye, Dirk
Gallery 2 in static pages ?
Posted on: 07/12/05 03:15am
By: Anonymous (duvide)
so what it the corrct mode then?
By blank page I meant that there is nothing in the static page. The header, menus, etc. are there...
Any more ideas?
Thank you/Frank
Gallery 2 in static pages ?
Posted on: 07/12/05 04:04pm
By: Dirk
[QUOTE BY= duvide] so what it the corrct mode then?[/QUOTE]
For the code you posted originally, it would be "execute PHP". For Dwight's variant, it would be "execute PHP (return)".
My guess is that an error occurs in either your PHP code or the included Gallery code. It can be tricky to track errors down with PHP in static pages. I'd suggest putting that code into its own file (without the Geeklog wrapper) and see what happens then.
bye, Dirk
Gallery 2 in static pages ?
Posted on: 07/13/05 03:50pm
By: DTrumbower
I posted yesterday but it doesn't show.
I tried your code in a static page and got the same results. I'm not farmillar with embedding gallery, so I didn't dig harder.
For a test, just us a Print "test message"; and it should display in the static page. It looks like the variables for the gallery are not getting populated.
Also the embeded code is creating another set of html, header and body tags. Which is probably not a good thing.