MyBB Community Forums

Full Version: Custom Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey there! 

So, I'm moving from Jcink forums to self hosted mybb. http://rebelwindrpg.com is the link. Now here comes my question.

I have custom bbcodes that I want to convert into the mycode to use with my forums. Most of my codes use CSS (they inherit the styling from my css) for their styling. I went to do this with the mycode and it wouldn't style.

This is my CSS for my rules template:
.rulestitle { 
	width: 450px; 
	text-align: center; 
	padding 20px; 
	font-family: Open Sans, serif; 
	color: #000; 
	font-size: 20px; 
	margin: 0 auto; 
	line-height: 150%; 
	font-weight: bold; }

.ruleswords { 
	width: 450px; 
	text-align: justify; 
	padding 20px; 
	font-family: tahoma; 
	color: #000; 
	font-size: 12px; 
	margin: 0 auto; 
	line-height: 150%; }

.ruleswords b { 
	color: #217585; }

My bbcode for the above would look like this:
 <div class="rulestitle">(PARAM1)</div>
<div class="ruleswords">(PARAM1)</div>

See how I've used div classes? And, because I've used the div class, my bolded text within the code colors to the color I've set.

My mycode for the above looks like this:
(words)
<div style="width: 450px; text-align: justify; padding 20px; font-family: times new roman; color: #000; font-size: 13px; margin: 0 auto; line-height: 150%;">$1</div>
(title)
<div style="width: 450px; text-align: center; padding 20px; font-family: Noto Serif, serif; color: #000; font-size: 25px; margin: 0 auto; line-height: 150%; font-weight: bold;">$1</div>

Why can't I use my div classes? It's not important, but if I can (or you can help me) get them to work, I would appreciate it. It's important to me that the bold text for each template I have be a different color.

Thank you so much!
If you add the CSS code to a style-sheets it will only be noticeable in the forums, style-sheets are not loaded in the administrator control panel (ACP).
(2014-08-29, 06:10 AM)Omar G. Wrote: [ -> ]If you add the CSS code to a style-sheets it will only be noticeable in the forums, style-sheets are not loaded in the administrator control panel (ACP).

I added them to the bottom of the CSS (like I would go to edit a theme) like I normally would. Was this wrong? I'm a bit new to all of this.

This is still being a thorn in my side! I thought I had fixed it, and I haven't. The bold shows up, but it doesn't color. Help?!
I personally prefer to use CSS classes instead of inline style, too. This way, you could alter it based on theme.
(2014-09-03, 06:38 PM)laie_techie Wrote: [ -> ]I personally prefer to use CSS classes instead of inline style, too.  This way, you could alter it based on theme.

Well, styling it like I'm trying, it still doesn't turn my bold or italics text the colors I have set, as it should. Regardless.

I even edited to try styling like this:

<style> .ruleswords { width: 450px; text-align: justify; padding 20px; font-family: times new roman; color: #000; font-size: 13px; margin: 0 auto; line-height: 150%; } .ruleswords b { color: #217585; } </style> 

<div class="ruleswords">$1</div>
 
for the output and still, my bold text does not color. And I DON'T want to have to do it manually every time I want a different color for my text. It's WAY to much of a hassle. Especially for an RPG forum.
Okay, so this actually isn't a problem with your code, but rather how myBB processes myCode. I've confirmed this for 1.8 and 1.6.

Your myCode should look like this:
\[rules\](.*?)\[/rules\]
<div class="ruleswords">$1</div>

With this in your global.css
.ruleswords { width: 450px; text-align: justify; padding 20px; font-family: times new roman; color: #000; font-size: 13px; margin: 0 auto; line-height: 150%; } .ruleswords span { color: #217585; }

The problem with your code was that you (correctly) had .ruleswords b, which would work on any other site. myBB, however, processes the [b] mycode as <span style="font-weight:bold;"> so to get your bold text to change color, you need to target the span tag instead.
(2014-09-03, 10:20 PM)jshort Wrote: [ -> ]Okay, so this actually isn't a problem with your code, but rather how myBB processes myCode. I've confirmed this for 1.8 and 1.6.

Your myCode should look like this:

\[rules\](.*?)\[/rules\]
<div class="ruleswords">$1</div>

With this in your global.css

.ruleswords { width: 450px; text-align: justify; padding 20px; font-family: times new roman; color: #000; font-size: 13px; margin: 0 auto; line-height: 150%; } .ruleswords span { color: #217585; }

The problem with your code was that you (correctly) had .ruleswords b, which would work on any other site. myBB, however, processes the [b] mycode as <span style="font-weight:bold;"> so to get your bold text to change color, you need to target the span tag instead.

Okay, so how would I target that instead? Sorry, I just learned how to do the whole bold color tags as it is.
In the CSS code above, I changed .ruleswords b to .ruleswords span. So just use that and it'll work just fine.
(2014-09-04, 02:45 AM)jshort Wrote: [ -> ]In the CSS code above, I changed .ruleswords b to .ruleswords span. So just use that and it'll work just fine.

Haha, I totally didn't even notice that. I kid you not. I'm testing it out.

ETA: I tested that, and it still didn't work.

ETA: Okay! I got it to work. But it's not inheriting the bold code from the style sheet. My HTML output for the my code looks like this:

<style> .ruleswords { width: 450px; text-align: justify; padding 20px; font-family: times new roman; color: #000; font-size: 13px; margin: 0 auto; line-height: 150%; } .ruleswords span { color: #217585; } </style>
<div class="ruleswords">$1</div>

Which, at this point, is completely fine with me! I have a few templates that I have to translate.
No problem. Smile I gave it a try on my test board and it worked out fine, so hopefully it does for you too.
Pages: 1 2