Question
I have been playing around with
Support.HowToIntegrateWeekAndMonthCalendar. I don't want to include all of the page control goo everytime I make a new calendar, so I thought I would include this from a single Boilerplate page.
Unfortunately, when I tried this, the variables weren't set properly.
The Boilerplate file contains
%STARTINCLUDE%
<!--
%CALC{"$SET(curtime, $IF($LENGTH(%URLPARAM{"time"}%) == 0, $TIME(), %URLPARAM{"time"}%)))"}%
%CALC{"$SET(curyear, $VALUE($FORMATTIME($GET(curtime), $year)))"}%
...
* Set CURTIME = %CALC{"$GET(curtime)"}%
* Set CURDAY = %CALC{"$GET(curday)"}%
* Set CURYEAR = %CALC{"$GET(curyear)"}%
...
The page that INCLUDEs this gives me an error
%CALENDAR{ topic="CalendarEventsList" width="100%" cellheight="100" vcellalignment="top" showweekdayheaders="1" weekstartsonmonday="1" year="%CURYEAR%" month="%CURMONTH%" }% has invalid year specification.
And doies not recognize the variables
* Current time = %CURTIME%
* Curent year = %CURYEAR%
Although a View Source on that page indiates the variables
have been set.
Am I missing something obvious? Do INCLUDEd vars not work "as expected"?
Environment
--
VickiBrown - 31 Aug 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
INCLUDEs work as expected - unless you expect variables set in them to be set in the context of the including topic.
Look at it this way; if I write
* Set ALLOWTOPICVIEW = Nobody
in a topic, and then include it in another topic, does the access control apply to the included topic, or the including topic? Obviously it applies
only to the included topic. The same is true of any other TWiki variable; the context of the Set is the topic in which the set is found, and the value does not propagate to topics that
include that topic.
Another example; if I have
* Set A = X
%INCLUDE{OtherTopic}%
%A%
in the
including topic and
* Set A = Y
in the
included topic, then what is the value of
A? How about if the INCLUDE was before the Set in the including topic?
I guess the designers of
Set chose to avoid questions like these.
--
CrawfordCurrie - 01 Sep 2007
What is the value of A? The most recently Set value., I think this wqould be obvious... and from a review of how often this question comes up in Support questions, a lot of people agree.
--
VickiBrown - 04 Sep 2007
Bug report filed
Bugs:Item4546
--
VickiBrown - 04 Sep 2007
Feature proposal:
Codev.INCLUDEdSetvariablesshouldwork
--
VickiBrown - 07 May 2008