if (!$this->content_type()) $this->content_type($this->client_content_type());
// Nav
+ $links = [];
if (isset($opt['nav'])) {
- list($title,$nav) = self::nav_parse($opt['nav']);
- if ( empty($this->h1) ) $this->h1 = join($this->sep,$nav);
+ list($title,$html) = self::nav_parse($opt['nav']);
+ if ( empty($this->h1) ) $this->h1 = join($this->sep,$html);
+ if ( empty($this->title) ) $this->title = join($this->sep,$title);
unset($opt['nav']);
}
# NB 06.12.16 if ( empty($this->title) ) $this->title = !empty($title) ? join($this->sep,$title) : $this->filename2title();
parent::__construct($opt);
// Defaults
- if ( empty($this->title) ) $this->title = !empty($nav) ? join($this->sep,$nav) : $this->filename2title();
+ if (empty($this->title)) $this->title = $this->filename2title();
+ if ( empty($this->h1) and ! empty($this->title)) $this->h1 = $this->title;
// Call / Print
if (!empty($this->call)) $this->call($this->call);
public static function nav_parse($array) {
#$v = &$sep;
+ $hash = [];
foreach ($array as $k => $v) {
if ($v === '' or $v === null or empty($v[0])) {
continue;
if (is_array($v)) {
if (count($v)==3) {
- $title[] = $v[0];
- $nav[] = empty($v[2]) ? $v[1] : self::tag('a',$v[1],'href="'.$v[2].'"');
+ $text = $v[0];
+ $html = empty($v[2]) ? $v[1] : self::tag('a',$v[1],'href="'.$v[2].'"');
} else {
- $title[] = $v[0];
- $nav[] = empty($v[1]) ? $v[0] : self::tag('a',$v[0],'href="'.$v[1].'"');
+ $text = $v[0];
+ $html = empty($v[1]) ? $v[0] : self::tag('a',$v[0],'href="'.$v[1].'"');
}
} else {
- $title[] = $v;
- $nav[] = self::tag('span',$v);
+ $text = $v;
+ $html = self::tag('span',$v);
}
+ $title[] = $text;
+ $nav[] = $html;
+ $hash[$text] = $html;
+
}
- return [$title,$nav];
- return [
- 'title' => $title,
- 'title' => $title,
- ];
+ return [$title,$nav,$hash];
}
public static function phpinfo() {