What's the string name for a certain setting?
#1
What's the string name for a certain setting? As in, what would I call to display the value of the [custom] setting 'display_rating'? Something like $mybb->setting['display_rating']?
#2
If your setting name is display_rating, then you would access it with the variable $mybb->settings['display_rating']

Please note there's a difference between setting name and setting title
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#3
As Dennis said, you have to be careful of what you put. Look at the "Setting Name" and place it EXACTLY how you placed it in the settings manager at the acp.

An example...if your setting name was "testing", then you would create a string such as this

Quote:$mybb->settings['testing']

Incorrect:

Quote:$mybb->settings['someothername']
Rate me if I have helped you
I'm still trying to figure out what I'm going to do with MyBBThemes
#4
Can I use PHP if checks in MyBB's template? Or, does MyBB have it's own method? If not, then I highly suggest you add the ability to do so!
#5
eXaulz Wrote:Can I use PHP if checks in MyBB's template? Or, does MyBB have it's own method? If not, then I highly suggest you add the ability to do so!

No. Add your PHP 'if' in the php code of the page, then output it as a variable on the template.

For example if you wanted to add a message to logged in users to the header, you would open global.php and add right before the eval($header...) line:
if($mybb->user['uid'] > 0)
{
$mystring = 'Logged in user';
}
else
{
$mystring = 'Not logged in';
}

Then add in the header template $mystring.
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#6
Wouldn't you need to eval($mystring ...) for that to work? Or am I just thinking of this method if you wanted a template you created on the admin cp to show on the forum?
Rate me if I have helped you
I'm still trying to figure out what I'm going to do with MyBBThemes
#7
Yes Cory. That code is for templates only. Dennis's code will work.
#8
Most of the time, the stuff that is eval'ed is when you are parsing a template. Then by the eval, all the variables will be replaced with the appropriate values.
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net


Forum Jump:


Users browsing this thread: 1 Guest(s)