/** * Build the breadcrumbs. * * @return string */ public function build() { $format = array(); $pieces = explode('/', $this->category); $pieces[] = $this->page; $temp = array(); foreach ($pieces as $item) { if (empty($item)) { continue; } $temp[] = $item; $checkForName = ltrim(implode('/', $temp), '/'); $format[] = \App\findName($checkForName); } $ret = '<a href="' . \App\getBaseUrl() . '">' . BD_NAME . '</a>'; if (sizeof($format) == 1) { return $ret . $this->separator . $format['0']; } else { return $ret . $this->separator . implode($this->separator, $format); } }
/** * Builds a "<ul>" element for use within the views. * * @param array $array * * @return string */ private function buildUl(array $array) { $output = array(); $out = "<ul>"; foreach ($array as $key => $elem) { if (!is_array($elem)) { parse_str($elem, $output); if (!empty($output['?c'])) { $check = $output['?c'] . '/' . $output['p']; } else { $check = $output['p']; } if ($check == $this->link) { $class = 'active'; } else { $class = ''; } $key = \App\findName($check); $out .= "<li class=\"{$class}\"><a href=\"" . $elem . "\">" . $key . "</a></li>"; } else { $out .= "<li><span class=\"subTitle\">" . $key . "</span>" . $this->buildUl($elem) . "</li>"; } } $out .= "</ul>"; return $out; }