Mercurial > hg > mgallery
comparison mgallery.php @ 31:300396947f04
Remove slight code duplication by factoring to a helper function.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 23 Apr 2016 19:38:36 +0300 |
parents | 8cf743c7ea23 |
children | 953b0f7636f4 |
comparison
equal
deleted
inserted
replaced
30:f2c21a8b9071 | 31:300396947f04 |
---|---|
228 if (($str = mgGetSetting("page_info")) !== FALSE) | 228 if (($str = mgGetSetting("page_info")) !== FALSE) |
229 echo "<div class=\"pageInfoFooter\">".$str."</div>"; | 229 echo "<div class=\"pageInfoFooter\">".$str."</div>"; |
230 } | 230 } |
231 | 231 |
232 | 232 |
233 function mgGetBreadCrump($class, &$pdata) | |
234 { | |
235 return | |
236 "<a class=\"".$class."\" href=\"".mgGetURL($pdata["path"], FALSE)."\">". | |
237 chentities($pdata["caption"])."</a>"; | |
238 } | |
239 | |
240 | |
233 function mgPrintBreadCrumbs($galData) | 241 function mgPrintBreadCrumbs($galData) |
234 { | 242 { |
235 $res = array(); | 243 $res = array(); |
236 if ($galData["caption"]) | 244 if ($galData["caption"]) |
237 $res[] = "<a class=\"naviBreadCrumbCurr\" href=\"".mgGetURL($galData["path"], FALSE)."\">".chentities($galData["caption"])."</a>"; | 245 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData); |
238 | 246 |
239 $tmp = $galData; | 247 $tmp = $galData; |
240 while (isset($tmp["parent"])) | 248 while (isset($tmp["parent"])) |
241 { | 249 { |
242 $pdata = $tmp["parent"]; | 250 $pdata = $tmp["parent"]; |
243 $res[] = "<a class=\"naviBreadCrumbItem\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".chentities($pdata["caption"])."</a>"; | 251 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata); |
244 $tmp = $tmp["parent"]; | 252 $tmp = $tmp["parent"]; |
245 } | 253 } |
246 | 254 |
247 if (count($res) > 1) | 255 if (count($res) > 1) |
248 { | 256 { |