From d33da8fd6148d93a2fc47ddd53e47f9d923473a8 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 26 Mar 2016 21:38:27 +0000 Subject: [PATCH] Fix bug no title when link on all nav --- lib/php/page.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/php/page.php b/lib/php/page.php index 7ab03d11..0df3e42d 100644 --- a/lib/php/page.php +++ b/lib/php/page.php @@ -157,9 +157,19 @@ class Page extends nb { return htmlspecialchars($v,$replace_flags,$charset); } -# NB 04.08.15 function tag($content='',$tag,$attrs='') { function tag($tag,$content='',$attrs='') { + # Extract attrs from tag + if (preg_match('/^([\w-]+)\s+(.*?)$/',$tag,$m)) { + $tag = $m[1]; + $attrs = trim($attrs.' '.$m[2]); + } + + if ($content===null) { + $this->end_tag($tag); + return '<' . $tag . ($attrs ? " $attrs" : "") . '>'; + } + if (!is_array($content)) $content = array($content); $tags = array(); @@ -240,9 +250,22 @@ class Page extends nb { } + function end_tag($tag=null) { + static $tags = array(); + if ($tag !== null) return array_unshift($tags,$tag); + foreach ($tags as $t) echo "".NB_EOL; + $tags = array(); + return false; + return join('',self::ar_map('',$tags)); + if ($tag === null) return $tags; + array_unshift($tags,$tag); + } + function end() { if (preg_match('/ml$/',$this->content_type)) { + #foreach ($this->end_tag() as $t) echo "".NB_EOL; + $this->end_tag(); echo '' . NB_EOL; echo '' . NB_EOL; } -- 2.47.3