Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ![]() Interested in joining? Click here. If you are already a member of ZBCode, feel free to login right here: |
| [Completed] [zb]PHP BBcode request; It's not for ZB, have to choose one... | |
|---|---|
| Tweet Topic Started: Nov 26 2009, 05:09 AM (844 Views) | |
| PD.Phoenix | Nov 26 2009, 05:09 AM Post #1 |
![]()
Kokuhyou no Tentei
![]()
|
I've tried posting just asking for assitance but I've gotten no where... now I'd like to know if someone who knows PHP could help me. http://zbcode.com/topic/2544299/1/#new The link to my help thread. I'm trying to make a bbcode for vBulletin. One for a rotating signature. bbcode for a text rotator might look something like this: [rotator]{text}[/rotator] You can make the bbcode tag delimited. So the tag in application could look like: [rotator]siglink1 siglink2 siglink3 siglink4[/rotator] Then you would only need to update your php code to take the {text} field, then use the explode(" ", {text}, limit) to populate the string array. Of course it also follows that you can use a different delimiter for the text rotator. Perhaps it would make more sense to use explode(";", {text}, limit) So the final tag, in application, would look like: [rotator] Join Division X today! divisionBannerLink; Claimed character battles going on now! claimCharBattleLink [/rotator] The text between the tags would be passed to the php block of code, so you could then have: $sig = explode (";", {text}) In theory, sig[0] would be: Join Division X today! divisionBannerLink and sig[1] would be: Claimed charater battles going on now! claimCharBattleLink I just don't know how to get it to working.. could someone PLEASE help me with this?
Edited by PD.Phoenix, Nov 26 2009, 05:10 AM.
|
|
Phoenix Designz is now open Looking for staff and classers PM me here or on PD if interested. Want to win some easy money? Enter Phoenix Designz tournaments. Learn more here ->> click ![]() | My dA | Vote PD Top 100 | | |
![]() |
|
| Reid | Nov 26 2009, 09:07 AM Post #2 |
![]()
What? The land of the free? Whoever told you that was your enemy.
![]()
|
A simple JS script could take care of this, could it not? Unless you're interested in generating real random numbers and not pseudorandom, but hey, who cares about all of that nonsense. 1. Loop through all of the posts 2. In each post, use the regexp /\[rotator\](.+?)\[\/rotator\]/gi to check for existence 3. Use a .replace on that regexp and use a callback function 4. In that callback function, generate a random number between 0 and the length of the array 5. Return what needs to go in its spot For example, here's what I would do in ZB: I went about it in a slightly different way than described. I let jQuery check if their post had the [rotator] tag already in it, then I used a .replace on the innerHTML of the <td> containing the post to replace all of the rotator tags. For each tag, it runs a callback function. In the callback function, the first argument is the entire matched text, the second argument is the first group - that is, the (.+?), notice the parentheses for capturing, which is also known as RegExp.$1; the third argument is the second group, the fourth argument is the third group, and so on into eternity. The fancy part about callback functions is that the value you return will be the replacement you want. There isn't anything really fancy about callback functions that JS has coded into it, it simply evaluates the argument. If it's a function it passes along some arguments. Anyways, I hope this helps. Since it's on vBulletin, I'd suspect that you need to find a different way of looping through the posts. Note that in my code, the format of the code was [rotator]link,title;link,title[/rotator] (and more, if you want.) |
| The Resource Board | |
![]() |
|
| PD.Phoenix | Nov 27 2009, 07:10 AM Post #3 |
![]()
Kokuhyou no Tentei
![]()
|
Has to be PHP. I need it written in PHP that will work on vBulletin. JavaScript is no good as it can be turned off. For ZB or IF, JavaScript is good. But not vBulletin |
|
Phoenix Designz is now open Looking for staff and classers PM me here or on PD if interested. Want to win some easy money? Enter Phoenix Designz tournaments. Learn more here ->> click ![]() | My dA | Vote PD Top 100 | | |
![]() |
|
| Gorgor | Nov 27 2009, 07:15 AM Post #4 |
|
Hello
![]()
|
Not sure if this will work, but you can try this:I'm not really good with random numbers or loops in PHP, but that looks like it would work if you place it right before it echos out the signature. Not sure how that forum system's designed though. |
![]() |
|
| PD.Phoenix | Nov 27 2009, 08:41 PM Post #5 |
![]()
Kokuhyou no Tentei
![]()
|
The problem is I don't know how to write this in a vBulletin BBcode format. So, sorry, but a tiny snippet of php isn't going to help me much. |
|
Phoenix Designz is now open Looking for staff and classers PM me here or on PD if interested. Want to win some easy money? Enter Phoenix Designz tournaments. Learn more here ->> click ![]() | My dA | Vote PD Top 100 | | |
![]() |
|
| Reid | Nov 27 2009, 09:40 PM Post #6 |
![]()
What? The land of the free? Whoever told you that was your enemy.
![]()
|
Considering that this entire board is devoted to InvisionFree and ZetaBoards, I doubt you will find what you're looking for. We don't know how vBulletin works. I'm sure there's a BBCode parser sitting around in the code somewhere, but I don't think anyone here has used vB before to an extent that they could write some PHP to use in the system. Aren't vBulletin boards supposed to have a menu where admins add BBCode? I have been an admin on a vB board before, although I didn't have access to the mission-critical things such as the file source. That was years ago, though. |
| The Resource Board | |
![]() |
|
| PD.Phoenix | Nov 27 2009, 10:02 PM Post #7 |
![]()
Kokuhyou no Tentei
![]()
|
VB ACP allows BBcodes used with HTML replacement. Either way it doesn't matter. Close this. |
|
Phoenix Designz is now open Looking for staff and classers PM me here or on PD if interested. Want to win some easy money? Enter Phoenix Designz tournaments. Learn more here ->> click ![]() | My dA | Vote PD Top 100 | | |
![]() |
|
| Choco | Nov 27 2009, 11:20 PM Post #8 |
|
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ
![]()
|
You're welcome. See? We can read thoughts too. ;) Your request has been completed, and we're moving it to the correct forum. We hope it works for you; if it doesn't, feel free to post another request topic in the requests forum. Just remember: read the rules first! Thanks, The ZBCode Staff |
It's a magical world, Hobbes, ol'd buddy... ...let's go exploring!In progress: Something Special ;) | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Completed Requests · Next Topic » |




















2:26 PM Jul 11