• Hello everyone,

    I am using LuckyWP Table of Contents and Bricks Builder as page builder.
    Somehow when I am using the plugin, there are too many line breaks in the HTML code. It looks like this:

    But it should look like this:

    I went through the plugin and I think I found the issue.
    The file luckywp-table-of-contents/front/views/items.php seems to be the issue. The file looks like this:

    <?php
    /**
    * @var $items array
    * @var $depth int
    * @var $containerTag string
    * @var $itemTag string
    */

    use luckywp\tableOfContents\core\helpers\Html;

    echo Html::beginTag($containerTag, ['class' => 'lwptoc_itemWrap']);
    foreach ($items as $item) {
    echo Html::beginTag($itemTag, ['class' => 'lwptoc_item']);
    ?>
    <a href="#<?php echo $item['id'] ?>"<?php echo $item['relNofollow'] ?>>
    <?php if ($item['number']) { ?>
    <span class="lwptoc_item_number"><?php echo $item['number'] . $item['numberSuffix'] ?></span>
    <?php } ?>
    <span class="lwptoc_item_label"><?php echo esc_html($item['label']) ?></span>
    </a>
    <?php
    lwptoc_items($item['childrens']);
    echo Html::endTag($itemTag);
    }
    echo Html::endTag($containerTag);

    And somehow the new lines in line 15 to 20 are translated to <br> when rendering the HTML.
    When I remove the new lines in the file as shown here, it works, no additional <br> are created:

    <?php
    /**
    * @var $items array
    * @var $depth int
    * @var $containerTag string
    * @var $itemTag string
    */

    use luckywp\tableOfContents\core\helpers\Html;

    echo Html::beginTag($containerTag, ['class' => 'lwptoc_itemWrap']);
    foreach ($items as $item) {
    echo Html::beginTag($itemTag, ['class' => 'lwptoc_item']);
    ?>
    <a href="#<?php echo $item['id'] ?>"<?php echo $item['relNofollow'] ?>><?php
    if ($item['number']) {
    ?><span class="lwptoc_item_number"><?php echo $item['number'] . $item['numberSuffix'] ?> </span><?php
    } ?><span class="lwptoc_item_label"><?php echo esc_html($item['label']) ?></span>
    </a>
    <?php
    lwptoc_items($item['childrens']);
    echo Html::endTag($itemTag);
    }
    echo Html::endTag($containerTag);

    I already posted that in the Bricks community, the answer there was, that “when you have PHP tags () with HTML in between, any whitespace (including newlines) between them gets rendered as-is in the output HTML”.
    So for me it seems like this is a bug or incompatibility in the LuckyWP TOC.

    Cany someone take a look into this? Any help is appreciated.

    Thank you and best regards

    • This topic was modified 1 month, 3 weeks ago by selimovd.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author LuckyWP

    (@theluckywp)

    Looks like Bricks Builder replace new lines to <br>. LuckyWP ToC don’t add this tags.

    Thread Starter selimovd

    (@selimovd)

    So this means bricks has to fix it and not LuckyWP?
    Could it be a setting in LuckyWP or is it easy to fix that in LuckyWP?

    Plugin Author LuckyWP

    (@theluckywp)

    LuckyWP don’t add <br> tags. It need to understand why Bricks doing this and how disable it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.