MyBB Community Forums

Full Version: Finding the code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2014-07-10, 07:12 PM)Dannymh Wrote: [ -> ]Urgghh and php directly in templates, I still feel is a bad idea. There should be no reason to have php in your templates presentation and logic layers should be completely separate.

If you don't want it to show for non-guests then you just don't push anything into the template variable

Well certin php parts are bad I think, but using if,else if, and else isn't all bad it just execute if it's true or false. It's a bad idea to implement bad php such as not sanatized code.
(2014-07-10, 07:14 PM)Ace700 Wrote: [ -> ]
(2014-07-10, 07:12 PM)Dannymh Wrote: [ -> ]Urgghh and php directly in templates, I still feel is a bad idea. There should be no reason to have php in your templates presentation and logic layers should be completely separate.

If you don't want it to show for non-guests then you just don't push anything into the template variable

Well certin php parts are bad I think, but using if,else if, and else isn't all bad it just execute if it's true or false. It's a bad idea to implement bad php such as not sanatized code.

It's also another layer of complexity.
I just can't see any reason why you would need this anything that needs to be done can be done via the logic files and parsed into the templates.

Anyway that's a discussion for another thread.

(2014-07-10, 07:12 PM)Ace700 Wrote: [ -> ]
(2014-07-10, 07:10 PM)Dannymh Wrote: [ -> ]Couldn't you just do

If(!$mybb->user())
{
//your other stuff here
}

Of course this can't go in a template and you should push the results through a template as well

OP wants to display the text to guests only. So we would have to do:
if $mybb->user == 5

Your definition of a guest is?

A guest is any user who is not logged in or doesn't have a user session.

So therefore !$mybb->user() accomplishes exactly that, it says you don't have a session so you are a guest.

The user group part is really irrelevant as it's just a placeholder and default basis for all initial users before they have an account or are logged in.

The header template as well as the related logic file should reveal how it is done, I'll check on it shortly and see precisely how it's done there
I needed template conditional. I fixed the problem. Thanks.
(2014-07-10, 09:50 PM)Afnan Wrote: [ -> ]I needed template conditional. I fixed the problem. Thanks.

Well I thought that you already had it installedToungue Would of been nice to know you had not installed it.
Pages: 1 2