Thêm Custom Breadcrumbs cho Views Pages

Thêm Custom Breadcrumbs cho Views Pages

Recently I needed to add custom breadcrumbs to views 2 generated pages. Now we were using excellent custom_breadcrumbs 1.x to add custom breadcrumbs on site. At that time I discovered that 1.x version of custom_breadcrumbs do not support views generated pages and 2.x version of module (which supports views) is not production stable. So I came up with this solution to create custom breadcrumbs for views pages:

Lets say we have a page view with structure
---Team (menu item)
   |
   |---Featured 1 (tab-default)
   |
   |---Featured 2 (tab)
   |
   |---Featured 3 (tab)

Now instead of having a breadcrumb like "Home ›" OR "Home › Team " we need  something like "Home › Our Team › Featured 1" for default tab. To accomplish this we need to add following php code in header section of view page with php filter enabled.

<?php
global $base_url;
$breadcrumb[] = l(#DD0000">'Home', null);
$breadcrumb[] .= l(#DD0000">'Our Team', #DD0000">'team');
$breadcrumb[] .= l(drupal_get_title(), $base_url.$_SERVER[#DD0000">'REQUEST_URI']);
drupal_set_breadcrumb($breadcrumb);
?>

Now this custom php will set new breadcrumb of page as:

Thêm Custom Breadcrumbs cho Views Pages

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 

David Baker chia sẻ 11 suy nghĩ cần thiết cho Drupal team

There was an article by David Baker that caught my attention. David is a long-time consultant for the web agency marketplace who offers blunt

Quảng cáo tìm kiếm tại VN: Sơ khai nhưng tiềm năng

Quảng cáo tìm kiếm tại VN: Sơ khai nhưng tiềm năng

Dung lượng thị trường Quảng cáo Tìm kiếm Việt Nam vào khoảng 100 triệu USD. Hiện tại, năm 2010 doanh số ngành mới chiếm khoảng 5 triệu USD. Vì vậy có thể nói tiềm năng thị trường còn rất lớn.

CMS WordPress

Thủ thuật tối ưu hóa WordPress – nâng cao

Liệu blog của bạn đã đạt tốc độ cao nhất chưa? Tốc độ load trang có nhanh hay không? Tốc độ khi truy cập là một trong những nhân tố chính tạo sự thiện cảm cho khách viếng thăm. Do vậy Misao nghĩ bạn nên dành thời gian để tu bổ/ tối ưu hóa trang web của mình. Trong bài viết này, tôi sẽ liệt kê một vài thủ thuật khác nhau giúp bạn tăng tốc cho blog WordPress của mình.

Công ty diệt chuột T&C

 

Diet con trung