How to access phpBB style template variables from PHP codes within html template files?

Viewed 724

I want to modify the Oauth login template (/styles/my_style/template/login_body_oauth.html) of a phpBB(ver. 3.1.8) theme style to something like this:

<div class="content">
    <!-- BEGIN oauth -->
    <dl>
        <dt>&nbsp;</dt>
                <dd><a href="{oauth.REDIRECT_URL}">
                <!-- PHP -->
                if({oauth.SERVICE_NAME}=='Facebook')
                    echo '<img src="fb.png">';
                elseif({oauth.SERVICE_NAME}=='Google')
                    echo '<img src="google.png">';
                <!-- ENDPHP -->
                </a></dd>
    </dl>
    <!-- END oauth -->
</div>

which results: Catchable fatal error: Argument 1 passed to phpbb\template\twig\node\php::__construct() must be an instance of Twig_Node_Text, instance of Twig_Node given, called in forum/4_3_1/phpbb/template/twig/tokenparser/php.php on line 35 and defined in forum/4_3_1/phpbb/template/twig/node/php.php on line 21

However, I have checked that the oauth values are stored as arrays in the php array $context['loops']['oauth']. So, a foreach looping through $context['loops']['oauth'] will give the desired result.

What is the correct method? or any other phpBB specific alternative?

1 Answers
Related