简体   繁体   中英

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}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM