Headers

Get help developing custom BBCodes or request one.
Hervé
Registered User
Posts: 577
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Headers

Post by Hervé »

Hi,
I would like to create BBcodes for html headers like <h1>, <h2>, ...
Instead of creating 6 distinct BBcodes I try to code it once like [h={INT}]{TEXT}[/h] which should generate <h{INT}>{TEXT}</h{INT}>
but if I write in a message [h=1]Text[c][h] I only get <h>Text</h> that of course html does not recognise.
What am I doing wrong ?
Thanks
User avatar
Steve
Registered User
Posts: 1597
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Headers

Post by Steve »

For this to work, your BBcode usage would have to be [h={INT}]{TEXT}[/h={INT}], which is not allowed. Just create new BBcodes per </hr>
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53596
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Headers

Post by Brf »

Steve wrote: Mon Oct 28, 2024 5:48 pm For this to work, your BBcode usage would have to be [h={INT}]{TEXT}[/h={INT}],
What? Why would you need a variable in the closing tag?
User avatar
Steve
Registered User
Posts: 1597
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Headers

Post by Steve »

Hervé wrote: Mon Oct 28, 2024 5:05 pm which should generate <h{INT}>{TEXT}</h{INT}>
Brf wrote: Mon Oct 28, 2024 7:48 pm
Steve wrote: Mon Oct 28, 2024 5:48 pm For this to work, your BBcode usage would have to be [h={INT}]{TEXT}[/h={INT}],
What? Why would you need a variable in the closing tag?
........
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53596
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Headers

Post by Brf »

Code: Select all

</h{INT}>
is part of the HTML replacement. You can put anything you want in there. You do not put variables in the BBCode definition closing tag.
User avatar
Steve
Registered User
Posts: 1597
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Headers

Post by Steve »

Ah, aye, my bad. Hmm.. Actually nah, not even the closing tag allows any input ...
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53596
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Headers

Post by Brf »

Anyways... It still does not work. It is not allowing the {INT} to modify the "h" tag. It is putting it out like this:

Code: Select all

<h>Testing</h>1&gt
Steve is correct you probably have to make a separate tag for each.
User avatar
Steve
Registered User
Posts: 1597
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Headers

Post by Steve »

You could use.

BB Code usage:

Code: Select all

[hr={TEXT} {SIMPLETEXT}]{TEXT1}[/hr]
HTML replacement:

Code: Select all

<hr class="{TEXT} {SIMPLETEXT}">{TEXT1}</hr>
Help line:

Code: Select all

Header: [hr=html hr(*?) class] text [/hr]
Example:

Code: Select all

[hr=h1 dashed]text[/hr]
From the phpbb style prosilver you can use these hr classes: h1, h2, h3, h4, hr.dashed (use: hr dashed), hr.divider(use: hr divider), h2 topic-title etc....
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
Anișor
Translator
Posts: 359
Joined: Tue Jan 08, 2013 9:36 pm
Location: Arbroath, Angus, Scotland

Re: Headers

Post by Anișor »

Hmm…
Hr = horizontal line
H = header

Edit:
Sorry, Steve is right.
Hervé
Registered User
Posts: 577
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: Headers

Post by Hervé »

I've tried your code
BBcode : [hr={TEXT} {SIMPLETEXT}]{TEXT1}[/hr]
HTML : <hr class="{TEXT} {SIMPLETEXT}">{TEXT1}</hr>
Example : [hr=h1 dashed]text[/hr]
Generated source code : <div class="content"><hr class="h1 dashed"></div>
it gives nothing !

Other example : [hr=h1]text[/hr]
Generated code : <div class="content">[hr=h1]text[/hr]</div>
User avatar
Steve
Registered User
Posts: 1597
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Headers

Post by Steve »

What style are you using? A link to a topic with the bbcode in use would be great.
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
Hervé
Registered User
Posts: 577
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: Headers

Post by Hervé »

I use my own css but its simply a copy of Prosilver common.css with some minor modifications.
Link to a topic with these 2 examples : https://www.leforumrecifal.com/viewtopic.php?t=3551
[hr=h1]text[/hr] : displays [hr=h1]text[/hr]
[hr=h1 dashed]text[/hr] : displays nothing
Hervé
Registered User
Posts: 577
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: Headers

Post by Hervé »

I've created the h1 to h4 BBcodes, it's finally more simple.

Return to “Custom BBCode Development and Requests”