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
You can only use variables available in certain scripts, in which the templates are called, and functions listed in .txt file. I don't think any of tem makes it possible to get last post from database.
Is there a way for us to select a specific category then, in the post bit, using an if...else conditional? For instance, if category number is 1, display this style, else if category number is 2, display this other style?
I have 2 custom profile fields and here is what I wish to do:

1. If both are filled in the UCP, show them both in the postbit.
2. If only one is filled in, then show only that one in the post bit.

I also want it to be wrapped in a <div> tag which is styled to have those fields in a small box on the postbit, how I would I make it so if the custom profile fields aren't filled in, then the small box also won't show?

I have tried all the <if> statements I could find.
<if $post['fidX'] || $post['fidY'] then>
<div>
<if $post['fidX'] then>{$post['fidX']}</if>
<if $post['fidY'] then>{$post['fidY']}</if>
</div>
</if>

Of course change X and Y to your profile field numbers.
this is exactly what i need to do for my forumbit! How do I change this to work in the index for the forum bit? basically it would work the same except the forum display would be different depending on the forum's id.
One of the best MYBB plugins I mean it allows you to do amazing stuff, Very Big thanks
Hi, can I use this to Hide the internal standard moderation tools?...And, if yes, how?
It looks at both show1-2 so not working.

<if in_array($GLOBALS['mybb']->post['usergroup'], array(1)) then>
show1
<else>
show2
</if>
It is not possible to be showing both. Unless you are not using the Template Conditionals plugins.
does this still works for 1.8?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22