• Resolved the_lar

    (@the_lar)


    Hi,

    I’m getting an intermittent issue with an ESI block that I’ve implemented on my staging site where instead of inserting the defined HTML tag, Litespeed instead inserts the whole page HTML again which is obviously causing the page to break apart completely. The issue is only resolved by Purging my LS cache.

    This is my ESI block defined in my filters.php file:

    function esi_postcode_form_block_esi_load($params)
    {
        #do_action( 'litespeed_control_set_ttl', 300 );
        do_action( 'litespeed_control_set_nocache' );
        echo sprintf('<input id="%s" type="text" class="%s %s postcode" data-search_postcode="%s" disabled />', $params['id'], $params['classes'], $params['type']==='size'?'tyre-size':'reg', WC()->session->get('search_postcode'));
    }
    add_action( 'litespeed_esi_load-esi_postcode_form_block', '\App\esi_postcode_form_block_esi_load' );

    As you can see, I’m just setting it to not be cached.

    Then in my shortcode I’m inserting this ESI like this:

    if(is_plugin_active('litespeed-cache/litespeed-cache.php')){
        $size_postcode_field = apply_filters('litespeed_esi_url', 'esi_postcode_form_block', 'Postcode form block', ['id' => sprintf('sc-fbf-reg-tyre-search--%s-postcode_%s', 'size', $id), 'type' => 'size', 'classes' => 'sc-fbf-reg-tyre-search__form-field']);
    }else{
        ...
    }
    $html = <<<HTML
        <div class="fbf-form-group sc-fbf-reg-tyre-search__form--row">
            {$size_postcode_field}
        </div>
    HTML;
    return $html;

    When it goes wrong the page looks like this:

    And looking at the Inspector in Firefox developer console, the HTML looks like this:

    As you can see above, where the Postcode form block begins, instead of just inserting the HTML for the input, it’s inserting the full HTML of the page – again.

    Could someone have a look at this for me please as obviously I can’t put this live with this issue present.

    Many thanks

    Kevin

    • This topic was modified 1 year, 2 months ago by the_lar.

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

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter the_lar

    (@the_lar)

    Hi @hailite – sorry I don’t know what you mean by please create a tix ? I do have a staging server though which is an exact copy of our production site, do you want access to that?

    Plugin Support Hai Zheng?

    (@hailite)

    Create a ticket I meant. Staging server is fine, just in case you may need to use it, that was why I meant a test site ??

    Plugin Support qtwrk

    (@qtwrk)

    please create a ticket by mail to support at litespeedtech.com with reference link to this topic , we will investigate further.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Bug with ESI block’ is closed to new replies.