MyBB Community Forums

Full Version: PHP in Templates and Template Conditionals
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Make a database backup, and a file back move to a new directory and try. So your users don't go offline.
Firstly, try it on the default theme with unmodified templates and see if it works there.
How can I use this for adding external templates?
For example, if im editing a template called 'myTemplate' and I make another template called 'myTemplate2', how could I get 'myTemplate2' to display in 'myTemplate?
Hope that makes sense...
(2008-11-01, 07:06 AM)Yumi Wrote: [ -> ]It depends on where you put it, but you could try something like this:
<if $GLOBALS['mybb']->user['usergroup'] == 4 then> stuff for usergroup 4</if>

Is there a way to make this work for more than one user group? I've been trying but I can't seem to get it to work with more than one user group.
<if $GLOBALS['mybb']->user['usergroup'] == 4 || $GLOBALS['mybb']->user['usergroup'] == 5 || $GLOBALS['mybb']->user['usergroup'] == 6 then> stuff for usergroup 4,5,6</if>

or

<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for usergroup 4,5,6</if>
Awesome plugin, thanks for this!
(2009-11-29, 01:56 AM)Yumi Wrote: [ -> ]
<if $GLOBALS['mybb']->user['usergroup'] == 4 || $GLOBALS['mybb']->user['usergroup'] == 5 || $GLOBALS['mybb']->user['usergroup'] == 6 then> stuff for usergroup 4,5,6</if>

or

<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,5,6)) then> stuff for usergroup 4,5,6</if>

Thank you much! It works perfectly. Smile
I have tried to change the forumdisplay_thread template, which likes this:
From
	<td align="center" class="{$bgcolor}" width="2%">{$icon}</td>
To
	<td align="center" class="{$bgcolor}" width="2%"><if><img src="images/icons/smile.gif"> <else />{$icon}</if></td>

and it didn't work, so how can I you the php language to make it works?
I really don't know what you're trying to do. For one, you don't have an if condition, so it doesn't actually make any sense.
sorry about that, but what I am trying to do is to make a default thread icon for each post in the forumdisplay, because when we post a thread, if we don't chose a post icon for it, then there will be no icon.

I think you better look at my demo below, hope that can make sense to you. I need the blue section have a default icon, not just blank like that.
[attachment=16433]
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22