Simple PHP integration for dummies
Pigman
Joined: 2005-07-08
Posts: 4 |
![]() |
Hi all, Apologies for starting another thread, but I've read all I can and I'm drawing a blank. All other explanations on this I've found are related to CMS systems, or go in to too much detail with user accounts etc. :oops: I have a really simple PHP page and I want to embed my gallery in it. I dont want to use templates as this would get too messy for me to try and rebuild my pages from the inside out. Therefore I want to do a proper embed. I have one test page (test.php) in the root of my site which drives my entire site. This will be the page that has the gallery embedded within it. The gallery lives in a folder in the root ie. /gallery I have no care for syncronising security accounts etc, admin (ie. me) is the only person that will ever login. I've studied the readme file but it just confuses the hell out of me. http://cvs.sourceforge.net/viewcvs.py/gallery/gallery2/docs/EMBEDDING?rev=1.6 Any chance on someone giving me some simple code to paste, I should be able to take it from there once I have something! At the moment I just get a blank page when I call test.php. I dont really understand those variables that need to be set at the start. Here is the code... <body> <?PHP require_once(dirname(__FILE__) . '/gallery/embed.php'); $ret = GalleryEmbed::init(array( 'embedUri' => {value}, embedPath => {value}, 'relativeG2Path' => {value}, 'loginRedirect' => {value}, 'activeUserId' => {value})); 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']); } ?> </body> |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
1. you understand that you have to replace the {value} stuff in the GalleryEmbed::init call with real values, right? <?php require_once(dirname(__FILE__) . '/gallery/embed.php'); $ret = GalleryEmbed::init(array( 'embedUri' => 'test.php', embedPath => '/', 'relativeG2Path' => 'gallery/', '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>"; ?> in the sticky Embedding & Integration topic, i have a link to this post: http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=122603#122603 where i describe the minimal integration wrapper. </body> |
|
Pigman
Joined: 2005-07-08
Posts: 4 |
![]() |
Thanks for that. But I still get a blank page returned as you can see here... http://www.filthclub.com.au/test.php Here is the entire contents of test.php... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php require_once(dirname(__FILE__) . '/gallery/embed.php'); $ret = GalleryEmbed::init(array( 'embedUri' => 'test.php', embedPath => '/', 'relativeG2Path' => 'gallery/', '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>"; ?> </body> </html> |
|
Pigman
Joined: 2005-07-08
Posts: 4 |
![]() |
Using your wrapper code I got that working as... |
|
Pigman
Joined: 2005-07-08
Posts: 4 |
![]() |
Okay, brilliant. I appear to have got most of it working. http://www.filthclub.com.au/main.php?subaction=photos However, if I drill down in to a gallery, then try to use the "Gallery >>" quick links at the top, I just get a blank page. :cry: |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
Pigman, if your using the script from here: note: |
|
mayurpatel
Joined: 2005-08-15
Posts: 7 |
![]() |
nm |
|