This question about Topic Markup Language and applications: Task filed
Is it possible to use TOC in a view_template
I have tried %TOC{ "%BASETOPIC%" }% and variations but can't find a way. Maybe it's not possible because it cannot work with the contents of
%TEXT%
outside of
%TEXT%
?
If there is another work-around it would be worth it because I want to (wherever possible) to keep TML/MACROS away from end-user text, they use WYSIWYG.
--
LarsEik - 30 Oct 2009
%TOC{"%BASETOPIC%" web="%BASEWEB%"}%
ought to work.
--
CrawfordCurrie - 30 Oct 2009
I really wish it would. On my system it doesn't. If it is not a bug, is it possible to find a 'creative' way to get this?
I have
%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"form"}%%TMPL:END%
%TMPL:DEF{"content"}%
%TOC{"%BASETOPIC%" web="%BASEWEB%"}%
%TEXT%
..some formfields...
%TMPL:END%
--
LarsEik - 30 Oct 2009
Unfortunately because of the flawed way TOC works, the content of the topic has already been replaced by the content of the view template before it comes to generate the TOC. There's a workaround, but only by hacking the code.
Index: lib/Foswiki.pm
===================================================================
--- lib/Foswiki.pm (revision 5188)
+++ lib/Foswiki.pm (working copy)
@@ -1998,7 +1998,7 @@
|| '';
$title = CGI::span( { class => 'foswikiTocTitle' }, $title ) if ($title);
- if ( $web ne $defaultWeb || $topic ne $defaultTopic ) {
+ if ( 1 || $web ne $defaultWeb || $topic ne $defaultTopic ) {
unless (
$this->security->checkAccessPermission(
'VIEW', $this->{user}, undef, undef, $topic, $web
However this has potential knock-on effects in several different areas, so can't be recommended.
This needs a follow up; please report it as a bug in Tasks web.
--
CrawfordCurrie - 01 Nov 2009
Foswiki:Tasks.Item2317
I won't hack the core code. I thought maybe there could be a way around using template files instead of template topics but I soon gave up.
--
LarsEik - 01 Nov 2009
As noted in
Foswiki:Tasks.Item2317, a simple workaround is to use this in the view template:
%TOC{"%BASETOPIC%" web="%BASEWEB%"}%
%INCLUDE{%BASEWEB%.%BASETOPIC%}%
Using this format, the table of contents will include any headings in both the view template and the base topic.
--
LynnwoodBrown - 27 Jun 2012