php-liquid icon indicating copy to clipboard operation
php-liquid copied to clipboard

Error when extending tag

Open hakimihamdan88 opened this issue 8 years ago • 1 comments

tried this but return error, can you confirm LiquidBlock class?

class LiquidTagNodisplay extends LiquidBlock
{
    public function render(&$context)
    {
        return '';
    }
}
$text = " {% nodisplay %} don't show me! {% endnodisplay %} ";
$liquid = new LiquidTemplate();
$liquid->registerTag('nodisplay', 'LiquidTagNodisplay');
$liquid->parse($text);
echo $liquid->render();  // => ""

hakimihamdan88 avatar Jun 03 '17 05:06 hakimihamdan88

This example from wiki is outdated. Here is the working example of nodisplay: https://github.com/harrydeluxe/php-liquid/blob/master/src/Liquid/Tag/TagComment.php

kubk avatar Oct 19 '17 17:10 kubk