Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter husky110

    (@husky110)

    This problem only occures if I choose “My Account” as “Display Instagram Gallery from:”… Please urgend fix…

    Thread Starter husky110

    (@husky110)

    I’ll try to wrap something up on github like tomorrow. ??

    Thread Starter husky110

    (@husky110)

    I’ve had this discussion with my colleague before.
    Thing is, that the other plugin does map-stuff with leaflet and a caching-system , cause it’s linked to an api and does other fancy things where here the Teamsite.php looks like this:

    
    <div class="something"><?php echo 'something'; ?></div>
    

    and that’s basicly it.
    The only difference I can think of is that the map-plugin uses shorttags to echo stuff like:
    <?= $someVariable ?>
    whereas this one uses the full php-echo-syntax…
    And it won’t get my head that the complex stuff works fine and the basicly “hello world”-example won’t…

    Thread Starter husky110

    (@husky110)

    So here we sit and can’t ignore, that we’re as smart as just before… ??

    Thread Starter husky110

    (@husky110)

    Heyho,

    Well that had me a bit confused there… The PHP-manual states that buffers are stackable https://secure.php.net/manual/en/function.ob-start.php. So I was assuming that I kinda work within my own buffer and never thought of it as the same. Funny thing is – I have another plugin which does exactly the same and this plugin works… So it seems that ob_get_clean() doesn’t always kill the buffer of AO aswell…
    Weird…

    Greetz

    Thread Starter husky110

    (@husky110)

    Heyho,

    Like I said, it wasn’t on my site. ??
    But I might have figured out a bigger problem during the debugging process.
    As far as I know – there is only one way a plugin can “send” HTML to WordPress within a funcion. The function must return a string. And there are 2 ways of doing that. Either build up the string by PHP and directly return it or building up a template, echo that into the buffer and return the buffer.
    So what my plugin initially did was that:

    
    function showTeamSite()
    {
        ob_start();
        require_once 'Teamsite.php';
        $output = ob_get_clean();
        ob_flush();
    
        return $output;
    }
    

    (I was using blain as theme and Teamsite.php is a simple HTML-Template with some php echo for an option-variable.)
    This didn’t work at all and caused an error like “autoptimize couldn’t find the closing body-tag.” even tho it was there and the Chrome-Console was stating “$().menu is not a function” or “jQuery is not defined”.
    As soon as I changed everything to something like this:

    
    function showTeamSite()
    {
        $myHTML = '<div class="someclass">';
        $myHTML .= '<p>something</p>';
        $myHTML .= '</div>';
    
        return $myHTML;
    }
    

    Everything worked like a charm…
    I’m pretty certain that my plugin isn’t the cause of the failure, since I’ve tested it on 2 wordpress-instances which didn’t use autoptimize (one even had the blain-Theme) and it worked on both with the output-buffering…
    I might have steped into one of the cases where the code works in 99% of all cases and here we have the 1% where it doesn’t…
    Ain’t sure what to think about this tho…
    AO-Version is 2.2.2.

    Greetz and have a nice holiday.

Viewing 6 replies - 1 through 6 (of 6 total)