Full Breadcrums, how to?

Hi there, I’m trying to get a full breadcrumb in my theme, so it will be like this: Home > Parrent Category > Sub Category > Product.

Ive tried to make abit of a function but the the_category doesnt work, heres what ive made:

function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a> » ";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}

If any1 got a piece of code or can help me build my own that would be great. Cheers