miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Master Class miniBB Support Forums / Master Class /  
 

How to insert variable into a post?

 
Author tkx211
Partaker
#1 | Posted: 5 Nov 2011 18:45 
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
Partaker
#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
Partaker
#4 | Posted: 9 Nov 2011 14:59 
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
Partaker
#6 | Posted: 10 Nov 2011 04:47 
sb=somebody.
Yes, I want use for post message
Example:
$find=array('[birthday=...]
','[from=...]'); //... is user_id

$replace=array(include(birthday.php?user=...),include(from.php?user=...));

$posterText=str_replace($find,$replace,$posterText);
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 
tkx211:
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
Guest
#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
Partaker
#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
Partaker
#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?
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑