Welcome Guest, Not a member yet? Register   Sign In
Autocrumb - Lightweight Breadcrumb Helper (ver.12.05.1)

[eluser]fatangel26[/eluser]
Thanks for helper, but i have a problem: i have data of categories table :
Code:
id    catename      parent id
1      phone          0
2      laptop         0
3      samsung        1
4      apple          1
5       HP            2
6       Dell          2
I want to display breadcrumb :
url : "localhost/categories/display_product/1" -> breadcrumb : Home->Phone
url : "localhost/categories/display_product/2 -> breadcrumb : Home->Laptop
url : "localhost/categories/display_product/3 -> breadcrumb : Home->Phone->Samsung
url : "localhost/categories/display_product/5 -> breadcrumb : Home->Laptop->Dell
....
Sorry for my English Big Grin. Help me!

[eluser]ardinotow[/eluser]
Hi fatangel26,

I will not give the detail but rather I will give you the logic.
So, here it is:
1. The key concept is using replacer, please refer to bredcrumb config file.
2. Another concept is you can put replacer on controller (again, please read config). This mean you can process the replacer with database, i.e:
Code:
$this->config->load('breadcrumb');
$prod_id = $this->uri->segment(3);
$prod_name = $this->model_xxx->get_name($prod_id);
$parent_name = $this->model_xxx->get_parent($prod_id);
if ($parent_name) { // if has parent then add new breadcrumb trail
   // add & change breadcrumb (see breadcrumb config)
   $this->config->set_item('replacer_embed', array('categories'=>'', 'display_product'=>'', $prod_id=>array('/categories/display/product/'.$prod_id|$parent_name, '/categories/display/product/'.$prod_id|$prod_name));
} else { // don't have parent so just put the product name
   $this->config->set_item('replacer_embed', array('categories'=>'', 'display_product'=>'', $prod_id=>array('/categories/display/product/'.$prod_id|$prod_name));
}
Hope that could make you catch the ideas.
Please let me know your progress...

[eluser]fatangel26[/eluser]
Thanks ardinotow, i will try to do.
Update...Thanks ardinotow, i did success.

[eluser]Unknown[/eluser]
please help me, i have like in breadcrumb http://localhost/ci_final/?admin/submenu/
i want remove ?, please help me!

[eluser]transformer[/eluser]
this helper really help me thanks. I also add urldecode to this code
/* --- End Patch --- */

$uri = urldecode(rtrim($CI->uri->uri_string(),'/'));
$uri_array_original = explode("/", $uri);

// cahva's fix (http://codeigniter.com/forums/viewreply/855097/)

this will help if you forget to decode your url like having space on your url
www.example.com/search[percent twenty]data
your breadcrumb
home > search data

[eluser]transformer[/eluser]
[quote author="mr_minh89" date="1347642689"]please help me, i have like in breadcrumb http://localhost/ci_final/?admin/submenu/
i want remove ?, please help me![/quote]

maybe you can change

$config['partial_replace'] = array('?'=>'');

on application/config/breadcrumb.php

[eluser]Unknown[/eluser]
This is amazing.

Thank you so much!

[eluser]od3n[/eluser]
very useful. many thanks!

[eluser]kurtzawn[/eluser]
sama sob ane juga mau yg seperti di bawah ini,gmn yah cara nya

url : “localhost/categories/display_product/1” -> breadcrumb : Home->Phone
url : “localhost/categories/display_product/2 -> breadcrumb : Home->Laptop
url : “localhost/categories/display_product/3 -> breadcrumb : Home->Phone->Samsung
url : “localhost/categories/display_product/5 -> breadcrumb : Home->Laptop->Dell

yg di jelasin sebelum ny, ane masih belum ngerti

[eluser]ardinotow[/eluser]
[quote author="ardinotow" date="1346141283"]Hi fatangel26,

I will not give the detail but rather I will give you the logic.
So, here it is:
1. The key concept is using replacer, please refer to bredcrumb config file.
2. Another concept is you can put replacer on controller (again, please read config). This mean you can process the replacer with database, i.e:
Code:
$this->config->load('breadcrumb');
$prod_id = $this->uri->segment(3);
$prod_name = $this->model_xxx->get_name($prod_id);
$parent_name = $this->model_xxx->get_parent($prod_id);
if ($parent_name) { // if has parent then add new breadcrumb trail
   // add & change breadcrumb (see breadcrumb config)
   $this->config->set_item('replacer_embed', array('categories'=>'', 'display_product'=>'', $prod_id=>array('/categories/display/product/'.$prod_id|$parent_name, '/categories/display/product/'.$prod_id|$prod_name));
} else { // don't have parent so just put the product name
   $this->config->set_item('replacer_embed', array('categories'=>'', 'display_product'=>'', $prod_id=>array('/categories/display/product/'.$prod_id|$prod_name));
}
Hope that could make you catch the ideas.
Please let me know your progress...[/quote]

@kurtzawn, I will ask in standard indonesian language, other member can use google translate Smile
Maaf saya baru balas. Bagian mana yang belum dimengerti?




Theme © iAndrew 2016 - Forum software by © MyBB