WBCE CMS – Way Better Content Editing.
You are not logged in.
Hi
I have problem with breadcrumb displaing (WBCE1.4)
In the template I use following code for beradcrumb:
<p class="breadcrumb">
<a href="<?php echo WB_URL; ?>">
<i class="icon-home" aria-hidden="true"></i></a> /
<?php show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_CRUMB, '<span class="[class]"> / [a][menu_title]</a></span>', '', '', '', '<span class="[class]">[a][menu_title]</a></span>');?>
</p>
As a result the following html code is created:
<p class="breadcrumb">
<a href="http://localhost:3000/mysite">
<i class="icon-home" aria-hidden="true"></i></a> /
<span class="menu-expand menu-parent menu-first">
<a href="http://localhost:3000/mysite/pl/page.php" target="_top" title="Page">Page</a>
</span>
<span class="menu-current"> /
<a href="http://localhost:3000/mysite/pl/page/subpage.php" target="_top" title="Subpage">Subpage</a>
</span>
</span>
</p>
At the end of breadcrumb additional </span> closing tag is added and HTML validator shows error.
Can you help me to find what what is wrong with the breadcrumb code?
Best Regards
Gawi
Offline
Not sure if this is the reason, but in your SM2 call the last parameter is missing, try it this way:
show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_CRUMB, '<span class="[class]"> / [a][menu_title]</a></span>', '', '', '', '<span class="[class]">[a][menu_title]</a></span>',false);... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...
Offline
Thank you for answer. Unfortunately it did not helped. Still additional </span> is added at the and.
Regards Gawi
Offline
Hi gawi,
i have checked bernds code and there are no too many span elements, so the span element must be in your template.
Offline
ok. Thank you. I will for fault.
Regards
Gawi
Offline
Can you display the whole code from the index.php of your template?
Offline
I found my error.
I use breadcrumb code in two places in my template. When I corrected code in both places according to you suggestion everything it is ok.
<?php show_menu2(0, SM2_ROOT+1, SM2_ALL, SM2_CRUMB, '<span class="[class]"> / [a][menu_title]</a></span>', '', '', '', '<span class="[class]">[a][menu_title]</a></span>',false);?>
Thank you for help.
Best Regards
Gawi
Offline
How do I also display the subpages of NWI entries with this structure?
<?php show_menu2(SM2_ALLMENU, SM2_ROOT, SM2_ALL, SM2_CRUMB, '<span class="[class]"> > <a href="[ url ]" title="[menu_title]">[menu_title]</a>', '</span>', '', '', '<strong>Your are here:</strong> <span class="[class]"><a href="[ url ]" title="[menu_title]">[menu_title]</a>' ); ?>
Offline
It's not that easy. The data of a news item is not available in the show_menu2 output. You would need to buffer the output, replace the menu-current flag, execute a database query to fetch the post details and finally attach them to the output.
So here's the code:
<?php
$bcrmb = show_menu2(SM2_ALLMENU, SM2_ROOT, SM2_ALL, SM2_CRUMB|SM2_BUFFER, '<span class="[class]"> > <a href="[url]" title="[menu_title]">[menu_title]</a>', '</span>', '', '', '<strong>Your are here:</strong> <span class="[class]"><a href="[url]" title="[menu_title]">[menu_title]</a>' );
if (isset($post_id)) {
$bcrmb = str_replace('class="menu-current"','',$bcrmb);
$news_table = TABLE_PREFIX . 'mod_news_img_posts';
$sql = 'SELECT * FROM '.$news_table.' WHERE `post_id` = '.$post_id;
$res = $database->query($sql);
while ($row = $res->fetchRow()) {
$bcrmb.='<span class="menu-current"> > <a href="">'.$row['title'].'</a></span>';
}
}
echo $bcrmb;
?>Last edited by florian (13.02.2025 07:56:11)
Sorgen sind wie Nudeln: man macht sich meist zu viele.
Offline
und in welcher datei wird der Code eingefügt?
bei mir dreht sich vieles um die Modelleisenbahn in der Spurweite TT
Webseite: mobade.de
Offline
This is the international support section, please write in english.
The code has to be placed in the index.php of your template. It depends on the template structure whether you can copy & paste it or further customizing is needed.
Sorgen sind wie Nudeln: man macht sich meist zu viele.
Offline
Pages: 1