John Davidson

php - Make breadcrumb from multidimensional array

0 comments
Message:


Array
(
[0] => Array
(
[id] => 68
[cat_name] => Business Insurance
[cat_slug] => business-insurance
[is_parent] => 67
[parent] => Array
(
[0] => Array
(
[id] => 67
[cat_name] => Insurance
[cat_slug] => insurance
[is_parent] => 65
[parent] => Array
(
[0] => Array
(
[id] => 65
[cat_name] => Finance and Investment
[cat_slug] => finance-and-investment
[is_parent] => 47
[parent] => Array
(
[0] => Array
(
[id] => 47
[cat_name] => Business & Economy
[cat_slug] => business-economy
[is_parent] => 0
)
)
)
)
)
)
)
)



I need a recursive function for Codeignitor which will show the above array as Business & Economy -> Finance and Investment -> Insurance -> Business Insurance as the breadcrumb. Please help.



My Answer:
array('Home', 'index.php'),
array('Products', 'products.php'),
array('Category', 'category.php'),
array('Subcategory', 'subcategory.php')
);

$breadcrumb = 'Home > Products > Category > Subcategory';

echo $breadcrumb;

Rate this post

4 of 5 based on 3291 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us