This question about Using an extension: Answered

each time I use %CALC% inside %IFDEFINEDTHEN% I get additional }% in page text

If I write code like this:
%CALC{"$SET(sys_webs, %FLEXWEBLIST{include="%BASEWEB%(/\w+)?" subwebs="only" separator=","}%)"}%

not empty

when I display this page - everything works ok. But when I include it - then things start to break. My output is:

PREVLINE"}% not empty 

Each time I include page with IFDEFINEDTHEN plugin - I get additional }% string in page text. And it's not connected with FLEXWEBLIST plugin - whatever I put inside sys_webs variable gets the same result.

You have to escape the % otherwise the parser cuts it improperly:
%CALC{"$SET(sys_webs, %FLEXWEBLIST{include="%BASEWEB%(/\w+)?" subwebs="only" separator=","}%)"}%
Will be parsed as:
%CALC{"$SET(sys_webs, %FLEXWEBLIST{include="%BASEWEB%(/\w+)?" subwebs="only" separator=","}%  here your CALC will end, and then it will print out the rest, so )"}%
. Same for your second example.

So, if you want to use some
%MACRO{ params }% inside another one, simply replace the % sign with $percnt, so:
%CALC{"$SET(sys_webs, $percntFLEXWEBLIST{include="%BASEWEB%(/\w+)?" subwebs="only" separator=","}$percnt)"}%
And it should work.

-- Main.OlivierRaginel - 11 Dec 2009

QuestionForm edit

Subject Using an extension
Extension IfDefinedPlugin
Version Version in SVN
Status Answered
Topic revision: r2 - 11 Dec 2009, OlivierRaginel - This page was cached on 21 Jan 2018 - 07:15.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License