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.
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.
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.
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!
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?
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.
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.
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.