Jump to content

Using MyBB's MyCode for post templates


gelly
 Share

Recommended Posts

Hey, Initiative! I need help trying to make easy-to-use post templates using MyCode. I would like to offer some simple and easy post templates for my upcoming rp but I don't want to deal with having to walk members through using DoHTML on MyBB, which can be tricky and overcrowded. So I was wondering whether MyCode could be used in the same vein of Jcink's custom BBCode feature. These are the two code's I've made that I would like to make into BBCode post templates:

 

<div class="post1a"><div class="post1b">look, a post template!</div></div>

 

<div class="genre"><table style="margin: 60px auto 30px auto; cellpadding: 0px; cellspacing: 0px;"><tr><td valign="top"><div class="post2a"><div class="post2b">

look! another post template!

</div></div></td><td valign="top">
<div class="post2c"><div class="post2d" style="background-image: url(IMAGEHERE);">
</div></div></td></tr></table></div>

affbutton.gif

Link to comment
Share on other sites

  • Admin

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

In a word: yes.

 

Are you having trouble getting it to work or?

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

1 minute ago, Kit the Human said:

In a word: yes.

 

Are you having trouble getting it to work or?

 

Awesome!

 

And no... I mean, that would assume I even know how to begin to get it to work properly??? I've tried reading some docs, but it seems more complicated than Jcink's custom bbcode.

affbutton.gif

Link to comment
Share on other sites

Post Template the First!

 

Title: Whatever makes sense to you

Short Description: Whatever makes sense to you

Regular Expression:

\[post1\](.*?)\[/post1\]

Replacement:

<div class="post1a"><div class="post1b">$1</div></div>

Users put in

[post1]Their stuff here[/post1]

 

Post Template the Second

Title: Whatever makes sense to you

Short Description: Whatever makes sense to you

Regular Expression:

\[post2\](.*?)\[/post2\]

Replacement:

<div class="genre">
<div class="post2a">
<div class="post2b">$1</div>
</div>

 

Post Template the Second - Add Custom Background image

Title: Whatever makes sense to you

Short Description: Whatever makes sense to you

Regular expression:

\[post2img=(.*?)\]\[/post2img\]

Replacement:

<div class="post2c">
  <div class="post2d" style="background-image: url($1);"></div>
</div>
</div>

Users put

[post2]Post here[/post2][post2img=URLHERE][/post2img]

Besides the rest of your styling, you'll need to add 

.post2a {
  margin: 60px auto 30px auto;
}

The tables screw the post templates up.  Why were you using them? We'll look for the CSS alternative!

 

I've tested these on my test forum.

  • Love 1
  • Preach it! 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

  • 6 months later...

Hey @Kit the Human, sorry for necroing this, if I have to start a new one, I will!

 

I was trying to tweak the second template to look like this https://jsfiddle.net/jtzb5mpL/1/

 

But I legit just can't get it to work right?? I thought just adding the

[post2img=URLHERE][/post2img]

 three times would get it to work, but apparently I am a dumb? Here's where I'm testing it on my board right now:

https://inkslingers.rpginit.com/showthread.php?tid=20

 

affbutton.gif

Link to comment
Share on other sites

No problems Perry! I'll have a play this weekend. Tagging @isoldehn just in case she has a moment to help before I can!

 

  • Love 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

I'm struggling with completing all uni assignments by tomorrow at the moment and my test board has had a serious blow up (if I'm going to be honest, I messed with things I shouldn't have lol).

 

BUT if I get assignments done on time and manage to fix up my test board before Kit gets to this I will work something up.

 

I think the main issue would be something is colliding somewhere. Maybe an item has not been closed out properly. Additional images may need their own additional MyCode... something might just need more definition or there could be a mistake in coding somewhere that has been missed. If you take a look at the attached screenshot you can see that its adding these MyCodes as part of the coding, so something is off.Capture.PNG

 

You might be better off adding post2img1, post2img2, post2img3 MyCodes because its as if its trying to insert them all in the one BG of item $1.

  • Love 1

wcc_aff_one.png.ee644d7c84e4471ab7231d79aa59872c.png freerphostaffbutton.png.2c941043f4d1bcb22ada2b22d3e60dfc.png myrpg-affiliate.png.5453a73021a9354b5b772ac4e15f7ef9.png

Link to comment
Share on other sites

ok! Iso is entirely correct that a lot of your issues are stemming from the fact that you're trying to do three different things with the same code, they each need to be uinque. There are a couple of other issues like font: 13px will not work. Read more here and center blocks are deprecated so future browser support is not guaranteed. You're better off avoiding deprecated elements. I've done something else to get the result that you're after which I'll supply once we've work out the following:

 

I have an issue as well which I imagine will pass onto you if I attempt to give you the codes, so hopefully someone else can weigh in here?

 

Test thread.

 

The post

[post3img1="http://placehold.it/200"][/post3img1][post3img2="https://vignette.wikia.nocookie.net/blogclan-2/images/b/b9/Random-image-15.jpg"][/post3img2][post3img3="http://placehold.it/200"][/post3img3][post3]Test test[/post3]

The second and third post image codes are not displaying forward slashes.

 

The mycode

\[post3img2=(.*?)\]\[/post3img2\]
<div class="post2c"><div class="post2d" style="background-image: url($1);"></div></div>

 

Compare that to the working version:

\[post3img1=(.*?)\]\[/post3img1\]
<div style="text-align:center;"><div class="post2c"><div class="post2d" style="background-image: url(($1);"></div></div>

Any ideas?

 

I'll keep trying when I have time next 🙂

  • Love 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

@Kit the Human I am unable to view the test thread you linked, as it looks to just be a basic post and there are no replies to go off? Is this an accident?

From inspecting the working version I can see there is a div for aligning text to the center BUT there is not an ending div for this? It might make more sense to just add that still to post2c div span instead of adding another.

 

I'm still going off of guess here as I lack my tester space at the moment but this is what I've come up with......

 

-----

 

MyCode Regular Expressions:

\[post3img1=(.*?)\]\[/post3img1\]
\[post3img2=(.*?)\]\[/post3img2\]
\[post3img3=(.*?)\]\[/post3img3\]

Replacement per MyCode:

<div class="post2c" style="text-align: center;"><div class="post2d" style="background-image: url('$1');"></div></div>

In Use:

[post3img1=URLHERE][/post3img1][post3img2=URLHERE][/post3img2][post3img3=URLHERE][/post3img3]
[post3]I am just a wall of text yo![/post3]

 

I took out the " to use those directly in the html itself instead.

  • Love 1

wcc_aff_one.png.ee644d7c84e4471ab7231d79aa59872c.png freerphostaffbutton.png.2c941043f4d1bcb22ada2b22d3e60dfc.png myrpg-affiliate.png.5453a73021a9354b5b772ac4e15f7ef9.png

Link to comment
Share on other sites

3 hours ago, isoldehn said:

Is this an accident?

 

No, it closes on post3

 

3 hours ago, isoldehn said:

am unable to view the test thread you linked

 

 

Apologies, change theme to grid forum

 

Capture.thumb.PNG.128c79705bd87fd4bdcc51d96a95d842.PNG

 

Single quotes within the background-url thing helped!

.post2a {
  width: 560px;
  padding: 3px;
  background-color: transparent;
  border: 1px dashed rgba(235, 235, 235, 0.4);
	/* MAKE 2A SIT IN THE MIDDLE */ margin: 0 auto
}

.post2b {
  width: 460px;
  padding: 50px;
  background-color: rgba(235, 235, 235, 0.8);
  font-size: 13px;
  letter-spacing: 0.7px;
  text-align: justify;
  color: #555
}

.post2c {
  width: 156px;
  height: 156px;
  padding: 3px;
  background-color: transparent;
  border-radius: 100%;
  border: 1px dashed #ebebeb;
  display: inline-block;
  margin: 5px 5px
  }

.post2d {
  width: 150px;
  height: 150px;
  border-radius: 100%;
  border: 3px solid #ebebeb;
  background-image: url('http://placehold.it/200');
  background-position: center;
  background-size: cover
}

 

Post Template 3 - Image 1

\[post3img1=(.*?)\]\[/post3img1\]
<div style="text-align:center;"><div class="post2c"><div class="post2d" style="background-image: url('$1');"></div></div>

The new opening div will be closed on post3 and is to center the images.

 

Post Template 3 - Image 2

\[post3img2=(.*?)\]\[/post3img2\]
<div class="post2c"><div class="post2d" style="background-image: url('$1');"></div></div>

 

Post Template 3 - Image 3

\[post3img3=(.*?)\]\[/post3img3\]
<div class="post2c"><div class="post2d" style="background-image: url('$1');"></div></div>

Post Template 3 - Text

\[post3\](.*?)\[/post3\]
<div class="post2a"><div class="post2b">$1</div></div></div>

The additional closing div is to close the one that is introduced with Post Template 3 - Image 1

 

And people do this

 

[post3img1=URL][/post3img1][post3img2=URL][/post3img2][post3img3=URL][/post3img3][post3]TEXT[/post3]

 

People must at least use Post Template 3 - Image 1 and Post Template 3 Text!

 

Hope that works for you!

  • Love 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

Thank you so much for your efforts, guys!

 

Unfortunately, the image parts don't show up. It also makes the post area kinda wonky (you can see the changes at the bottom of each post -- the one with the test code is missing the bottom).

 

Sorry for being a pain 😧

affbutton.gif

Link to comment
Share on other sites

It's not a problem!

 

It looks like the image mycodes haven't been enabled (at a guess.) Can you confirm your settings? I imagine if that's the issue, it will also fix the wonky bottom of the post thing.

 

This is what my settings look like:

 

Capture.PNG.c03d22eb9acb7e9d643791d8e612d411.PNG

  • Love 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

Yes, I enabled all of them. Should I be doing something with the parse order?

affbutton.gif

Link to comment
Share on other sites

It doesn't look like that's the issue, but numbering won't hurt and I could be wrong!

 

I just number them in order of appearance and after anything else that I have made. So you could just go, 60 for post template 3 image 1, through to 64 for post template 3 for text.

 

If that has no effect, can you copy and paste your regular expressions and replacements here for us?

Edited by Kit the Human
  • Love 1

 

sig.png.30b42565d04d922988370bf14e1447bc.png

PSI: an Occult Investigations RP

Roleplay Architects: Grab a friend (or many friends!) and just write.

You can also find me at:

static-historicalrp.jpg  B8CB4x.png rpabutton.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.