id catename parent id
1 Gối 0
2 Hello kitty 0
3 Gối xinh 1
4 Hello kitty xinh 2
base_url: http://localhost/shop
my url:
<a href="http://localhost/shop/san-pham/1/goi.html">http://localhost/shop/san-pham/1/goi.html</a>
<a href="http://localhost/shop/san-pham/2/hello-kitty.html">http://localhost/shop/san-pham/2/hello-kitty.html</a>
<a href="http://localhost/shop/san-pham/3/goi-xinh.html">http://localhost/shop/san-pham/3/goi-xinh.html</a>
<a href="http://localhost/shop/san-pham/4/hello-kitty-xinh.html">http://localhost/shop/san-pham/4/hello-kitty-xinh.html</a>
i want to display breadcrumb:
<a href="http://localhost/shop/san-pham/1/goi.html">http://localhost/shop/san-pham/1/goi.html</a> -> Trang chủ // Sản phẩm // Gối
<a href="http://localhost/shop/san-pham/2/hello-kitty.html">http://localhost/shop/san-pham/2/hello-kitty.html</a> -> Trang chủ // Sản phẩm // Hello kitty
<a href="http://localhost/shop/san-pham/3/goi-xinh.html">http://localhost/shop/san-pham/3/goi-xinh.html</a> -> Trang chủ // Sản phẩm // Gối // Gối xinih
<a href="http://localhost/shop/san-pham/4/hello-kitty-xinh.html">http://localhost/shop/san-pham/4/hello-kitty-xinh.html</a> -> Trang chủ // Sản phẩm // Hello kitty // Hello kitty xinh
Please help me!
Hi,
You can use this line on your controller:
$param = $this->uri->segment(2);
if ($param == 1 || $param == 2) {
$replace_value = ' ';
} elseif ($param == 3) {
$replace_value = ' Gối';
} elseif ($param == 4) {
$replace_value = 'Hello kitty';
}
$this->config->load('breadcrumb');
$this->config->set_item('replacer_embed', array($param=>$replace_value));
Yeah, sure those code only show you a simple logic but I hope you catch the idea