- Timestamp:
- May 19, 2019 10:50:51 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Navigation.inc.php
r590 r682 258 258 * @return string Breadcrumbs or empty string if breadcrumbs param not set. 259 259 */ 260 public function getBreadcrumbsArray( )260 public function getBreadcrumbsArray($carry_args=null) 261 261 { 262 262 $app =& App::getInstance(); … … 270 270 break; 271 271 } 272 if (!is_null($carry_args)) { 273 // If this function is called with $carry_args, employ the ohref() method. 274 $url = $app->ohref($page['url'], $carry_args); 275 } else { 276 // Otherwise let the URL pass through as-is (the wise developer must have provided the correct URL when calling $nav->add(âŠ)). 277 $url = $page['url']; 278 } 272 279 if ($crumb_count <= 1) { 273 280 // The last crumb. 274 281 if ('' == trim($page['url']) || $crumb_count <= $this->getParam('chop_breadcrumb_links')) { 275 // A crumb with no link.282 // A last crumb with no link. 276 283 $breadcrumbs[] = array( 277 'url' => $_SERVER['REQUEST_URI'],284 'url' => false, 278 285 'title' => sprintf($this->getParam('last_crumb_format'), $page['title']), 279 286 'class' => 'current' 280 287 ); 281 288 } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) { 282 // A normallinked crumb.289 // A last linked crumb. 283 290 $breadcrumbs[] = array( 284 'url' => $ page['url'],291 'url' => $url, 285 292 'title' => sprintf($this->getParam('last_crumb_format'), $page['title']), 286 293 'class' => '', … … 298 305 // A normal linked crumb. 299 306 $breadcrumbs[] = array( 300 'url' => $ page['url'],307 'url' => $url, 301 308 'title' => $page['title'], 302 309 'class' => '', … … 319 326 * @return string Breadcrumbs or empty string if breadcrumbs param not set. 320 327 */ 321 public function getBreadcrumbs( )328 public function getBreadcrumbs($carry_args=null) 322 329 { 323 330 $app =& App::getInstance(); … … 332 339 break; 333 340 } 341 if (!is_null($carry_args)) { 342 // If this function is called with $carry_args, employ the ohref() method. 343 $url = $app->ohref($page['url'], $carry_args); 344 } else { 345 // Otherwise let the URL pass through as-is (the wise developer must have provided the correct URL when calling $nav->add(âŠ)). 346 $url = $page['url']; 347 } 334 348 if ($crumb_count <= 1) { 335 349 // The last crumb. 336 350 if ('' == trim($page['url']) || $crumb_count <= $this->getParam('chop_breadcrumb_links')) { 337 // A crumb with no link.351 // A last crumb with no link. 338 352 $breadcrumbs[] = sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)); 339 353 } else if ($crumb_count > $this->getParam('chop_breadcrumb_links')) { 340 // A normallinked crumb.341 $breadcrumbs[] = '<a href="' . $ page['url']. '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>';354 // A last linked crumb. 355 $breadcrumbs[] = '<a href="' . $url . '">' . sprintf($this->getParam('last_crumb_format'), oTxt($page['title'], true)) . '</a>'; 342 356 } 343 357 } else { … … 347 361 } else { 348 362 // A normal linked crumb. 349 $breadcrumbs[] = '<a href="' . $ page['url']. '">' . oTxt($page['title'], true) . '</a>';363 $breadcrumbs[] = '<a href="' . $url . '">' . oTxt($page['title'], true) . '</a>'; 350 364 } 351 365 } … … 369 383 * @since 07 Sep 2014 12:22:19 370 384 */ 371 public function getBreadcrumbsUL() 372 { 385 public function getBreadcrumbsUL($carry_args=null, $ul_open_tag='<ul class="breadcrumbs">') 386 { 387 $app =& App::getInstance(); 388 373 389 $out = ''; 374 $breadcrumbs = $this->getBreadcrumbsArray( );390 $breadcrumbs = $this->getBreadcrumbsArray($carry_args); 375 391 if (!empty($breadcrumbs)) { 376 $out = '<ul class="breadcrumbs">';392 $out = $ul_open_tag; 377 393 foreach ($breadcrumbs as $b) { 378 394 $printclass = '' != $b['class'] ? sprintf(' class="%s"', $b['class']) : ''; 379 $out .= sprintf('<li%s><a href="%s">%s</a></li>', $printclass, $b['url'], $b['title']); 395 if ('' == trim($b['url'])) { 396 // A crumb with no link. 397 $out .= sprintf('<li%s>%s</li>', $printclass, $b['title']); 398 } else { 399 // A normal linked crumb. 400 $out .= sprintf('<li%s><a href="%s">%s</a></li>', $printclass, $b['url'], $b['title']); 401 } 380 402 } 381 403 $out .= '</ul>';
Note: See TracChangeset
for help on using the changeset viewer.