Useful Template Codes

by Aoki - 15-01-2015, 12:34 AM
dead inside
Posts:
5,135
Joined:
Jan 2015
Likes:
1,389
Credits:
20,107
Reputation:
197
Owner
2 Years of Service
#1
OP
Posted: 15-01-2015, 12:34 AM
Code:
{$welcomeblock} - Include welcomeblock (user/guest view of the member bit)
{$mybbversion} - Displays softwares version
{$modcplink} - Displays link to Mod CP
{$admincplink} - Displays link to Admin CP (exclude for clients safety - reinstate it if requested)

{$mybb->settings['bbname']} - Displays boards name
{$mybb->settings['bburl']} - Displays URL to the board (use always when you have to link to something)
{$mybb->settings['homename']} - Displays homepage name (the one in the footer's menu)
{$mybb->settings['
homeurl']} - Displays URL to the homepage site (the one in the footer's menu)

{$mybb->user['username']} - Displays users username
{$mybb->user['usertitle']} - Displays users usertitle
{$mybb->user['uid']} - Displays users UID (User ID)
{$mybb->user['avatar']} - Displays URL of the users avatar
{$mybb->user['lastvisit']} - Displays users last visit (date and time)
{$mybb->user['totalpms']} - Displays the total number of users messages (unread + read)
{$mybb->user['unreadpms']} - Displays number of users unread messages
{$mybb->user['postnum']} - Displays the users post count
{$mybb->user['logoutkey']} - Displays users logout key (used to logout successfully)

{$theme['imgdir']} - Displays themes image dirrectory
{$theme['imglangdir']} - Displays language specific theme image dirrectory
{$theme['tid']} - Displays the themes ID number
{$theme['logo']} - Displays themes logo
{$theme['borderwidth']} - Displays themes borderwidth number
{$theme['tablespace']} - Displays themes tablespace number

{$forum['name']} - Displays forums title
{$forum['description']} - Displays forums description
{$forum['url']} - Displays forums URL
{$forum['fid']} - Displays forums ID number
ipzttf
29-05-2015, 12:14 PM
Robert
27-05-2015, 06:36 AM
Closed Account
Posts:
145
Joined:
May 2015
Likes:
9
Credits:
65
Reputation:
7
2 Years of Service
#2
Posted: 17-05-2015, 09:12 PM
I just want to know one thing x)
If i add in a template a condition (PHP) code with : $mybb->user['uid'] == 10
Will it work ?
I did'nt try this, i'm learning the PHP/MySQL languague to find solutions myself, so no much time, with life stuffs too
Closed Account
Posts:
1,383
Joined:
Jan 2015
Likes:
124
Credits:
1,276
Reputation:
30
2 Years of Service
#3
Posted: 17-05-2015, 09:20 PM
You can't use PHP in templates if you don't have installed a plugin to do so
Closed Account
Posts:
145
Joined:
May 2015
Likes:
9
Credits:
65
Reputation:
7
2 Years of Service
#4
Posted: 17-05-2015, 10:40 PM (This post was last modified: 17-05-2015, 10:44 PM by DarSider.)
(17-05-2015, 09:20 PM)AndresXZ09 Wrote: You can't use PHP in templates if you don't have installed a plugin to do so

So i don't have a solution without a plugin
I will try these stuffs when i will finish my PHP/MySQL lessons
Thanks

Thank you
I found this : http://community.mybb.com/thread-31860.html :D
Will share it when i can
Closed Account
Posts:
1,383
Joined:
Jan 2015
Likes:
124
Credits:
1,276
Reputation:
30
2 Years of Service
#5
Posted: 17-05-2015, 10:46 PM
Use PHP in Templates 2.0

And also, try with this code

<if $GLOBALS['mybb']->user['uid'] == 1 then>Stuff</if>
Active Member
Posts:
244
Joined:
Feb 2015
Likes:
10
Credits:
82
Reputation:
10
2 Years of Service
#6
Posted: 27-05-2015, 06:38 AM
Thank you for sharing these codes! I never knew there were so many template codes for Mybb. This thread is a keeper Smile
- Signature removed by staff
Closed Account
Posts:
1,383
Joined:
Jan 2015
Likes:
124
Credits:
1,276
Reputation:
30
2 Years of Service
#7
Posted: 29-05-2015, 02:53 AM (This post was last modified: 29-05-2015, 02:57 AM by AndresXZ09.)
One question, is there a way to show the member profile UID without using a plugin? Because when I use {$mybb->user['uid']} it shows mine instead of the user uid.

EDIT: Nevermind, found it.
Novice
Posts:
26
Joined:
May 2015
Likes:
0
Credits:
5
Reputation:
0
2 Years of Service
#8
Posted: 29-05-2015, 12:14 PM
I begin "the adventure" with MyBB, but this topic is very helpful. Thank you ;)
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)