• Resolved neutrall

    (@neutrall)


    Hi, I am creating a block with a text filed that will need to be parsed. the original text entered is a list separated with the “|” character.
    The template code is simple, it will explode the list and rebuild it in the form of HTML UL/LI and place it inside a HTML data attribute:

    <?php 
    // Define the tooltip content if set
    $content = trim(block_field( 'popup-content', false));
    if ($content != "") {
        
        $contentArray = explode('|', $content);
        
        $tooltipContent = '<ul>';
        foreach ($contentArray as $contentli) {
           $tooltipContent .= '<li>'.$contentli.'</li>';
        }
        $tooltipContent .= '</ul>';
        
    }?>
    <div class="icons <?php block_field( 'icone'); ?>"></div>
    <?php block_field( 'text'); ?>
    <span class="has-tip" tooltip-title="<?php block_field( 'popup-title'); ?>" tooltip-content="<?=$tooltipContent ?>"><svg ... ><path ...></path></svg>
    </span>

    Every time this code is executed, the last ” in the following code tooltip-content="<?=$tooltipContent ?>">< is getting replaced by &nbsp;?.

    Therefore, the block is not being rendered properly. It will simply output the raw text field block_field( 'popup-content'), the last ” is not being changed.

    I can replicate the problem simply by placing the following HTML code in the php template file:

    <div tooltip-content="<ul><li>test</li><li>test</li></ul>"></div>

    • This topic was modified 4 years, 1 month ago by neutrall.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘The ” character (ACSII #34) is getting modified when displayed on the site’ is closed to new replies.