e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
323 stars 214 forks source link

pages wrong breadcrumbs link of book with page/1/page-name url profile #4224

Open Jimmi08 opened 4 years ago

Jimmi08 commented 4 years ago

Bug Description

breadcrumbs have wrong book url if you are on chapter page

How to Reproduce

ID 1 - book ID 2 - chapter ID 1 - page

Used URL configuration: page/1/page-name

All page list - all links are correct (/page) Single page page/1/article-1 - breadcrumbs are correct /page/book/1/general - correct /page/chapter/2/chapter-1 - correct

Single chapter page /page/chapter/2/chapter-1

Jimmi08 commented 4 years ago

the wrong breadcrumbs are displayed by this $CHAPTER_TEMPLATE['default']['listPages']['start'] = "{CHAPTER_BREADCRUMB}<ul class='page-pages-list'>";

I gave up. No changes in function sc_chapter_breadcrumb() are applied. Breadcrumbs are still displayed, only way how to rid them is to remove that shortcode from template.

But why I can't do something like this to test this?

    function sc_chapter_breadcrumb()
    {
        return '';

It is because this, that shortcode is ignored and SimpleParser is used: 'CHAPTER_BREADCRUMB' => !empty($_GET['ch']) ? $frm->breadcrumb($bread) : ''

Jimmi08 commented 4 years ago

This is source of this problem:

        $urlData = array(
            'chapter_id'    => $row['chapter_id'],
            'chapter_name'  => $tp->toHTML($row['chapter_name']),
            'chapter_sef'   => $bookSef,
            'book_sef'      => $bookSef,
            'page_sef'      => '',
            'book_id'       => $row['chapter_parent']
        );

FIX:

        $urlData = array(
            'chapter_id'    => $row['chapter_parent'],
        );

Because there was book_id for this originally, something was changed. Adding book_id to allowed values didn't help.