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

 
Instagram Tips – Use Instagram Like a Pro

Instagram Tips – Use Instagram Like a Pro

Instagram is one of the most popular app available for Apple iOS and very soon it was available for Android users.

Facebook muốn tặng không smartphone cho người dùng

Facebook muốn tặng không smartphone cho người dùng

Hôm qua (25/11), trang công nghệ Businessinsider dẫn lời 2 nguồn tin thân cận với dự án Facebook Phone, cho biết giới lãnh đạo mong muốn tặng không dế cưng cho người dùng.

Sergio Aguero mua tặng siêu xe McLaren Spider có giá 166.000 bảng

Hai đồng đội của Sergio Aguero là Benjamin Mendy và Fabian Delph đã công nhận điều này trong cuộc trả lời vấn đáp nhanh với ứng dụng trực tuyến hẹn hò Tinder cuối năm ngoái.

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

 

Diet con trung