template_bitfield

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
ErikZ
Registered User
Posts: 20
Joined: Sun Feb 06, 2005 6:34 am

template_bitfield

Post by ErikZ » Fri May 25, 2007 7:54 pm

Hi, I'm trying to learn how to make my own style. I'm looking at the prosilver style and in the template.cfg I see this:

Code: Select all

# Defining a different template bitfield
template_bitfield = lNg=
I can't find any reference to what this is anywhere. What is it?

ErikZ
Registered User
Posts: 20
Joined: Sun Feb 06, 2005 6:34 am

Re: template_bitfield

Post by ErikZ » Wed Jun 06, 2007 4:50 pm

oook then.

User avatar
jojobarjo32
Registered User
Posts: 164
Joined: Wed Jun 22, 2005 7:38 pm
Location: France

Re: template_bitfield

Post by jojobarjo32 » Sun Jun 10, 2007 3:55 pm

If you don't change the bbcodes.html template file, you should keep prosilver's value.
Otherwise, tell us what BBCodes you have changed and we'll give you the correct value :)

ErikZ
Registered User
Posts: 20
Joined: Sun Feb 06, 2005 6:34 am

Re: template_bitfield

Post by ErikZ » Mon Jun 11, 2007 1:02 am

So it's some kind of template lock for Prosilver?

That's cool. Is it something I can use when I make my own template?

User avatar
jojobarjo32
Registered User
Posts: 164
Joined: Wed Jun 22, 2005 7:38 pm
Location: France

Re: template_bitfield

Post by jojobarjo32 » Mon Jun 11, 2007 6:39 pm

It's only a code used by the BBCode parser :)
All tags defined within bbcodes.html are not parsed using this definition. Indeed, some simple tags (eg B, I, U...) can be parsed directly by the parser which has a default HTML replacement for them. The bbcode_bitfield stores (in binary) which of the tags must be parsed using the template definition.

By default, the template_bitfield, if not set within template.cfg, is kNg= (the default value for subsilver2 for example).
This value sets the BBCode parser to use the template definitions of those tags : QUOTE, URL, CODE, LIST, FLASH, ATTACHMENT.
All other tags are parsed using the default HTML replacement hard-coded within includes/bbcode.php

prosilver uses a different template_bitfield: lNg=
The SIZE tag uses the template definition with this bitfield (besides all previously mentioned tags).



Another use of the bbcode_bitfield : for all texts which CAN contain BBCodes (posts' text for example), a bitfield is generated automatically. It stores all tags used in the text and then allow the parser to not parse the tags not present (it's faster).

CyberSliver
Registered User
Posts: 1
Joined: Thu Jul 19, 2007 6:59 am

Re: template_bitfield

Post by CyberSliver » Thu Jul 19, 2007 7:11 am

The bitfield is a base64 encoded binary.

Since the bitfield currently holds 13 bits, each switching on/off 1 BBCode tag, 2 BYTEs are used (aka 1 WORD)
1 Quote
2 B
3 I
4 Url
5 Img
6 Size (Font)
7 Color (Font)
8 U
9 Code
10 List
11 Email
12 Flash
13 Attachment
14 Filling, 0
15 Filling, 0
16 Filling, 0

lNg= is Base64 and decodes to 94 D8 (Hex).
94 D8 = 38104 = 1001010011011000 = Quote, Url, Size, Code, List, Flash, Attachment.

kNg= is Base64 and decodes to 90 D8 (Hex).
90 DB = 37080 = 1001000011011000 = Quote, Url, Code, List, Flash, Attachment.

Mirakle
Registered User
Posts: 1
Joined: Tue Aug 26, 2008 6:10 pm

Re: template_bitfield

Post by Mirakle » Tue Aug 26, 2008 6:17 pm

Hi there,

after reading this i got a question.

When i change my bbcodes.html and fill up a amount of 50 BBCodes is it posible to get them over the bitfield to run?
I have tried without any change of bitfield but PhPBB is ignoring it ^^

And next, if not, how can i make an auto-add-bbcode for a special template and only over the template?

Mirakle

bunder
Registered User
Posts: 4
Joined: Fri Oct 24, 2008 11:15 am

Re: template_bitfield

Post by bunder » Fri Oct 24, 2008 11:17 am

sorry to dig up this old thread, but is there a way to disable the bitfield altogether (causing all ACP bbcode.html edits to be enabled)?

say i'm editing subsilver2, do I have to reinstall the theme? how do I update the changes?

thanks

roobot
Registered User
Posts: 1
Joined: Thu Oct 30, 2008 8:45 pm

Re: template_bitfield

Post by roobot » Thu Oct 30, 2008 8:51 pm

CyberSliver wrote:The bitfield is a base64 encoded binary.

Since the bitfield currently holds 13 bits, each switching on/off 1 BBCode tag, 2 BYTEs are used (aka 1 WORD)
...
lNg= is Base64 and decodes to 94 D8 (Hex).
94 D8 = 38104 = 1001010011011000 = Quote, Url, Size, Code, List, Flash, Attachment.

kNg= is Base64 and decodes to 90 D8 (Hex).
90 DB = 37080 = 1001000011011000 = Quote, Url, Code, List, Flash, Attachment.
I'm trying to build a theme that doesn't use inline images. So I want to parse the img bbcode differently. I cannot for the life of me figure out how to do this. I can't find documentation, just this thread, and there's not much here either.

How can I parse the img tag differently in different themes?

I'm trying to reverse engineer what you posted above to figure out how the template_bitfield works, and I can't get it to work.

Code: Select all

$bits = 1001010011011000;
$bindec = bindec($bits); // 38104
$hex = dechex($bindec); // 94d8
I cannot convert 94d8 into lNg=

So, BUMP, and how can I set it so that the img tag parses the way I write it in bbcode.html?

mindVex
Registered User
Posts: 1
Joined: Tue Nov 25, 2008 6:12 pm

Re: template_bitfield

Post by mindVex » Tue Nov 25, 2008 6:15 pm

Has someone already got a solution to this? I'm having the same problem and haven't found a solution either...

Post Reply