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

 
Dịch vụ rút tiền mặt thẻ tín dụng rút tiền mặt trong 5 phút mất 1%

Dịch vụ rút tiền mặt thẻ tín dụng rút tiền mặt trong 5 phút mất 1%

Dịch vụ rút tiền mặt từ thẻ tín dụng ra đời với tính tiện dụng đã giúp ích cho rất nhiều khách hàng gặp khó khăn trong vấn đề tài chính.

Headless Websites: Ý kiến và bổ sung nội dung cho Headless Drupal

Headless Websites: Ý kiến và bổ sung nội dung cho Headless Drupal

Headless Drupal is officially now "a thing". It's all happening. If you're curious why this is exciting people, see my previous blog post on the topic

CES 2012 - Được và chưa được

CES 2012 - Được và chưa được

CES 2012 đã kết thúc, đây là sự kiện giúp cho người dùng hiểu hơn về xu thế công nghệ trong thời gian tới

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

 

Diet con trung