more html blocks for GalleryEmbed

valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-04-26 20:49

Alex Zubovsky wrote a few mails in the devel-mailinglist. We will continue the discussion here.

most parts of this post are just snippets from his mails.

Additional html blocks for GalleryEmbed: pathbarHtml and navigationbarHtml

addition to documentation: usage of GalleryEmbed::getSystemContent:

.........
 GalleryCapabilities::set("showSidebar", false);
 GalleryCapabilities::set("showSidebarGreeting",false);
 GalleryCapabilities::set("showPathbar", false);
 
    $g2data = GalleryEmbed::handleRequest();
    if ($g2data["isDone"]) {
      exit; // G2 has already sent output (redirect or binary data)
    }
 
 if($g2data["sidebarHtml"] != ""){
 	list($ret, $gallerySearchBox) = GalleryEmbed::getSystemContent("search",  
 "searchBox");
// handle $ret->isError() here
 	$galleryBox = $g2data["sidebarHtml"];
 }else{
 	$galleryBox = $g2data["navigationbarHtml"];
 }
 $galleryPath = $g2data["pathbarHtml"];

corresponding main.php changes:

 main.php modifications:
 
 .........
 	    if (isset($layout["show"]["sidebar"]) && $layout["show"]["sidebar"]  
 === false) {
 		/*
 		 * Render sidebar and return as separate block of content if
 		 * embedding app requested no sidebar in G2 content..
 		 */
 		$layout["show"]["sidebar"] = true;
 		list ($ret, $data["sidebarHtml"]) =
 		    $template->fetch("gallery:templates/sidebar.tpl");
 		if ($ret->isError()) {
 		    return array($ret->wrap(__FILE__, __LINE__), null);
 		}
 	    }
 	}else{
 		$layout["show"]["navigationbar"] = true;
 		list ($ret, $data["navigationbarHtml"]) =
 		     
 $template->fetch("gallery:modules/core/templates/NavigationSidebar.tpl");
 		if ($ret->isError()) {
 		    return array($ret->wrap(__FILE__, __LINE__), null);
 		}
 	}
 
 	$layout["show"]["pathbar"] = true;
 	list ($ret, $data["pathbarHtml"]) =
 	    $template->fetch("gallery:templates/pathbar.tpl");
 	if ($ret->isError()) {
 	    return array($ret->wrap(__FILE__, __LINE__), null);
 	}
 
 	return array(GalleryStatus::success(), $data);
      }
 
 
      return array(GalleryStatus::success(), array("isDone" => true));
 
 }

Have you a demo url where we can see the results? Seems to be a good addition.

mindless, could you fix his G2 coding style/mistakes and add the pathbarHtml and navigationbarHtml to main.php? Or can't we get the pathbarHtml and navigationbarHtml by something like a GalleryEmbed::getSystemContent call?

Quote:
Gallery templates are located in many different folders and sometimes it"s
difficult to understand which template body is using. Maybe it"s better to
have one folder with all templates? Now you have at list three - layouts/,
modules/, templates/ and themes in addition. :) Maybe it"s better to have
a theme folder with following folders above and if some template is
missing the gallery will use default template (from modules/core or
templates/ folder)?

It's very unlikely that we will change it as you suggest. There are numerous reasons why it is as it is. There will be some changes to the layout system though, which will simplify a few things.

templates

Quote:
..in addition. It could be nice to have standart theme (with a lot of
templates in the same folder), with all possible content variables into
$g2data array. Then anybody can copy standard theme into separate folder
and modify to get a new theme. In this way in will be two folders only -
theme and standard (default) as previous theme.

Again, the current architecture is powerful. If you want to come up with an alternative / fundamental change, it doesn't suffice to describe it very vaguely. Think it through, show how everything still works with your proposed change.
We decided that G2 should handle the complete templating for G2 pages. You can change the layout, template, theme, and css to match your emApp. That should be sufficient.
What layout variables do you need exactly?

Quote:
And also I think modules
cannot be template bodies. it should be part of standard or themed
template body.

what does that mean?

Quote:
For example I found that breadcrumb are different when
gallery uses SearchScan.tpl and new breadcrumb into modules template...
but I already finished with breadcrumb on the "main" page...

different? how? demo link?

side bar embedding

Quote:
Can somebody explaine the best way to split sidebar? There is a function
GalleryEmbed::parseHead($g2moddata["headHtml"]);
Maybe it could be better to have simular function for sidebar and to get
all elements of the sidebar into array using this function.

no, parsing it wouldn't be reliable and a pain. parseHead is a dirty hack IMO. Perhaps one should identify the blocks of sideBar that you wish to get.
Why don't you edit the sidebar.tpl template?

Quote:
The problem is that Random Image box and Picture Of The Day comes together
from the same module.
How can I split them?

Quote:
In addition to my previous post -- Sorry, I found getImageBlock function.

ok.