Basic Integration Questions - Real Beginner Stuff :)
drewread
Joined: 2004-12-07
Posts: 8 |
Posted: Tue, 2007-02-06 19:41 |
OK.. Here goes. Try not to flame me too hard. I have read the documentation and am still having problems integrating gallery into my CMS. My CMS is essentially a custom CMS which is built in Dreamweaver and based on Interakt Onlines (bought by Adobe) MX Kollection (www.interaktonline.com) My first problem is that I am having problems getting the site to properly integrate into the sites web page. As you can see it is integrated, however, when I login and edit anything I get a header output error message. It is very likely that I don't understand where to put the embeded Gallery code. Anyways.. here is the code for that page. Any help would be appreciated. Thanks. <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/mainAMv1.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <?php require_once('Connections/amwedpub.php'); ?> <?php mysql_select_db($database_amwedpub, $amwedpub); $query_getHeader = "SELECT headFile FROM ws_headers WHERE headVis = 1 ORDER BY RAND() LIMIT 1"; $getHeader = mysql_query($query_getHeader, $amwedpub) or die(mysql_error()); $row_getHeader = mysql_fetch_assoc($getHeader); $totalRows_getHeader = mysql_num_rows($getHeader); ?> <!-- InstanceBeginEditable name="doctitle" --> <title>Alexandra Read and Morgan Ireland's Wedding Site - Image Gallery</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="styles/am_lay.css" rel="stylesheet" type="text/css" /> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <link href="styles/am_text.css" rel="stylesheet" type="text/css" /> <link href="styles/am_menu.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrap"> <div id="header"><img src="uploads/headers/<?php echo $row_getHeader['headFile']; ?>" alt="Header 1" width="770" height="130" /></div> <div id="subHead"></div> <div id="main-content"> <!-- InstanceBeginEditable name="Document body" --> <img src="images/amV1/gallery.jpg" alt="Gallery Header" width="488" height="62" /> <?php require_once('gallery2/G2emAPPS/g2embed.php'); ?> <? echo "USERID: " . $uid . "INTERAKT SESSION LOGIN ID: " . $_SESSION['kt_login_id']; ?> <!-- InstanceEndEditable --></div> <div id="sub-content"> <div id="nav"> <img src="images/amV1/smDivider.jpg" alt="small divider" width="142" height="12" /> <ul> <li><a href="pastUpd.php">Past Updates</a></li> <li><a href="links.php">Links</a></li> <li><a href="gallery.php">Image Gallery</a></li> <li><a href="mailto:alexread@sympatico.ca?subject=Your Wedding...">Contact Us</a></li> <li><a href="index.php">Home</a></li> <li><a href="login.php">Login</a></li> </ul> <img src="images/amV1/smDivider.jpg" alt="small divider" width="142" height="12" /> </div> <? $wedDate = "2007-02-22"; // set the wedding date $todayDate = date("Y-m-d"); // get todays date $weddingDay = strtotime($wedDate); $today = strtotime($todayDate); $ETA = ($weddingDay / 86400) - ($today / 86400); ?> <h1>Only <? echo number_format($ETA); ?> days until the Wedding!</h1> </div> <div id="foot"> <ul class="hidden-navigation"> <li><a href="#navigations" title="Jump to the main navigation">Skip to navigation</a></li> <li><a href="#header" title="Jump to the top of the page">Top of the page</a></li> </ul> <div id="footC"> <hr /> <p>Site Designed by: <a href="http://www.readit.ca" target="_blank">Read Consulting Services</a></p> <p>Copyright © <? echo date('Y'); ?> Read Consulting Services. All Rights Reserved.</p> </div> </div> <!-- end #wrap --> </div> </body> <!-- InstanceEnd --></html> <?php mysql_free_result($getHeader); ?> Here is the g2embed.php file: <? function runGallery() { require_once('./gallery2/embed.php'); $data = array(); // if anonymous user, set g2 activeUser to '' $uid = $_SESSION['kt_login_id']; // initiate G2 $ret = GalleryEmbed::init(array('g2Uri' => '/gallery2/', 'embedUri' => '/gallery2.php', 'loginRedirect' => '/login.php', 'activeUserId' => $uid)); if ($ret) { $data['bodyHtml'] = $ret->getAsHtml(); return $data; } if (!headers_sent()) { //set header type to acceptable type for gallery2 header('Content-Type: text/html; charset=UTF-8'); } // user interface: you could disable sidebar in G2 and get it as separate HTML to put it into a block // GalleryCapabilities::set('showSidebarBlocks', false); 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'])) { $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 */ $data['javascript'] = ''; if (!empty($javascript)) { foreach ($javascript as $script) { $data['javascript'] .= "\n".$script; } } /* Add G2 css */ $data['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; } ?> <? $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; } ?> |
|
Posts: 32509
looks mostly good.
you should remove the newline/space characters between the function block and the $data = runGallery() code.
--------------
Enter the Gallery 2 Theme Contest today!
Posts: 8
OK so it is about time that I get off my rear and get this figured out as I have another client interested in a gallery integration as well...
Valiant - thanks for the tip.. I removed the line return, actually I deleted the php close and open '?> <?' altogether. I still seem to be having problems with "header already processed" messages when I try to do anything with the gallery (add, delete, edit, etc.)
This kind of makes sense as I do have the include for the g2embed.php file within the gallery2.php file after the pages headers are already sent. However, if I move the g2embed.php include to the start of the gallery2.php file the gallery exists outside of my site layout.
Maybe I am just not understanding something really simple here.. do I need to make a visually integrated theme first then call the g2embed.php file from within a blank file?
Thanks in Advance for any help that I receive!
Drew Read