Need help formatting page, after embedding via php-include.

ravenslay3r

Joined: 2006-10-10
Posts: 1
Posted: Tue, 2006-10-10 17:25

I'm trying to "seemelessly-embed" a view of my gallery into the mainflow of my web-site as if it was just another page. Functionally I have it working, but as you can see here: My-Site, Gallery Embedded, I need some help polishing off the layout.

I think I have to copy the applicable CSS rules into my own CSS sheet so their already available ahead of time. I also need to know how to control the number of columns displayed (or let CSS handle it on the fly), and control the default size of an image when it's clicked - to fit in the window.

If thse could both be done on-the-fly it would be great as the enxt web-site i'm applying this to is a liquid-layout. (Actually this is just a dry-run for setting up Gallery2 on my companies site).

As you can probably tell, my site has one index with all sub-parts including each pages main-content PHP-included. Additonally the entire page is written to a $output var and echoed only once the page is complete.

Thanks for any help!
~ Raven

So far I've been looking at these threads/articles:
http://gallery.menalto.com/node/36918
http://codex.gallery2.org/index.php/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode
http://codex.gallery2.org/index.php/Gallery2:Embedding#Code_Snippets
etc.

My site:
(unembedded): http://stevengpeterson.com/gallery
(embedded): http://stevengpeterson.com/?aboutme&gallery

gallery.php (AKA: gallery2embedded.php)

<?php
   $output .= "
   <h2 class=\"orange\"><span>My Photo Gallery</span></h2>";


   //-----------------------------------
   //   Begin Gallery2 Code
   $g2_Config['path'] = dirname(__FILE__) . '/../gallery/';

   $g2_Config['embedPath'] = '../php/';
   $g2_Config['g2Uri'] = '?aboutme&gallery';
   $g2_Config['loginredirect'] = '../?aboutme&gallery';
   $g2_Config['embedUri'] = '?aboutme&gallery';

   //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',false);
   GalleryCapabilities::set('showSidebarBlocks',false);

   // 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;
   }

   // get css & javascript
   //if (isset($g2moddata['headHtml']))
   //{
   //   list($title, $css, $javascript)
   //      = GalleryEmbed::parseHead($g2moddata['headHtml']);
   //}
   //$output .= $headHtml;

   // die if it was a binary data (image) request
   if ($g2moddata['isDone'])
   {
      exit; /* uploads module does this too */
   }

   if ($ret)
   {
      print $ret->getAsHtml();
   }

   //Write Gallery code to output-var
   $output .= $g2moddata['bodyHtml'];


   //   END Gallery2 Code
   //-----------------------------------
?>