Fix some layout issues when browsing through the group list
[platal.git] / classes / Platal.php
index a052193..88e0650 100644 (file)
@@ -41,11 +41,25 @@ class Platal
 
         array_unshift($modules, 'core');
         foreach ($modules as $module) {
-            $this->__mods[$module] = $m = PLModule::factory($this, $module);
+            $this->__mods[$module] = $m = PLModule::factory($module);
             $this->__hooks += $m->handlers();
         }
     }
 
+    function pl_self($n = null)
+    {
+        if (is_null($n))
+            return $this->path;
+
+        if ($n >= 0)
+            return join('/', array_slice($this->argv, 0, $n + 1));
+
+        if ($n <= -count($this->argv))
+            return $this->argv[0];
+
+        return join('/', array_slice($this->argv, 0, $n));
+    }
+
     function find_hook()
     {
         $p = $this->path;