MyBB Community Forums

Full Version: DIV Post Template [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hiya! 

I would like these codes to correctly parse into BBCode to offer a fantastic way for my members to create post templates like back on SMF. On SMF we used BBCode With Style, a fantastic plugin allowing post customization. Now with our switch to MyBB, I would like to make sure those templates transfer over just fine.

Now I have tried a few methods already. The div style codes provided herehere, and here have offered little to no luck, as seen above.

For example, one of our codes would be:


[div style="background: url(https://i.imgur.com/x55X7cN.gif); max-width: 700px; height: 300px;"][/div][div style="background: linear-gradient(transparent, #28282a); max-width: 700px; text-align: justify; height: 200px; align: center; margin-top: -200px;"][/div][div style="background: linear-gradient(#28282a, #171719); max-width: 700px; text-align: justify; height: auto;"][div style="background-color: #b2b2b4; max-width: 650px; text-align: justify; border: 1px #310506 solid; padding: 10px; color: #171719;"]
This box is expanding as you type further. The gradient from the background rolls into the photo.

[/div]
[div style="background: 0; max-width: 650px; text-align: justify; padding: 3px; font-size: 10pt; color: #b2b2b4; font-family: georgia; text-align: center;"]information can go here[/div][/div]

 and would have the output of this.

But when presented with the div style code above, it instead comes out like this. As you can see, the code is broken. One problem is that any mention of an image or a background seems to break the code, along with having another div style nested within another one. 

Now how would I do this with MyCode or is there a plugin that could provide me this convenience? Any help would be appreciated.

Side note: There are also a few problems with codes not working if it's not closed with [/div], but that's obviously expected and was an exception with SMF. I'm not necessarily worried with it. A solution to that would be fine but I'm not opposed to editing posts either.

GO TO: Admin CP --> Configuration --> MyCode (left hand side menu) --> Add New MyCode



Title: Div's w/ Style
Short Description: Allowing BBCode divs to have style.
Regular Expression:
\[div style="(.*?)"\](.*?)\[/div\]
Replacement:
<div style="$1">$2</div>
Enabled: Yes
Parse Order: This is up to you, I just leave them blank.
That's what I have currently. I am still receiving the same result.
Perhaps I'm missing something?

also sidenote, i love your work <333
bumping <3
bumping again?
Solved. Used YourCode to make the code nestable and used url('link') instead of url(link).+