Alter source list code

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

Alter source list code

Post by paracosm »

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: 26508
Joined: Fri Aug 29, 2008 9:49 am

Re: Alter source list code

Post by Mick »

paracosm wrote: Mon Jun 26, 2017 8:49 pmRecently 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©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
paracosm
Registered User
Posts: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP »

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 library that handles markup in phpBB 3.2+.
paracosm
Registered User
Posts: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP »

Yes. There's probably some documentation on how to create an extension somewhere.
I wrote the library that handles markup in phpBB 3.2+.
paracosm
Registered User
Posts: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 944
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: Alter source list code

Post by Toxyy »

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!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP »

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 library that handles markup in phpBB 3.2+.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Alter source list code

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Alter source list code

Post by JoshyPHP »

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 library that handles markup in phpBB 3.2+.
paracosm
Registered User
Posts: 12
Joined: Mon Dec 12, 2016 2:11 pm

Re: Alter source list code

Post by paracosm »

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: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Alter source list code

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
Post Reply

Return to “Extension Writers Discussion”