SID-01768: Using %INCLUDE% within Database plugin
| Status: |
Answered |
TWiki version: |
5.1.3 |
Perl version: |
|
| Category: |
DatabasePlugin |
Server OS: |
|
Last update: |
12 years ago |
I'm trying to run some sql and they embed the results into an %INCLUDE%. The goal is to create a database-driven form that can build the appropriate form controls by referencing a seperate "widgets" topic, passing in parameters to the INCLUDE from the db results. For example,
%DATABASE{"MSDB2:Database}%"
sql="select control_type from table"
format="%INCLUDE{"FormControls" CONTROL_TYPE="$control_type"}%"
}%
Is this possible? I'm trynig to do this and it doesn't seem to resolve $control_type before passing it to the include.
Thanks
Justin
--
Justin Martin - 2013-07-24
Discussion and Answer
By default, TWiki evaluates variables inside-out, left to right. You need to escape the INCLUDE placed inside DATABASE_SQL if you want to have it evaluated after the DATABASE_SQL.
Untested:
format="$percntINCLUDE{\"FormControls\" CONTROL_TYPE=\"$control_type\"}$percnt"
--
Peter Thoeny - 2013-07-24
Brilliant, thanks
--
Justin Martin - 2013-07-24
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.