Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Using PHP code in Invision Power Board templates

Stanislav KhromovStanislav Khromov

Invision Power Board gives you a PHP template tag. With this you can use PHP inside most templates (skin/block/page templates and more!).

Here’s a quick example of usage inside a template:

$foo = 5+5;

Print example 1 - {$foo}
Print example 2 - {parse expression="$foo"}

Both of the last two lines print our variable $foo. What’s interesting with the second example is that it can be used to evaluate a PHP expression.

For example, I had issues with an ISO-8859-1 RSS feed – to display it correctly, I ran it through utf8_decode(), as you can see in the example below:

{parse expression="utf8_decode($r['title'])"}

More reading
IPB Documentation on parse tags

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 2
  • Vladislav
    Posted on

    Vladislav Vladislav

    Reply Author

    Stanislav, thank you! I just had a problem with the output variables from the script.

  • Paul
    Posted on

    Paul Paul

    Reply Author

    Your information is deprecated. php-tag doesn’t work on the modern IPB versions. As for me, I used the PHP-code in IPB with the following construction:

    {{$cur_year = date('Y');}}