Search the Community
Showing results for tags 'table of content'.
-
Hello again guys. Reworking my Knowledge theme, I was asked by my colleagues to add a table of content where one can click and be lead straight to the point (anchor to a paragraph or else). I was checking a few hours now as to how can this be done and I am not sure I have found an answer. Now, to better understand the need, the idea is that I have a multi line text field that would be filled up with some text so I am aiming at showing some anchors automatically upon some action from the editor's side or else. So far the only doable way I think could work is to have a keyword, class or other html chunk that would be added to the text and then the whole field content scanned for that specific code/text and added to the anchors link in the sidebar. But if that is the best approach, I am not sure yet. Btw, I am not looking at just creating anchor to a specific text inside the field, but show a table of contents outside of the echoed field (like in a sidebar or else). Writing this now, I just got another idea of creating a new field where I would have content like: title, url (where title would be presented as the anchor text and url would be the link to the content) but it gets way more complicated and I am sure there was already someone else who have thought about this and have a more elegant way of achieving the goal. I attached a demo image, where the content is $page->body and the table of content is the h1/2/3 etc. tags inside of the text field.
- 14 replies
-
- table of content
- anchor
-
(and 1 more)
Tagged with: