Jump to content

[solved] Change the breadcrump with <strong>


Recommended Posts

Hello

I would like to modify the breadcrump (without editing with CSS).

Indeed, I just want to add a tag <strong> to the last word, on the breadcrump, like this :

 

Accueil > Ipad > Ipad 2 > Ipad 2 16 Go

 

I have tried to edit without success these two files :

- tool.php, fonction "getPath"

- breadcrump.tpl

 

Please help me :(

Link to comment
Share on other sites

Hi Kevin,

Try this:

Edit /themes/default/breadcrumb.tpl

Change contents into:

 

<!-- Breadcrumb -->{if isset($smarty.capture.path)}{assign var='path' value=$smarty.capture.path}{/if}<div class="breadcrumb"><a href="{$base_dir}" title="{l s='Return to Home'}"><img src="{$img_dir}icon/home.gif" height="26" width="26" alt="{l s='Home'}" /></a>{if isset($path) AND $path} <span class="navigation-pipe" {if isset($category) && isset($category->id_category) && $category->id_category == 1}style="display:none;"{/if}>{$navigationPipe|escape:html:'UTF-8'}</span> {if !$path|strpos:'span'}    {* Split the path if there's a '>' in it and make right part "strong" *}  {if $path|strrpos:'>'}  <span class="navigation_page">{substr($path,0,strrpos($path,">")+1)}<strong>{substr($path,strrpos($path,">")+1)}</strong></span>  {else}<span class="navigation_page"><strong>{strrpos($path,">")}:{$path}</strong></span>  {/if} {else}  {* Split the path if there's a '>' in it and make right part "strong" *}  {if $path|strrpos:'>'}  {substr($path,0,strrpos($path,">")+1)}<strong>{substr($path,strrpos($path,">")+1)}</strong>  {else}<strong>{$path}</strong>  {/if} {/if}{/if}</div><!-- /Breadcrumb -->

 

 

(Code from PS 1.5.4.1)

 

What it basically does is, it checks if the path contains a '>' (it searches for the right-most occurrence of it, using strrpos) and if available, it splits the path into a left part (before, and including, the rightmost '>') and a right part, which is made "strong".

 

Hope this helps,

pascal

Edited by PascalVG
span class edited back to navigation_page (see edit history)
  • Like 1
Link to comment
Share on other sites

<div class="breadcrumb">
<a href="{$base_dir}" title="{l s='return to'} {l s='Home'}">{l s='Home'}</a>{if isset($path) AND $path}<span class="navigation-pipe">{$navigationPipe|escape:html:'UTF-8'}</span>{if !$path|strpos:'span'}<span class="navigation_page">{$path}</span>{else}{$path}{/if}{/if}
</div>

 

just add <strong>{$path}</strong>

Link to comment
Share on other sites

Yup, you've got right, so it will be a bit problematic to use <strong> only for last part of breadcrumb, (in ps 1.4).

Maybe something with explode? just explode the $path variable, with separator as navigation pipe... Then we will got an array. Foreach on it and DONE - I'm just thinking ;-)

Link to comment
Share on other sites

Hi Vekia,

In my code above, I just search the $path string for the last occurrence of '>' (using strrpos), split up the string and add <strong> to the last part. Works well, I thought :-)

 

but your code is for prestashop 1.5.x

and unfortunately kevin uses 1.4 - breadcrumb.tpl file looks completly different in 1.4 version

Link to comment
Share on other sites

Ah, that explains... Sorry, didn't check :]

 

On the verge of going to Holland. In three hours my alarm goes off, and then some traveling to do. Probably offline two days. If in the meantime no one got a working answer yet, I'll have a look in the weekend, I hope...

 

That's it for now. Signing off...

Pascal

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...