miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Master Class miniBB Support Forums / Master Class /   

How to insert variable into a post?

Author tkx211
#1 | Posted: 5 Nov 2011 18:45 | Edited by: tkx211 
Example i write:
Hello [$user_usr]

if ABC read the post, it become:
Hello ABC

I want use variable in the post to show weather, chatbox,...
But i don't know how to make a variable in the post.
Please help me

Author kuopassa
#2 | Posted: 6 Nov 2011 00:14 
That can be done if you put your PHP codes inside bb_plugins.php or bb_plugins_user.php. I don't know exactly what the differences in these files are.

Author Paul
Lead Developer
#3 | Posted: 7 Nov 2011 18:36 
There is no easy way to do this in miniBB. Else it would be too insecure. miniBB uses such default PHP tags to parse templates, not user's input.

For user's input, you will need to create a standalone BB code/tag. Each code could be transformed into something and back. Refer to how Youtube or Vimeo codes are implemented, something similar will work for your tasks, too.

Author tkx211
#4 | Posted: 9 Nov 2011 14:59 | Edited by: tkx211 
It seem like function: makeUp or praseTpl. when a user submit a query, it have some change. Of course, i must have an array which variables are applied. if not, sb can show my password :). But I don't know how to do it exactly.

Author Paul
Lead Developer
#5 | Posted: 9 Nov 2011 18:11 
I'm not sure what do you mean.
Do you mean, there is some possibility to pass such templates in miniBB, using message form?
What kind of query do you mean?
What is "sb"?

Author tkx211
#6 | Posted: 10 Nov 2011 04:47 | Edited by: tkx211 
Yes, I want use for post message
$find=array('[birthday=...]','[from=...]'); //... is user_id



User can write [birthday=5] to show birthday of user_id 5 in post message, for example.
I also want use this feature for more addon in the future, example: [weather=city_number], [timetable=student_id],...
And i want use it in post message, not in seperate pages.

Author Paul
Lead Developer
#7 | Posted: 10 Nov 2011 11:54 
User can write [birthday=5] to show birthday of user_id 5 in post message, for example.

I miss the logics of it. For displaying a birthday, you may install the proper solution.

You obviously include some of your own code, and that could cause the errors or something suspicious you see appearing. I don't know what your code is about. What I know, in miniBB, there should be no such "hack" possible.

In other words, what you try to implement, requires different approach. It all should be possible done via JavaScript. BB code is transformed into JS call, and JS call is a standalone script, which parses and gets the data from DB, based on the passed input.

Author Omg
#8 | Posted: 14 Nov 2011 11:30 
oh. You can found it in Poll Addon

Author Paul
Lead Developer
#9 | Posted: 14 Nov 2011 15:49 
Poll add-on? You can found it?..
What does it mean :)

Author tkx211
#10 | Posted: 15 Nov 2011 05:11 
Thank omg.
Now the task has done!

Author Paul
Lead Developer
#11 | Posted: 15 Nov 2011 11:14 
If I understand correctly, the approach of replacing BB code to JavaScript is also used in Polls add-on, that's correct.

Author tkx211
#12 | Posted: 16 Nov 2011 03:57 
But it must be convert from [birthday=1] to real birthday at php sever.
Once again, thank Omg and Paul

Author Paul
Lead Developer
#13 | Posted: 16 Nov 2011 11:32 
It's up to you how you build this algorithm. There is nothing difficult, if you take care to analyze the mentioned add-ons.

Master Class miniBB Support Forums / Master Class / How to insert variable into a post? Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB