changeset 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 f2c21a8b9071
children 953b0f7636f4
files mgallery.php
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mgallery.php	Sat Apr 23 19:36:31 2016 +0300
+++ b/mgallery.php	Sat Apr 23 19:38:36 2016 +0300
@@ -230,17 +230,25 @@
 }
 
 
+function mgGetBreadCrump($class, &$pdata)
+{
+  return
+    "<a class=\"".$class."\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".
+    chentities($pdata["caption"])."</a>";
+}
+
+
 function mgPrintBreadCrumbs($galData)
 {
   $res = array();
   if ($galData["caption"])
-    $res[] = "<a class=\"naviBreadCrumbCurr\" href=\"".mgGetURL($galData["path"], FALSE)."\">".chentities($galData["caption"])."</a>";
+    $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData);
 
   $tmp = $galData;
   while (isset($tmp["parent"]))
   {
     $pdata = $tmp["parent"];
-    $res[] = "<a class=\"naviBreadCrumbItem\" href=\"".mgGetURL($pdata["path"], FALSE)."\">".chentities($pdata["caption"])."</a>";
+    $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata);
     $tmp = $tmp["parent"];
   }