Integration of G2 showing a treeview of albums
aucupor
Joined: 2007-08-29
Posts: 2 |
![]() |
Hi folks, a customer has a large Gallery using G2 that isn't embedded in the rest of his web page yet. Now, I have to show a simple page in the page's style that shows a treeview of available albums (and perhaps the number of containing items). I've already found some examples that show how to integrate G2 into a page but I didn't found Can somebody give me a hint? Thanks in advance, |
|
capt_kirk
Joined: 2006-01-24
Posts: 492 |
![]() |
I just did this for G2Image v3.0. Take a look at g2ic_make_html_album_tree in g2image.php. I used the dtree script (like the album select module does). You'll need to modify the link generated in g2ic_make_html_album_tree_branches to fit your needs. Hope that helps or points you in the right direction. Kirk |
|
aucupor
Joined: 2007-08-29
Posts: 2 |
![]() |
Hi Kirk, many thanks for the tip, your code was very useful for me. (This is only a quick & dirty pre-solution ;) Johannes <html> <body> <?php runGallery(); function runGallery() { require_once('../embed.php'); // change this! $init = GalleryEmbed::init(array('fullInit' => true)); if (GalleryUtilities::isCompatibleWithApi(array(7,5), GalleryCoreApi::getApiVersion())) { print g2ic_make_html_album_tree($rootAlbum); } function g2ic_make_html_album_tree($root_album){ $parent = -1; function g2ic_make_html_album_tree_branches($current_album, $parent, &$node) { // global $g2ic_options; list ($error,$items) = GalleryCoreApi::loadEntitiesById(array($current_album)); $html .= "<ul>". } list($error, $sub_albums) = GalleryCoreApi::fetchAlbumTree($current_album,1); $albums = array_keys($sub_albums); if (count($albums) > 0) { $html .= "</ul>"; return $html; ?> </body> |
|