Resource icon

Slions - Table Of Content 2.2.13 RC 4

No permission to download

Slion

Active member
Slion submitted a new resource:

Slions - Table Of Content - Easy TOC for your posts

See demo:

Use it like that:
Rich (BB code):
[TOC][/TOC]

Quick line of introduction.

[h1]H1 Text - Some long header for the sake of it[/h1]

[h2]H2 Text[/h2]

[h3]H3 Text[/h3]

[h4]H4 Text[/h4]

[h5]H5 Text[/h5]

[h6]H6 Text[/h6]

[h5]H5.1 Text[/h5]

[h3]H3.1 Text[/h3]

[h4]H4.1 Text[/h4]
Lala

[h1]H1.1 Text[/h1]

Read more about this resource...
 
Dear Slions your plug-in's content has some errors
Thankfully it is open source so you can improve the code yourself and you can even contribute back 😁

Current implementation is very limited, little effort was made to improve on the basic functionality.
As it is, TOC must come first before any H bbcode or you get an error.
Emoji unicode characters and I'm guessing bbcode within H bbcode are not processed and will come out raw.
There is also not WYSIWYG rendering and no editor buttons.

is it ok to publish without testing?
Well, no, it isn't. You should not publish an add-on that's not working. I do believe moderators are removing or flagging broken add-ons.
However we do know this TOC add-on is working in some situations as shown on slions.net for instance.
I've also got feedback from @sbj saying he deployed and tested it successfully.

@EUPHRAT unless you tell us more about your setup and the kind of errors you are getting the community won't be able to help you.
 
Last edited:
Great idea! Does this work for all types of threads? Your demo page is a resource page...
It should.
 
Had to uninstall it:
1. It changed style of all [HEADING to something that didnt look good
2. After adding [toc].., [HEADING = 1]got changed to Array
3. After uninstalling I had to manually remove custom code for each heading
 
Last edited:
Had to uninstall it:
1. It changed style of all [HEADING to something that didnt look good
2. After adding [toc]..,
[HEADING = 1]got changed to Array
3. After uninstalling it I had to manually remove custom code for each heading
Thanks for the feedback.

1. You can change the style by editing the core.less template modification for that AddOn
2. Not sure I get that but it looks like your [HEADING = 1] got messed up somehow
3. You had to remove the H1-H6 bb codes? That's to be expected right? If you use an AddOn bb codes and remove it then the bb codes don't render properly anymore.

Word of advice then if you are deploying this on a forum that's making heavy use of XF built-in HEADING make sure you test it before hand cause I didn't 😁
 
Does it automatically parse old threads or we have to manually edit them and add TOC bbcodes?

Thank you.
 
Hey @Slion !
Thanks for your plugin, but I have a little error.

When I put Bold + Heading 1, I got this alert :
[E_NOTICE] Array to string conversion : src/addons/Slions/Toc/BbCode.php:166

Code:
#0 src/addons/Slions/Toc/BbCode.php(166): XF::handlePhpError(8, '[E_NOTICE] Arra...', 's...', 166, Array)
#1 [internal function]: Slions\Toc\BbCode::handleTagH(Array, 'Bonjour+a+tous', Array, Array, Object(XF\BbCode\Renderer\SimpleHtml))
#2 src/XF/BbCode/Renderer/Html.php(307): call_user_func(Array, Array, 'Bonjour+a+tous', Array, Array, Object(XF\BbCode\Renderer\SimpleHtml))
#3 src/XF/BbCode/Traverser.php(61): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#4 src/XF/BbCode/Traverser.php(37): XF\BbCode\Traverser->renderSubTree(Array, Array)
#5 src/XF/BbCode/Traverser.php(20): XF\BbCode\Traverser->renderAst(Array, Object(CMTV\Code\XF\BbCode\RuleSet), Array)
#6 src/XF/SubContainer/BbCode.php(220): XF\BbCode\Traverser->render('[H1=Bonjour+a+t...', Object(XF\BbCode\Parser), Object(CMTV\Code\XF\BbCode\RuleSet), Array)
#7 src/XF/Service/Message/Preparer.php(289): XF\SubContainer\BbCode->render('[H1=Bonjour+a+t...', 'simpleHtml', 'post:prepare', Object(NF\Discord\XF\Entity\Post))
#8 src/XF/Service/Message/Preparer.php(131): XF\Service\Message\Preparer->checkValidity('[H1=Bonjour+a+t...')
#9 src/XF/Service/Post/Preparer.php(98): XF\Service\Message\Preparer->prepare('[H1=Bonjour+a+t...', true)
#10 src/XF/Service/Post/Editor.php(127): XF\Service\Post\Preparer->setMessage('[H1=Bonjour+a+t...', true, true)
#11 src/XF/Pub/Controller/Post.php(58): XF\Service\Post\Editor->setMessage('[H1=Bonjour+a+t...')
#12 src/addons/BS/ScheduledPosting/XF/Pub/Controller/Post.php(12): XF\Pub\Controller\Post->setupPostEdit(Object(NF\Discord\XF\Entity\Post))
#13 src/addons/TickTackk/ChangeContentOwner/XF/Pub/Controller/Post.php(51): BS\ScheduledPosting\XF\Pub\Controller\Post->setupPostEdit(Object(NF\Discord\XF\Entity\Post))
#14 src/XF/Pub/Controller/Post.php(127): TickTackk\ChangeContentOwner\XF\Pub\Controller\Post->setupPostEdit(Object(NF\Discord\XF\Entity\Post))
#15 src/addons/BS/ScheduledPosting/XF/Pub/Controller/Post.php(24): XF\Pub\Controller\Post->actionEdit(Object(XF\Mvc\ParameterBag))
#16 src/addons/TickTackk/ChangeContentOwner/XF/Pub/Controller/Post.php(66): BS\ScheduledPosting\XF\Pub\Controller\Post->actionEdit(Object(XF\Mvc\ParameterBag))
#17 src/addons/SV/MultiPrefix/XF/Pub/Controller/Post.php(49): TickTackk\ChangeContentOwner\XF\Pub\Controller\Post->actionEdit(Object(XF\Mvc\ParameterBag))
#18 src/XF/Mvc/Dispatcher.php(350): SV\MultiPrefix\XF\Pub\Controller\Post->actionEdit(Object(XF\Mvc\ParameterBag))
#19 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'Edit', Object(XF\Mvc\RouteMatch), Object(SV\MultiPrefix\XF\Pub\Controller\Post), NULL)
#20 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\MultiPrefix\XF\Pub\Controller\Post), NULL)
#21 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#22 src/XF/App.php(2300): XF\Mvc\Dispatcher->run()
#23 src/XF.php(488): XF\App->run()
#24 index.php(20): XF::runApp('XF\\Pub\\App')
#25 {main}
Code:
array(4) {
  ["url"] => string(17) "/posts/10340/edit"
  ["referrer"] => string(48) "https://forum.the-programmer.com/post/test.1795/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(9) {
    ["message_html"] => string(86) "<h1 data-id="Bonjour+a+tous"><strong>Bonjour a tous,</strong></h1><p>ds</p><p><br></p>"
    ["_xfInlineEdit"] => string(1) "1"
    ["attachment_hash"] => string(32) "bbdd4e6c4e1c100eff3f12196036a8a8"
    ["attachment_hash_combined"] => string(85) "{"type":"post","context":{"post_id":10340},"hash":"bbdd4e6c4e1c100eff3f12196036a8a8"}"
    ["username"] => string(0) ""
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(16) "/post/test.1795/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Can you fix it please ?
 
Good addons, but how change the style?
Go to Admin > Appearance > Template modifications and select core.less for that add-on.
There you can edit the CSS that's being injected for your TOC in the Replace field.
I guess you could also create a template modification of your own to override the add-on CSS. Maybe that would be easier to manage add-on updates.
 
Wonder if this is going to be developed further or if someone is going to make a new one, maybe with some UI to make it even easier to setup a table of content in the ARTICLE forums/threads.
 
ErrorException: [E_WARNING] Undefined array key "REQUEST_URI" in src/addons/Slions/Toc/BbCode.php at line 288

  1. XF::handlePhpError() in src/addons/Slions/Toc/BbCode.php at line 288
  2. Slions\Toc\BbCode::buildToc() in src/addons/Slions/Toc/BbCode.php at line 105
  3. Slions\Toc\BbCode::handleTagH() in src/XF/BbCode/Renderer/Html.php at line 316
  4. XF\BbCode\Renderer\Html->renderTag() in src/XF/BbCode/Traverser.php at line 63
  5. XF\BbCode\Traverser->renderSubTree() in src/XF/BbCode/Traverser.php at line 39
  6. XF\BbCode\Traverser->renderAst() in src/XF/BbCode/Traverser.php at line 22
  7. XF\BbCode\Traverser->render() in src/XF/SubContainer/BbCode.php at line 222
  8. XF\SubContainer\BbCode->render() in src/XF/Pub/Controller/Editor.php at line 259
  9. XF\Pub\Controller\Editor->actionToHtml() in src/XF/Mvc/Dispatcher.php at line 352
  10. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  11. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  12. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  13. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2483
  14. XF\App->run() in src/XF.php at line 524
  15. XF::runApp() in index.php at line 20
 
Last edited:
Back
Top Bottom