Alter source list code

Discussion forum for Extension Writers regarding Extension Development.
paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Alter source list code

Post by paracosm » Mon Jun 26, 2017 8:49 pm

Hi there!
Recently our forum upgraded to version 3.2, and with the update, we also noticed that the list button changed.

Previously, when an user would use the "[-list ] text [/list]" code, the list would only show the <li> attribute as default. However, now with the new update, this feature automatically adds bulletpoints to the list.
  • like this
I have taken a look at the bbcode in the source, but it looks quite complicated. Is there any way I can alter the list code back to the one without the default bullet point?

Thanks in advance!
- Paracosm.
Last edited by Mick on Tue Jun 27, 2017 8:41 am, edited 1 time in total.
Reason: Removed size formatting

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21724
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Alter source list code

Post by Mick » Tue Jun 27, 2017 8:42 am

paracosm wrote:
Mon Jun 26, 2017 8:49 pm
Recently our forum upgraded to version 3.2
Do you mean you upgraded the board yourself or it did it on it's own? If you did it what method did you use?
"The more connected we get the more alone we become" - Kyle Broflovski

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Tue Jun 27, 2017 9:35 am

Someone from our site team updated it from 3.0 to 3.2. I can't tell the exact method as I wasn't there, but I am quite sure the normal protocol has been followed.

However, the list attribute changing seems to be an update with phpbb 3.2, and I just want to set it back to where there are no default bullet points, as the users on our board use the list option to make indents and standard bulletpoints therefore are not desired.

Additionally, we also want to remove that {list } (but with []) returns the list code as well. Only the use of {list} should start the list code if possible.

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Tue Jun 27, 2017 12:20 pm

In addition, I found a sort of similar thread here, which describes better what I mean.

My question is now, what to do to alter the source code that the 'list=none' is the default setup?

(sorry for double posting)

User avatar
JoshyPHP
Code Contributor
Posts: 1053
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP » Tue Jun 27, 2017 8:58 pm

You need to create an extension, listen to the core.text_formatter_s9e_configure_after event and set the default value with this:

Code: Select all

$event['configurator']->tags['list']->attributes['type']->defaultValue = 'none';
I wrote the thing that does BBCodes in 3.2.

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Wed Jun 28, 2017 6:56 am

JoshyPHP wrote:
Tue Jun 27, 2017 8:58 pm
You need to create an extension, listen to the core.text_formatter_s9e_configure_after event and set the default value with this:

Code: Select all

$event['configurator']->tags['list']->attributes['type']->defaultValue = 'none';
Thank you for your answer! Perhaps a silly question but what exactly do you mean with 'create an extension'? Do I need to make an additional file in a directory or something?

User avatar
JoshyPHP
Code Contributor
Posts: 1053
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP » Wed Jun 28, 2017 7:08 am

Yes. There's probably some documentation on how to create an extension somewhere.
I wrote the thing that does BBCodes in 3.2.

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Wed Jun 28, 2017 7:17 am

Okay, thank you. I will try to get to work with that then. Do I need to put anything specific in the extension to 'listen' to the event you stated or can I just paste the code? Sorry if these questions are stupid, but I am quite new to phpBB and extensions and all. I honestly just hoped I could override it somewhere in an already existing file ^^"

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Sun Jul 02, 2017 1:57 pm

Hi there,
So I am trying to make an extension but I am still clueless about what to do exactly. I am trying to follow the tutorial about it, but I don't know where I should put the extension exactly and what file to use. This is the code I have so far:

click here for the code

So my questions are,
1. Where in the root do I need to place my extension? in the /all/ folder?
2. Are there any php files I should put after 'use'? If yes, which ones?
3. Do I need to make more files than this or would this file be sufficient?

Sorry if I ask a lot of questions but I am afraid to mess this up and I don't want that ^^'

User avatar
Toxyy
Registered User
Posts: 702
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: Alter source list code

Post by Toxyy » Sun Jul 02, 2017 2:47 pm

1) /ext
2) if you need them
3) you'll need more

Take a look at other extensions and go through their files to see what you'll need done.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts || [3.2][BETA] Sticky Ad || [3.2][RC] Show User Activity ||
[3.2][DEV] User Delete Topics

User avatar
JoshyPHP
Code Contributor
Posts: 1053
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP » Sun Jul 02, 2017 4:39 pm

paracosm wrote:
Sun Jul 02, 2017 1:57 pm
Sorry if I ask a lot of questions but I am afraid to mess this up and I don't want that ^^'
You should definitely develop your extension on a local installation so you don't have to worry about messing it up.

You can try using this extension as a template. Obviously you'll have to use your own namespace. The LICENSE and README.md files are not required.
I wrote the thing that does BBCodes in 3.2.

User avatar
david63
Registered User
Posts: 16803
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Alter source list code

Post by david63 » Sun Jul 02, 2017 5:58 pm

If you are trying to create an extension then try using this as your starting point - https://www.phpbb.com/customise/db/download/133296
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
JoshyPHP
Code Contributor
Posts: 1053
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP » Sun Jul 02, 2017 6:17 pm

That extension has 200+ files (excluding the vendor dir) and registers 20+ services. That's not a good starting point for someone who's never written an extension.

Correction: that extension is not a template, it's a generator. That's why it's so big. It generates extensions.
Last edited by JoshyPHP on Wed Jul 05, 2017 9:52 pm, edited 1 time in total.
I wrote the thing that does BBCodes in 3.2.

paracosm
Registered User
Posts: 11
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm » Wed Jul 05, 2017 1:29 pm

Thank you all for your help!
I feel like I am getting somewhere now. I am using JoshyPHP's extension as an example because the other starting point made my head spin.

I have one more question, seeing as I am using the phpbb tutorial on extensions as well. Now they are talking about template listeners, because they want to alter something in their layout. But I figure I don't need a template listener, right? Because all I am editing is the PHP core code? (here is the tutorial I am talking about, by the way.)

User avatar
david63
Registered User
Posts: 16803
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Alter source list code

Post by david63 » Wed Jul 05, 2017 2:26 pm

Templates don't have listeners they only have events.

If your extension does not need to use template events then that is fine - just use the PHP events/listeners.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

Post Reply

Return to “Extension Writers Discussion”