comparison mgallery.php @ 3:c85f630a4198

Improve bread crumb navigation by making the current album a link as well.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 15 May 2015 06:53:30 +0300
parents ac688606ec4b
children 014e1d6991a3
comparison
equal deleted inserted replaced
2:24b45acc59e4 3:c85f630a4198
202 202
203 function mgPrintBreadCrumbs($galData) 203 function mgPrintBreadCrumbs($galData)
204 { 204 {
205 $res = array(); 205 $res = array();
206 if ($galData["caption"]) 206 if ($galData["caption"])
207 $res[] = chentities($galData["caption"]); 207 $res[] = "<a class=\"naviBreadCrumbCurr\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".chentities($galData["caption"])."</a>";
208 208
209 $tmp = $galData; 209 $tmp = $galData;
210 while (isset($tmp["parent"])) 210 while (isset($tmp["parent"]))
211 { 211 {
212 $pdata = $tmp["parent"]; 212 $pdata = $tmp["parent"];
213 $res[] = "<a href=\"".mgGetURL($pdata["path"], FALSE)."\">".chentities($pdata["caption"])."</a>"; 213 $res[] = "<a class=\"naviBreadCrumbItem\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".chentities($pdata["caption"])."</a>";
214 $tmp = $tmp["parent"]; 214 $tmp = $tmp["parent"];
215 } 215 }
216 216
217 if (count($res) > 1) 217 if (count($res) > 1)
218 { 218 {
219 $res = array_map(function ($a) { return "<span class=\"naviBreadCrumbItem\">".$a."</span>"; }, $res);
220 echo 219 echo
221 "<div class=\"naviBreadCrumbs\">". 220 "<div class=\"naviBreadCrumbs\">".
222 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)). 221 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)).
223 "</div>\n"; 222 "</div>\n";
224 } 223 }