I've constructed zf2 breadcrumbs for my application and it prints as expected:
<a href="main">main</a> > <a href="somthing-else">Something Else</a>
But what If I want to add some html tags? Is Javascript the only solution or there is ZF2 way?
You can define your custom partial for rendering by using $breadcrumb
helper's setPartial()
method.
(application/partials/breadcrumb.phtml)
In your partial;
echo implode(', ', array_map(
function ($item) { return '<span>'.$item->getLabel().'</span>' },
$this->pages)
);
Use the helper like this:
echo $this->navigation()
->breadcrumbs()
->setPartial('application/partials/breadcrumb');
This functionality also documented here.