This question about Topic Markup Language and applications: Answered

Display all topics as list which might be expanded

Hello,

I would like to prepare FAQ page, so that all topics will be displayed as list of questions.
I know how to display them as links by means of Search macro, but I would like to apply another approach.

I would imagine it as follows: Once user click on question, appropraite topic content will be unfolded (as it can be achieved through TwistyPlugin).

How should I do that? Do I need to use ForEach plugin?
I've tried to embed TWISTY within Search query, but it produce only div tags.

My query is now as follows:

%SEARCH{
      "1"
      type="query"
      nonoise="on"
      order="$formfield(Question)"
      web="FAQ"
      format="%TWISTY{ showlink="Show $topic" hidelink="Hide"}% %INCLUDE{$web.$topic}% %ENDTWISTY%"
}%

-- MateuszKDzior - 07 Jan 2015

The problem with your example is that you need to delay the expansion of the twisty and include, so it expands with the results of the search. Remember Foswiki macros are expanded inside-out left-right. So in your example here, FIRST the TWISTY, INCLUDE and ENDTWISTY expand in order. The INCLUDE won't understand $web $topic, so that errors. Only then does the search run.

So change the percent characters in your format to $percnt.
      $percntTWISTY .... $percnt  $percntINCLUDE ...$percnt $percntENDTWISTY$percnt"

You might also need to escape your quotes inside the format, either as \" or $quot. ... but not sure about that.

-- GeorgeClark - 08 Jan 2015

George is correct about the quotes. you'd need to use this:

format="$percntTWISTY{ showlink=\"Show $topic\" hidelink=\"Hide\"}$percnt $percntINCLUDE{$web.$topic}$percnt $percntENDTWISTY$percnt"
or
format="$percntTWISTY{ showlink=$quotShow $topic$quot hidelink=$quotHide$quot}$percnt $percntINCLUDE{$web.$topic}$percnt $percntENDTWISTY$percnt"

Personally, I find \" slightly easier to read.

-- LynnwoodBrown - 09 Jan 2015

Thanks.

-- MateuszKDzior - 12 Jan 2015
 

QuestionForm edit

Subject Topic Markup Language and applications
Extension TwistyPlugin, foreachplugin
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r4 - 12 Jan 2015, MateuszKDzior
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy