Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Cel PHP in Custom BBCode Details »
Cel PHP in Custom BBCode
Mod Version: 3.001, by cellarius (Coder) cellarius is offline
Developer Last Online: Jun 2017 I like it Show Printable Version Email this Page

vB Version: 3.8.x Rating: (2 votes - 5.00 average) Installs: 13
Released: 08 Jun 2011 Last Update: Never Downloads: 53
Not Supported Uses Plugins  

This addon allows for PHP-Code to be used in Custom BBCodes

It offers a framework for the easy integration and sharing of custom BBCodes that are based on PHP processing of the data entered by the user. It could, for example, be used to develop BBCodes that work with multiple options or to poll database information. It does allow for the Admin to use PHP in the Backend - it does, of course, not allow this to forum visitors.

You need to know PHP to use this Addon to develop your own PHP based bbcodes, however it would be possible to share them as an extension to this addon.


Installation:
- install the product file - done.


Using PHP in Custom BBCodes:
Create your Custom BBCode as always, and just put your PHP into the Replacement box (where the HTML used to go).
Just remember two things:
  • Your code needs to start with <?php
  • You need to return the result of your code.
If you're unsure what that means, read the php manual on eval() and look at the evaltest example in the second post.


For coders: include instead of eval
If you'd rather store the PHP for your new BBCodes in the file system for ease of development, that's possible, too:
  • create a folder called "custombbcodes" in your forum root
  • in that folder, create a php file that copies your BBCode Tag Name (ie. if your tag name is "includetest", the file needs to be called "includetest.php"). That's where your PHP goes.
  • in the Replacement box in the Custom BBCode Dialog, just put the word "include", nothing else
  • Since there's no eval() here, no need to return the result. Instead, it needs to go into $parsed.There's also an includetest example in the second post.
No Support for your PHP-Code!

### See the example BBCodes in the second post (Click)! ###


### Don't forget to click install! ###
(No support if you don't)

Download Now

Only licensed members can download files, Click Here for more information.

Screenshots

Click image for larger version

Name:	admincp_evaltest.PNG
Views:	164
Size:	53.5 KB
ID:	129865   Click image for larger version

Name:	admincp_includetest.PNG
Views:	117
Size:	42.4 KB
ID:	129866   Click image for larger version

Name:	editor_38.PNG
Views:	155
Size:	47.6 KB
ID:	129867   Click image for larger version

Name:	parsed_38.PNG
Views:	189
Size:	30.5 KB
ID:	129868  

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
BB Code Enhancements Cel PHP in Custom BBCode cellarius vBulletin 4.x Add-ons 13 03 Apr 2016 01:07
Miscellaneous Hacks Cel Show Primary Usergroups Only on showgroups.php cellarius vBulletin 3.8 Add-ons 12 23 Mar 2010 20:54

Comments
  #2  
Old 08 Jun 2011, 15:06
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
PHP BBCode Examples:

To test them, go to AdminCP->Custom BB Codes->Add new BB Code and fill in the form:

--------------------------------------------------------------------
  • Title: evaltest
  • BBCode Tag Name: evaltest
  • Replacement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

  • Example: [evaltest]Hello World![/evaltest]
  • Use {option}: No
--------------------------------------------------------------------
  • Title: includetest
  • BBCode Tag Name: includetest
  • Replacement:
[code]include[code]
  • Example: [includetest="World!"]Hello![/includetest]
  • Use {option}: Yes
Additionally, you need to create a directory called custombbcodes, and in it create a file called includetest.php with the following code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------------------------------------------------------------
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de

Last edited by cellarius; 09 Jun 2011 at 10:43.
Reply With Quote
  #3  
Old 09 Jun 2011, 12:37
troyuncucom troyuncucom is offline
 
Join Date: Jul 2010
i want to include, xx.txt.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

it's not work. How can i do that?
Reply With Quote
  #4  
Old 09 Jun 2011, 12:55
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Please have a look at the examples in the second post, and mark the mod as installed.

What's {param} supposed to be? You want to use $value for what I think you meant to achieve:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

As explained in the examples: The variables {option} maps to $option, {param} maps to $value.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #5  
Old 09 Jun 2011, 13:52
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Been in further contact with troyuncucom. If you want to use include in your PHP code, make sure there is PHP Code in the file you include. Because of how vB works it is not possible to just throw text in there and have it printed to the screen. This will cause a cookie error/header already sent.

You need to make sure that you don't print to the screen directly; all output needs to go to a variable and needs to be correctly returned/passed. Please look at the examples in second post!
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #6  
Old 09 Jun 2011, 14:07
troyuncucom troyuncucom is offline
 
Join Date: Jul 2010
I did it all, firstly thanks very much.

But 2 errors for this plugin.

1) if i use bbcode, sending the message twice.

2) if i modify my txt file. the message does not change
Reply With Quote
  #7  
Old 09 Jun 2011, 14:14
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Those are not errors caused by this plugin, but by the code you're trying to run. What you can do and can't do is subject to the same limits as general vB plugin coding, since you're acting within the same framework.
Your first point I don't understand, and regarding your second point: Edit and save the message once again. Post output is cached.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #8  
Old 09 Jun 2011, 18:44
MoMan MoMan is offline
 
Join Date: Oct 2005
Isn't parsed BBcode in posts cached if you enable the vb post cache? If so, that would mean that writing custom code to hide things from guests wouldn't be of much help, right?
__________________
Adam

Admin of PentaxForums.com - Big-Board
Reply With Quote
  #9  
Old 09 Jun 2011, 19:48
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Not bbcodes are cached, but the entire post (as I wrote in the post above). Hiding things would have to be done at runtime, like the existing hide hacks do. This is not something this framework provides, you would have to do that yourself.

Edit: Thinking about it - you could clear the post from postcache at runtime using something like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

One would have to test if this could be of use in the environment my addon creates, or whether a seperate plugin could be created that deletes a post from postcache when a certain custom bbcode is present, or a plugin that keeps a post from being entered into postcache in the firstplace if a certain custom bbcode is present.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de

Last edited by cellarius; 09 Jun 2011 at 19:56.
Reply With Quote
  #10  
Old 28 Jan 2013, 05:41
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
This just does not work. It loads once, then disappears.
I've tried to alter it, my code, etc ...

..
__________________
FAQ: What are some HostGator alternatives? And who is EIG?
FAQ: What are the best web hosts and why?
And to all the vB plugin authors ... Thanks for making this a great app!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 17:25.

Layout Options | Width: Wide Color: