Welcome to Geeklog, Anonymous Thursday, April 18 2024 @ 12:03 am EDT

Geeklog Forums

Gallery 2 in static pages ?


duvide

Anonymous
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):

Text Formatted Code
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
 Quote

Status: offline

DTrumbower

Forum User
Moderator
Registered: 01/08/03
Posts: 507
That not quite how php works in static pages.

Try this.

Convert your print statments to a variable and then return the variable.

Text Formatted Code

$display = "<html><head>";
$display .= $g2moddata['headHtml'];
$display .= "</head><body>";
$display .= $g2moddata['bodyHtml'];
$display .=  "</body></html>";
return $display;

 
 Quote

duvide

Anonymous
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
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by DTrumbower: That not quite how php works in static pages.

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

bye, Dirk
 Quote

duvide

Anonymous
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
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by duvide: so what it the corrct mode then?

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
 Quote

Status: offline

DTrumbower

Forum User
Moderator
Registered: 01/08/03
Posts: 507
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.

 Quote

All times are EDT. The time is now 12:03 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content