-
2007-01-28
Bogoris
Hello.
I've been trying to customize Dokuwiki and I can't really customize the Table of Content with only CSS, because it has to be in the same block as an other that is not in the content...
Moreover, I need to add extra <div />s around headers of second level (<h2 />), and I can't manage doing it properly.
So it would be great if we could customize the content, if it was part of the template folder, such as in DotClear...
Do you see what I mean ?
Thank you in advance,
Regards,
Bogoris
-
2007-01-28
ChrisS
I think there are two requests here.
(1) Ability to isolate TOC.
(2) Templatise core wiki syntax replacements.
For (1), I think it would be enough to surround the TOC in identifiable HTML comments. This is very "cheap" to implement and would allow a plugin or template to post process tpl_content() output and remove the TOC for injection into the finished page elsewhere.
Alternatively, the template, could turn off TOC either through CSS (display: none) or a plugin (prevents its generation) and use its own routines to query the page metadata for the TOC headings (are these in a hierarchy?).
For (2), I reckon its better to use the render plugin mechanism to extend the XHTML renderer and replace any undesirable output formatting.
-
2007-01-28
Bogoris
For (1), I tried to isolate the TOC by stocking the content in a variable and to create a regular expression but it seems that it's not possible because the function tpl_content does not return a value, but directly prints the content.
Thank you,
Bogoris
-
2007-01-28
ChrisS
Output buffering is in effect. Use an action plugin to handle the TPL_CONTENT_DISPLAY event - note this event fires for all actions, not only "show". Alternatively, you can intervene in the rendering process by handling RENDERER_CONTENT_POSTPROCESS event. For more details see
http://wiki.splitbrain.org/wiki:events_list and check out the links to "events" and "action plugins".
-
2007-02-02
Bogoris
Sorry, but I don't manage to do what I want.
Isn't there a simple way to put the XHTML content into a variable ?
I had a look at RENDERER_CONTENT_POSTPROCESS in the events_list and I tried this :
$array = p_render();
echo $array[1];
but obviously, p_render needs parameters :
function p_render($mode,$instructions,& $info);
I guess what $mode is used for, but I don't understand the 2 other arguments.
And I can't get the XHTML content output by tpl_content(); and tpl_content_core();. Isn't there a way to do that ?
Why don't tpl_content(); just return the XHTML content instead of printing it ? (Well, I'm sure I don't have you level in PHP I will maybe never, and you must have your reasons, but still I don't understand).
Thank you for your help,
Bogoris
-
2007-02-03
ChrisS
This isn't really the place to discuss programming techniques, please take that discussion either to forums, wiki.splitbrain or the mailing list.
Back on the original feature request, Andi - is it worth implementing my (1) above?
-
2007-02-03
andi
Yes, but I don't think using the HTML comments and output buffering is the way to go. The TOC print is already pretty good separated from the rest in the renderer class (in it's own function). I'd like to have separate a tpl_toc() from the tpl_content() function, allowing template authors to use it anywhere.I'm not 100% sure yet how to achieve this best, though.
-
2007-02-03
ChrisS
The TOC (or something pretty close to it) is part of the metadata.
How about refactoring the xhtml renderer toc functions slightly.
- changed inc/parser/xhtml.php, render_TOC() function to take the toc array as a parameter
- refactor it and _tocitem() to not use $this, ie. so both can be called as class functions
Then the renderer can build its toc by $this->render_TOC($this->toc) and template authors will be able to build a toc using xhtml::render_TOC(p_get_metadata($ID, 'description tableofcontents'));
Finally, template authors would need access to a switch to disable TOC in the tpl_content() - perhaps an extra parameter, $toc, which would default to true.
-
2007-02-05
andi
Sounds good :-)
-
2007-02-06
ChrisS
I've pushed a patch for this, pretty much as outlined above.
I'm not happy with it for a few reasons:
- I think its unlikely a template author will duplicate the standard TOC block if they are displaying it in an different part of the page. In particular, I don't think the hide/reveal header will find favour.
- Its pretty easy to generate a list from an array, so there isn't much of an advantage in exposing the xhtml renderers method.
- By converting render_TOC() and _tocitem() to static functions it makes it more complex to override them in an alternate xhtml renderer plugin.
-
2008-10-11
chi
The TOC can be separated from the content now.