From: Nicolas Boisselier Date: Sat, 26 Mar 2016 21:38:27 +0000 (+0000) Subject: Fix bug no title when link on all nav X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=d33da8fd6148d93a2fc47ddd53e47f9d923473a8;p=nb.git Fix bug no title when link on all nav --- 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; }