Jump to content

How does phpBB use those odd tags?


elite_prodigy

Recommended Posts

I know this question has more than likely been asked a thousand times, but how does phpBB use tags like:

 

<if S_USER_IS_LOGGE_IN>

 

If I could create variables and things like this in PHP it would make developement so much easier but I can't figure it out. I tried searching, but to be honest I have no idea what to search for!

 

Any help would be appreciated, and thanks for your patience with me.

Link to comment
https://forums.phpfreaks.com/topic/133886-how-does-phpbb-use-those-odd-tags/
Share on other sites

If you want to code it your self (although I would probably just use Smarty, unless you need something more lightweight), then you could just code something that parses those statements.  IE:

 

preg_replace('~<if([^>]+)>(.*?)</if>~me', 'HandleIf("$1", "$2");', $content);

 

function HandleIf($condition, $do) {

    //somehow check the condition

    if(it's true) {

        return $do;

    }

    else {

        //you would want to either return nothing here, or more likely you would want to handle else clauses.

    }

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.