problem embedding g2 into my php website ??? HELP

pcp20us
pcp20us's picture

Joined: 2006-03-31
Posts: 109
Posted: Mon, 2006-04-03 11:57

Hello..

I am trying to embed G2 into my site.I am using PHP so i have created the gallery2emmbedded file as in the doco for this. Here is the file below.
I get nothing on my screen.Ithink my understanding is correct about how I am doing this.
I want to but the gallery pages into my created php files. so i have my php file calling my header footer and menu html files and the bofy file will be the gallery pages, Is this correct thinking?
I am having troubles. I am using php to keep modification easy. I have read heaps of doco about this but cannot find a step by step process that explaims what the embed path and embeduri are.
Is someone able to help me please.

I have played around with the template.tpl and other tpl files to sort of get the results I am after but then there is to much to modify in the future thats why i went to php and style sheets.

This is being tested on an inhouse webserver so i cant give your a link to my pages.

Thanks

Pete

<?php
$g2_Config['path'] = /swgallery(__FILE__) . '/';

$g2_Config['embedPath'] = '/';
$g2_Config['g2Uri'] = 'www.10.1.1.50/sgallery/';
$g2_Config['loginredirect'] = '/';
$g2_Config['embedUri'] = '/swgallery/gallery2embedded.php';

//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
$ret = GalleryEmbed::init(array(
'g2Uri' => $g2_Config['g2Uri'],
'loginRedirect' => $g2_Config['loginredirect'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'apiVersion' => array(1,0)
));
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)
{
print $ret->getAsHtml();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<?php
$headHtml = $g2moddata['headHtml'];
//$headHtml = str_ireplace('</title>', ' -- ' . 'My Site' . '</title>', $headHtml);
echo $headHtml; ?>
<?php include ("header.html") ?>

<style type="text/css"> </style>
</head>
<body class="gallery">
<?php
echo $g2moddata['bodyHtml'];
?>
<?php include ("../photos/menu.html") ?>
<?php include ("../photos/footer.html") ?>

</body>
</div>
<div id="menu">
<?php include ("../photos/menu.html") ?>
</div>
<div class="footer">
<?php include ("../photos/footer.html") ?>

</div>

</html>

- Please add '[module / theme name]' along with specific subject in the title of your topic
- What information is required when asking for help in the forums?
http://codex.gallery2.org/index.php/Gallery2:faq#What_information_is_required_when_I_ask_for_help_in_the_forums.3F
- You can copy and paste a lot of the required information from "Site Admin" -> "Maintenance" -> "System Information" if your G2 is up and running.
- For development specific discussions, please use the forums in the Tech Zone

Gallery version (not just "2"):
Module / Theme name & version:
PHP version (e.g. 4.3.11):
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33):
Database (e.g. MySql 4.0.11):
Activated toolkits (e.g. NetPbm, GD):
Operating system (e.g. Linux):
Browser (e.g. Firefox 1.0):

cheers

Pete
Australia

 
pcp20us
pcp20us's picture

Joined: 2006-03-31
Posts: 109
Posted: Tue, 2006-04-04 06:29

MMM how do you get support on these programs.Am I not follwing the right procedure.?
??????

Thanks

cheers

Pete
Australia

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2006-04-04 14:22

ok, the path is the full directory path from your root to your gallery2 directory. If you took my directions literally, your gallery2embedded.php file should be in your gallery2 directory, so you can use dirname(__FILE__) to get the currently directory of this file as your path.

the embedPath is the path to your main application. Typically this is going to be your wwwroot. This is a web path not a directory path, thus just a single slash, '/'

the g2Uri is a web path to your gallery2 installation. Typically this is just going to be /gallery2/. You can include your domain name in there if you want like http://example.com/gallery2/ but then you'll have to change that if you ever change domain names, so it's suggested to leave the domain information out and just give the web path relative to the wwwroot.

loginredirect is the location you want people to be sent if they need to login.

embeduri is the web path to this gallery2embedded.php file. Typically this is going to be /gallery2/gallery2embedded.php

try these settings

$g2_Config['path'] = dirname(__FILE__) . '/';

$g2_Config['embedPath'] = '/';
$g2_Config['g2Uri'] = '/swgallery/';
$g2_Config['loginredirect'] = '/';
$g2_Config['embedUri'] = '/swgallery/gallery2embedded.php';

also, can you post or PM me the url to your site so I can check out your problems? Thanks.

Steve Lineberry