[RFC] BBCode permissions and moving to all custom

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] BBCode permissions and moving to all custom

Post by brunoais »

Pony99CA wrote:
EXreaction wrote:I believe you can use the current custom bbcode system to do this if you must, you would just need to add an attribute that the user would need to enter as an id (problem being that they'd need to manually make something up and if the person uses something simple, like "1," another person could use that and cause issues).
And that latter part is probably why a unique ID is being asked for. It only needs to be unique for the given page, though, so the ID needs to be generated at the time of page generation, not posting time.
Easy. Just change the abstract class such that it includes a static variable with the kind of information you want, then alter all BBCode tag "parsers" you want such that they also include that @id he wants in the final HTML.
It's a trivial task, if you know php.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC] BBCode permissions and moving to all custom

Post by EXreaction »

Actually, there is another easier option I just thought of if you don't want to mess with any php code.

In the custom bbcode you'd have to just add a class to the item you want to have the graph, chart, etc. Then with jQuery you can assign an incremental id to these items by iterating over each instance of the class on the page and adding the id attribute to each, then you just call the javascript that creates these graphs, etc to use those ids.

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: [RFC] BBCode permissions and moving to all custom

Post by ecwpa »

That's a very interesting way to solve it. Thanks.
Slightly better English than it was in 2005, still improving :D

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] BBCode permissions and moving to all custom

Post by brunoais »

EXreaction wrote:Actually, there is another easier option I just thought of if you don't want to mess with any php code.

In the custom bbcode you'd have to just add a class to the item you want to have the graph, chart, etc. Then with jQuery you can assign an incremental id to these items by iterating over each instance of the class on the page and adding the id attribute to each, then you just call the javascript that creates these graphs, etc to use those ids.
I was trying to use a non-js approach but ok... I already had that idea but didn't tell because, well, it uses js. But then, after reading your answer, I remembered that the rest works on js... Bah!

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC] BBCode permissions and moving to all custom

Post by EXreaction »

A better implementation would not be hackish like that, but I'm not sure that there is a much better way with the current implementation of custom bbcodes.

I do have an idea for the new custom bbcode system from this. Some bbcodes may use jquery or something that applies to all instances of a bbcode's use ($('.some_class').doSomething()). For this, we wouldn't want the custom bbcode system to include this code for every instance the bbcode is displayed, just once on the page.

So maybe it would be useful to have a separate input field for custom bbcodes to allow putting in javascript code that would be added once to the end of the page rather than with every instance of the bbcode?

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] BBCode permissions and moving to all custom

Post by callumacrae »

EXreaction wrote:A better implementation would not be hackish like that, but I'm not sure that there is a much better way with the current implementation of custom bbcodes.

I do have an idea for the new custom bbcode system from this. Some bbcodes may use jquery or something that applies to all instances of a bbcode's use ($('.some_class').doSomething()). For this, we wouldn't want the custom bbcode system to include this code for every instance the bbcode is displayed, just once on the page.

So maybe it would be useful to have a separate input field for custom bbcodes to allow putting in javascript code that would be added once to the end of the page rather than with every instance of the bbcode?
It's not really that hackish, the author of the library should not have made it depend on IDs.
Made by developers, for developers!
My blog

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: [RFC] BBCode permissions and moving to all custom

Post by ecwpa »

Why not? In most of these JS libraries you really need an unique identifier. Not having a way to be sure it's unique is asking for trouble.
Slightly better English than it was in 2005, still improving :D

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] BBCode permissions and moving to all custom

Post by callumacrae »

ecwpa wrote:Why not? In most of these JS libraries you really need an unique identifier. Not having a way to be sure it's unique is asking for trouble.
Really? How? I can't think of any examples where BBCode is appropriate and IDs are required.
Made by developers, for developers!
My blog

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: [RFC] BBCode permissions and moving to all custom

Post by ecwpa »

Check my previous posts on this thread, that's what I've been discussing. The example given was JS charts and image carousels.
Slightly better English than it was in 2005, still improving :D

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: [RFC] BBCode permissions and moving to all custom

Post by EXreaction »

Looking at the second one, I do not believe it requires the use of an id tag from it's example:
$('.carousel').carousel();

This is using classes rather than an id.

I do not know about the first one, but I do not see a specific reason for the limitation unless the library is designed only to use ids, in which case the library could probably change for better/easier use.

Post Reply