Skip to content
Advertisement

PHP weird curly brace syntax?

Does anyone know if PHP has an alternate curly brace syntax? I’ve come across a PHP file with a weird syntax I’ve never seen before. It’s being used in a WordPress theme. Here’s an example of the index.php file. Where are the PHP tags?

{block content}

    {if $wp->isBlog and $blog and $blog->content}
        <div class="entry-content blog-content">
            {!$blog->content}
        </div>
    {/if}

    {if $wp->havePosts}

        {loop as $post}
            {includePart parts/post-content}
        {/loop}

        {includePart parts/pagination, location => nav-below}

    {else}

        {includePart parts/none, message => empty-site}

    {/if}

Advertisement

Answer

From your example, this appears to be the syntax of Smarty, a PHP templating engine. https://www.smarty.net/

It is designed for use in front-end files and is meant to be used as a kind of replacement for using plain PHP in these files. The Smarty syntax (and other template engine syntaxes) get parsed and converted to PHP internally when the file is called.

To answer your question, this syntax is not natively in PHP.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement