website disappears when I click on a thumbnail

denickmans

Joined: 2005-11-10
Posts: 2
Posted: Thu, 2005-11-10 12:16

I'm embedding a Gallery 2 installation into my php webpage(http://www.photopower.be/?page=gallery&lang=nl) and so far, the basic is ok.
But when I click on a thumbnail, only the gallery self appears and my website self is gone.
How can I solve this problem,so that the rest appears too?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-11-10 12:44

how do you integrate g2 in your website? please post the code, else we can't help.

if it's only for visual integration and no user management integration is needed, GalleryEmbed isn't required. see codex.gallery2.org -> howto -> visual

 
denickmans

Joined: 2005-11-10
Posts: 2
Posted: Thu, 2005-11-10 16:17

no, it's not a visual integration cause that isn't possible with the code we already have:

this is the code from the index of our site

Quote:
<HTML>
<HEAD>
<TITLE>.: PhotoPower :. index</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">

<?php
//haalt huidig ip op
function getIp()
{
if( isset( $_SERVER[ "HTTP_X_FORWARDED_FOR" ] ) )
{
$return = $_SERVER[ "HTTP_X_FORWARDED_FOR" ];
}
else
if( isset( $_SERVER[ "HTTP_CLIENT_IP" ] ) )
{
$return = $_SERVER[ "HTTP_CLIENT_IP" ];
}
else
{
$return = $_SERVER[ "REMOTE_ADDR" ];
}

return $return;
}

?>

</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scrolling="yes">
<?php include('connect.inc.php'); ?>
<TABLE WIDTH=800 BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
<TR>
<TD COLSPAN=11>
<?php // this is the banner ?>
<IMG SRC="images/index_01.gif" WIDTH=800 HEIGHT=146 ALT=""></TD>
</TR>
<?php
//here we include the menu
switch($_GET['lang'])
{
// -------------------------------------nederlands--------------------------------------------------------
case 'nl': include("menu_nl.php");break;

// -------------------------------------engels--------------------------------------------------------
case 'eng': include("eng/menu_eng.php");break;

// -------------------------------------frans--------------------------------------------------------
case 'fr': include("fr/menu_fr.php");break;

// -------------------------------------default-->nederlands--------------------------------------------------------
default: include("menu_nl.php");break;

}
?>

<TR>
<TD COLSPAN=11>
<IMG SRC="images/index_13.gif" WIDTH=800 HEIGHT=32 ALT=""></TD>
</TR>
<TR bgcolor="#DCDCDC">
<TD COLSPAN=11 HEIGHT="100%" ><TABLE height="100%" style="margin-left:40px; margin-right:10px; "><TR><TD>

<?php
//here we include the pages
switch($_GET['page'] & $_GET['lang'])
{
//-----------------------------------------nederlands---------------------------------------
case "home" & "nl": include("home.php"); break;
case "gallery" & "nl": include("http://www.photopower.be/gallery2embedded.php"); break;
case "nieuws" & "nl": include("nieuws.php"); break;
case "gastenboek" & "nl": include("gastenboek.php"); break;
case "prijzen" & "nl": include("prijzen.php"); break;
case "links" & "nl": include("links.php"); break;

case "admin" & "nl": include("controlpanel/cp.php");break;

//-----------------------------------------engels-------------------------------------------
case "home" & "eng": include("eng/home.php"); break;
case "gallery" & "eng": include("http://www.photopower.be/gallery2/gallery2embedded.php"); break;
case "nieuws" & "eng": include("nieuws.php"); break;
case "gastenboek" & "eng": include("gastenboek.php"); break;
case "prijzen" & "eng": include("prijzen.php"); break;
case "links" & "eng": include("links.php"); break;

case "admin" & "eng": include("controlpanel/cp.php");break;
//-----------------------------------------frans--------------------------------------------
case "home" & "fr": include("fr/home.php"); break;
case "gallery" & "fr": include("http://www.photopower.be/gallery2/index.php"); break;
case "nieuws" & "fr": include("nieuws.php"); break;
case "gastenboek" & "fr": include("gastenboek.php"); break;
case "prijzen" & "fr": include("prijzen.php"); break;
case "links" & "fr": include("links.php"); break;

case "admin" & "fr": include("controlpanel/cp.php");break;
//-----------------------------------------default--------------------------------------------
default: include("home.php"); break;
};

?>

</TD></TR></TABLE></TD>
</TR>
<TR>
<TD COLSPAN=11><IMG SRC="images/index_15.gif" WIDTH=732 HEIGHT=15 ALT=""><a href="?page=admin&lang=nl"><IMG SRC="images/index_16.gif" WIDTH=68 HEIGHT=15 ALT=""></a></TD>
</TR>
</TABLE>
</BODY>
</HTML>

so I tried to embed the gallery in our site with the standard code I found on the gallery site

the site self is located in the root
the standalone in /gallery2
and the embedfile is also located in the root
this is the code from the embed file

Quote:
<?php

$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('./gallery2/embed.php');

$data = array();

// if anonymous user, set g2 activeUser to ''
$uid = '';

// initiate G2
$ret = GalleryEmbed::init(array('embedUri' => 'gallery.php',
'embedPath' => '/',
'relativeG2Path' => './gallery2',
'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;
}

?>

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-11-10 16:52

you can put any php in the theme.tpl in {php} here {/php} tags.
and if you need to use GalleryEmbed, there's also a howto on codex.gallery2.org

if you have specific questions, i might be able to answer them.

 
fifthacedk
fifthacedk's picture

Joined: 2005-11-10
Posts: 6
Posted: Thu, 2005-11-10 20:14

I believe I have a similar problem. No one's replied to me yet but my example is over at http://gallery.menalto.com/node/39846
Emil