Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > d8544620e4ac7bee48ddb48c85d55709 > files > 107

ikiwiki-3.20190228-1.mga7.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>if</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="../../style.css" type="text/css" />

<link rel="stylesheet" href="../../local.css" type="text/css" />






<meta name="robots" content="noindex, follow" />



</head>
<body>

<div class="page">

<div class="pageheader">
<div class="header">
<span>
<span class="parentlinks">

<a href="../../index.html">ikiwiki</a>/ 

<a href="../../ikiwiki.html">ikiwiki</a>/ 

<a href="../directive.html">directive</a>/ 

</span>
<span class="title">
if

</span>
</span>



</div>









</div>





<div id="pagebody">

<div id="content" role="main">
<p>The <code>if</code> directive is supplied by the <a href="http://ikiwiki.info/plugins/conditional/">conditional</a> plugin.</p>

<p>With this directive, you can make text be conditionally displayed on a page.
For example:</p>

<pre><code>[[!if  test="enabled(smiley)"
      then="The smiley plugin is enabled :-)"
      else="No smiley plugin here.."]]
</code></pre>

<p>If the specified <code>test</code> succeeds, the <code>then</code> text will be displayed,
otherwise the <code>else</code> text will be displayed. The <code>else</code> part is optional.</p>

<p>The <code>then</code> and <code>else</code> values can include any markup that would be allowed
in the wiki page outside the template. Triple-quoting the values even allows
quotes to be included.</p>

<p>The <code>test</code> is a <a href="../pagespec.html">PageSpec</a>; if it matches any page in the wiki
then it succeeds. So you can do things like testing for the existence of a
page or pages, testing to see if any pages were created in a given month,
and so on.</p>

<p>If you want the <a href="../pagespec.html">PageSpec</a> to only match against the page that
contains the conditional, rather than matching against all pages in the
wiki, set the "all" parameter to "no".</p>

<p>In an <code>if</code> directive, the regular <a href="../pagespec.html">PageSpec</a> syntax is expanded
with the following additional tests:</p>

<ul>
<li><p>enabled(plugin)</p>

<p>Tests whether the specified plugin is enabled.</p></li>
<li><p>sourcepage(glob)</p>

<p>Tests whether the glob matches the name of the page that contains the
conditional.</p></li>
<li><p>destpage(glob)</p>

<p>Tests whether the glob matches the name of the page that is being built.
That might be different than the name of the page that contains the
conditional, if it's being inlined into another page.</p></li>
<li><p>included()</p>

<p>Tests whether the page is being included onto another page, for example
via <a href="./inline.html">inline</a> or <a href="./map.html">map</a>.  Note that pages inserted into other pages
via <a href="./template.html">template</a> are not matched here.</p></li>
</ul>

</div>







</div>

<div id="footer" class="pagefooter" role="contentinfo">

<div id="pageinfo">






<div id="backlinks">
Links:

<a href="../../plugins/conditional.html">plugins/conditional</a>


</div>






<div class="pagedate">
Last edited <span class="date">Tue Feb 26 23:01:54 2019</span>
<!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> -->
</div>

</div>


<!-- from ikiwiki -->
</div>

</div>

</body>
</html>