<style>-tag in custom BBCode

Get help developing custom BBCodes or request one.
Post Reply
Shenzy
Registered User
Posts: 28
Joined: Mon May 28, 2018 10:42 pm

<style>-tag in custom BBCode

Post by Shenzy »

Hello,
not sure if I'm in the right place. If not, please move me to the right one.
I have the problem that I need to have separate <style>-tags in my custom BBCodes but they do not work.
If I put all my style css-properties right into the relevant tag (for example <div style="background-color:black;">), it works fine, but if I separate them and put them in between the <style>-tags, it won't get translated when I put my custom BBCode in a post.
Is this intended or an issue with my forum?
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: <style>-tag in custom BBCode

Post by AlfredoRamos »

It think that is intended as it generates invalid HTML, and it seems that the BBCode engine removes invalid markup.

Add the content in a sytesheet file instead.
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: <style>-tag in custom BBCode

Post by Brf »

Yes. A <style> tag is not a block-level element. It is not designed to be placed in the body of the webpage -- only in the head.
Shenzy
Registered User
Posts: 28
Joined: Mon May 28, 2018 10:42 pm

Re: <style>-tag in custom BBCode

Post by Shenzy »

Ah, I see, thanks for the quick answer!
But linking a stylesheet also doesn't appear to be working...Or maybe I'm doing it wrong.
When I put the html-code into an html viewer, with the stylesheet link, it works 100% fine but in my custom BBCode, it won't translate it.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: <style>-tag in custom BBCode

Post by Brf »

You need to explain what you are trying to do.
Shenzy
Registered User
Posts: 28
Joined: Mon May 28, 2018 10:42 pm

Re: <style>-tag in custom BBCode

Post by Shenzy »

Let me just show you the html-code I'm trying to put into my BBCode. Sorry for the random german, but you don't have to understand the content. When I put this code into an html viewer (I use https://codebeautify.org/htmlviewer/), it works normally. When I put this exact code into my forum, it doesn't. As far as I can see, there shouldn't be anything to interfere with the translation.

Code: Select all

<center>
<div class="BoWPartnertext"><a href="http://www.beyond-our-wishes.com/" target="_blank"><img src="https://abload.de/img/bowpartnerpiciz5s3i.png" class="BoWPartnerbild"></a><bwte>Einall, eine Region fern jeder anderen und wohl einer der geschäftigsten Orte der Welt. Viele große Städte befinden sich hier, unter anderem die Riesenmetropole Stratos City und der beliebte Urlaubsort Ondula, der häufig von Reichen aufgesucht wird. Und wie es in derart geschäftigen Gebieten üblich ist, verläuft nicht immer alles friedlich.</bwte>

<bwte>Vor einem halben Jahr geschah, womit kein Mensch je gerechnet hatte. Noch nie dagewesene Geschöpfe aus einer anderen Dimension drangen in die zwei größten Städte Einalls ein und verwüsteten Stratos City und Rayono City beinahe komplett.
Nachdem der Großteil der Ultrabestien von den beiden Legenden, Reshiram und Zekrom, vertrieben wurden, begann der Wiederaufbau beider Städte.
Während die Ranger- und Polizisten-Vereinigung alle Hände voll mit den Wiederaufbaumaßnahmen und der aufkeimenden Kriminalität zu tun hat, erhebt sich auch die Taijitu, die Maßnahmen zu unterstützen und ihren Namen in der Region als wohltätiger Helfer zu verbreiten, um ihrem geheimen Ziel einen großen Schritt näherzukommen.</bwte>

<bwte>Normalität kehrt allmählich in den Alltag der Menschen ein. Trainer und Koordinatoren nehmen ihre Reisen wieder auf, während so mancher, der bei dem Angriff alles verloren hat, sich den Schattenseiten der Region zuwendet.
<bowt><a href="http://www.beyond-our-wishes.com/" style="text-shadow: 0PX 0PX 2px rgb(129, 213, 213); color: rgb(26, 115, 119);" target="_blank">Und was tust du?</a></bowt></bwte>


<center><bwte><bowtt>♢ Pokémon RPG
♢ empfohlen ab 12 Jahren
♢ spielt mit Ortstrennung</bowtt><bowtt>♢ spielt in Einall
♢ Shop- & Punktesystem
♢ gleiche Startbedingungen</bowtt></bwte></center>

<bowe><bowb>Beyond</bowb> our <boww>Wishes</boww></bowe></div>
</center>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link href="https://exile-rpg.info/stylesheets/Wishes.css" rel="stylesheet">
EDIT: Also, then why does this work, despite having a <style>-section?:

Code: Select all

<center><style type="text/css">/*
&lt;!-- /// BIG CITY LIGHT* ///CREDIT: herzallerliebst @ storming gates--&gt;
ÄUSSERE BOX
*/ #storylinerahmenbcl { box-sizing: border-box; width: 500px; margin: 0 auto; background: #ffffff; } /*

STORYLINE-BILDER
*/ .storylinebildbcl1 { box-sizing: border-box; height: 250px; width: 500px; margin: 0 auto; background-image: url('https://abload.de/img/iw-vorstellungjolly0jdoe.jpg'); } /*
*/ .storylinebildbcl2 { box-sizing: border-box; height: 120px; width: 500px; margin: 0 auto; background-image: url('https://abload.de/img/iw-vorstellungship79cuw.jpg'); } /*

TITEL & UNTERTITEL & TEXTBOX & I / U / B FORMATIERUNG
*/ .storylinetitelbcl { width: 500px; height: 30px; margin: 0 auto; background-color:#65421d; border-bottom: 4px solid #9f8564; color: #ffffff; font-family: 'Abel', sans-serif; letter-spacing:1px; text-align: center; font-size: 25px; } /*

*/ .storylinetextbcl { box-sizing: border-box; width: 500px; margin: 0 auto; color: #ffffff; font-family: 'PT Sans Narrow', sans-serif; text-align: justify; font-size: 11px; padding: 20px 60px 20px 60px; background: #94643a; column-count:2; column-gap: 5px; -moz-column-count:2; -moz-column-gap: 10px; -webkit-column-count:2; -webkit-column-gap: 10px; } .storylinetextbcl i { font-family:'Share Tech Mono'; font-style:italic; color:#ffd805; } .storylinetextbcl u { font-family:'Share Tech Mono'; text-decoration: underline #f80186; } .storylinetextbcl b { font-family:'Share Tech Mono'; font-weight: lighter; background: rgba(0,192,234,0.5); }/*

SHORTFACTS
*/ .shortfactboxbcl { box-sizing: border-box; margin: 0 auto; width: 500px; background: #65421d; border-top: 2px solid #9f8564; padding: 5px; } .shortfactboxbcl fact { box-sizing: border-box; margin: 1px; padding: 2px; background: #785025; color: #bd7f3e; font-family: 'Abel', sans-serif; letter-spacing: 2px; font-size: 10px; }/*

/*
</style>

<div id="storylinerahmenbcl"><div class="storylinebildbcl1"></div><div class="storylinetitelbcl"><center><link href='https://fonts.googleapis.com/css?family=Montez' rel='stylesheet' type='text/css'><font style="font-family: 'Montez', cursive; color: #bd7f3e; font-size: 35px; line-height: 25px;">Inselwelten</span></font></center></div><div class="shortfactboxbcl"> <center> <fact><a href="https://inselwelten.crux-mundi.de/index.php" target="_blank"><font color=#bd7f3e>An Deck</font></a></fact> <fact><a href="https://inselwelten.crux-mundi.de/showthread.php?tid=78" target="_blank"><font color=#bd7f3e>Spielprinzip</font></a></fact> <fact><a href="https://inselwelten.crux-mundi.de/forumdisplay.php?fid=19" target="_blank"><font color=#bd7f3e>Kodex</font></a></fact> <fact><a href="https://inselwelten.crux-mundi.de/forumdisplay.php?fid=31" target="_blank"><font color=#bd7f3e>Wanted</font></a></fact></center> </div><div class="storylinetextbcl"><link href='https://fonts.googleapis.com/css?family=Bad+Script' rel='stylesheet' type='text/css'>
<div style="font-family: 'Bad Script'; color: #6d1605; font-size: 13px;  LINE-HEIGHT: 15px">Am Himmel der königlichen Familie ist ein Stern erloschen. Der fürstliche Hof Linaras versinkt im Chaos und der leere Thron lockt allerorts die niedersten Gelüste an die Oberfläche. 

<center>Gerüchte wispern durch die Welt. Wem wird die Zukunft gehören?</center>
Nach den Wiren der Vergangenheit scheint die junge Königswitwe allein da zu stehen. Noch wagt niemand, ihre Herrschaft offen anzuzweifeln, doch wieder einmal steht die Erste Welt vor einem möglichen Herrschaftswechsel. Intrigen werden gesponnen, Pakte geschlossen, deren Folgen nicht abzusehen sind. 

Während hinter den strengen Reihen der einst von der Königswürde selbst eingesetzten Marine Machtgier und Selbstbereicherung nach der Herrschaft greifen, beginnt auch die Handelskompanie, nach neuen Verhältnissen zu streben.

In dieser Zeit einer zerbrechenden Ordnung, einer ungewissen Zukunft, schlägt die Stunde der Piraterie. Als ein Schiff mit roten Segeln am Horizont erscheint, beginnt das Abenteuer. Sie alle folgen ihren eigenen Zielen, angetrieben lediglich von dem waghalsigen Wunsch ihres Captains.

In einer Welt, beherrscht von Sturm und Wellen, intriganten Fürsten und Piraten, deren Loyalität nur sich selbst gehört, beginnt der Kampf um das einzige, was sie zu einen scheint:

<center>Das Verlangen nach Freiheit, das alles andere hinweg fegt.</div></div><div class="shortfactboxbcl"><center><fact>Piraten</fact> <fact>Fantasy</fact> <fact>L3S2V2/16+</fact> <fact>Plottrennung</fact> <fact>Seit 18.04.2016</fact></center></div><div class="storylinebildbcl2"></div></div>
EDIT 2: I kind of found the issue with the first code. The stylesheet links were precisely why it won't work, deleting them makes the code translate. Does that mean I can't even use stylesheets in my BBCodes?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: <style>-tag in custom BBCode

Post by Brf »

You see.... a <style>, like I said before, is not a block-level tag. Its style section belongs to the entire page, not just to the particular post.
Therefore, a <style> tag in one post actually applies to all of the posts. Since a style-block actually belongs in the header, not the body, the bbcode engine does not allow it.

If you need those particular style definitions, you should place them in a global stylesheet, not embed them in the middle of one or more posts in the middle of your page body.
Shenzy
Registered User
Posts: 28
Joined: Mon May 28, 2018 10:42 pm

Re: <style>-tag in custom BBCode

Post by Shenzy »

Okay, seems like it won't work like I want it to, then.
Thanks anyway for the help.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: <style>-tag in custom BBCode

Post by david63 »

David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
thom_forum
Registered User
Posts: 19
Joined: Thu Aug 09, 2018 2:06 pm

Re: <style>-tag in custom BBCode

Post by thom_forum »

Not sure how helpful that is, but you could always put CSS inline, like this:

Code: Select all

<p style="text-align:left;font-weight:bold;background-color:#c0c0c0;"> Text </p>
Shenzy
Registered User
Posts: 28
Joined: Mon May 28, 2018 10:42 pm

Re: <style>-tag in custom BBCode

Post by Shenzy »

@david63: I have no clue what that's even about :mrgreen:

@thom_forum: Yeah, that would ultimately 'solve' the problem, but the codes I'm trying to implement into BBCode aren't written by me and I don't really have enough time to rewrite everything just so it works.

For anyone who might have the same or similar issues: I've just resorted to creating an own page (with the official 'Pages'-extension) for every code and implementing it into BBCode via an iframe. Much easier and I don't really know why I haven't thought of that sooner...
Post Reply

Return to “Custom BBCode Development and Requests”