Dear all.. I have a problem while making conditional display in template. I have a variable called fulltext. When I write <!-- TMPL_VAR NAME="fulltext" -->, it gets displayed in the output. Its value is either TRUE or FALSE. Now what I want to do is, show or hide a block of code on the basis of this variable. If it is TRUE then show a link and if it is FALSE then hide a link. How am I supposed to do this?? What should the <!-- TMPL_IF --> block and <!-- TMPL_ELSE --> block look like??? Please Help. -- Nitesh Rijal BE IT rijal.it@gmail.com http://niteshrijal.com.np http://facebook.com/openrijal http://twitter.com/openrijal +9779841458173
2010/8/8 Nitesh Rijal <rijal.it@gmail.com>:
Dear all.. I have a problem while making conditional display in template. I have a variable called fulltext. When I write <!-- TMPL_VAR NAME="fulltext" -->, it gets displayed in the output. Its value is either TRUE or FALSE. Now what I want to do is, show or hide a block of code on the basis of this variable. If it is TRUE then show a link and if it is FALSE then hide a link. How am I supposed to do this?? What should the <!-- TMPL_IF --> block and <!-- TMPL_ELSE --> block look like??? Please Help.
Hi Nitesh What you need to do is not set an actual value if it is false. So it should contain a value if true, and be undefined if false. Then you can simply do <!-- TMPL_IF NAME="fulltext"--> block of code <!-- /TMPL_IF --> This type of question is much better suited to the development list, which I have cc'd please reply to there only (I have left the other list in case you aren't subscribed) Chris
Nitesh Rijal wrote:
What should the <!-- TMPL_IF --> block and <!-- TMPL_ELSE --> block look like???
A look at any of many *.tmpl files in the Koha source tree reveals the answer, i.e. <!-- TMPL_IF name="fulltext" --> This is IF <!-- TMPL_ELSE --> This is ELSE <!-- /TMPL_IF --> HTH! cheers rick -- _________________________________ Rick Welykochy || Praxis Services Always behave as if nothing had happened, no matter what has happened. -- Arnold Bennett
I've tried that, It works in the KOHA 3.0.3 in Debian, but doesn't in KOHA 3.0.6 in Ubuntu. On Sun, Aug 8, 2010 at 4:19 PM, Rick Welykochy <rick@praxis.com.au> wrote:
Nitesh Rijal wrote:
What should the <!-- TMPL_IF --> block and <!-- TMPL_ELSE --> block look
like???
A look at any of many *.tmpl files in the Koha source tree reveals the answer, i.e.
<!-- TMPL_IF name="fulltext" --> This is IF <!-- TMPL_ELSE --> This is ELSE <!-- /TMPL_IF -->
HTH!
cheers rick
-- _________________________________ Rick Welykochy || Praxis Services
Always behave as if nothing had happened, no matter what has happened. -- Arnold Bennett
-- Nitesh Rijal BE IT rijal.it@gmail.com http://niteshrijal.com.np http://facebook.com/openrijal http://twitter.com/openrijal +9779841458173
participants (3)
-
Chris Cormack -
Nitesh Rijal -
Rick Welykochy