Project

General

Profile

« Previous | Next » 

Revision c50f228a

Added by Phil Davis over 8 years ago

Breadcrumb links support

View differences:

src/usr/local/www/guiconfig.inc
492 492
	}
493 493
}
494 494

  
495
function genhtmltitle($title) {
495
function genhtmltitle($title, $links=array()) {
496 496

  
497 497
	// If the array contains only one element, there are no breadcrumbs, so don't
498 498
	// add anything else
499 499
	if (count($title) > 1) {
500 500
		$bc = '<ol class="breadcrumb">';
501 501

  
502
		foreach ($title as $el) {
503
			$bc .= '<li>'.$el.'</li>';
502
		foreach ($title as $idx => $el) {
503
			$href = $links[$idx];
504
			if (strlen($href) > 0) {
505
				// For convenience, if the caller specifies '@self' then make a link
506
				// to the current page, including any query string.
507
				if ($href == '@self') {
508
					$href = $_SERVER['REQUEST_URI'];
509
				}
510
				if (substr($href, 0, 1) != '/') {
511
					$href = '/' . $href;
512
				}
513
				$bc .= '<li><a href="' . htmlentities($href) . '">' . $el . '</a></li>';
514
			} else {
515
				$bc .= '<li>' . $el . '</li>';
516
			}
504 517
		}
505 518

  
506 519
		$bc .= '</ol>';
src/usr/local/www/head.inc
514 514
		print('<br />');
515 515
		unset($notitle);
516 516
	} else {
517
		print(genhtmltitle($pgtitle));
517
		print(genhtmltitle($pgtitle, $pglinks));
518 518
	}
519 519
?>
520 520
		<ul class="context-links">

Also available in: Unified diff