harrydeluxe / php-liquid

A PHP port of Ruby's Liquid Templates
http://www.delacap.com/artikel/Liquid-Templates/
MIT License
239 stars 119 forks source link

Error when extending tag #46

Open hakimihamdan88 opened 7 years ago

hakimihamdan88 commented 7 years ago

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();  // => ""
kubk commented 7 years ago

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