Search code examples
phphtmlxmljoomla

How to use condition in xml fieldset


I have two eddition in my realise joomla web app. "Common" and "Special" edition.

I want to limit "Common" edition with exclude "icons" dir from "images".

<fileset dir="./images">
    <include name="**/**" />
    <exclude name="icons/**" />
</fileset>

expected:

<fileset dir="./images">
    <include name="**/**" />

    IN Common Eddition : <exclude name="icons/**" />

</fileset>

I tried the following code but it was not correct (Apparently, if segment cannot be used within fileset)

<fileset dir="./images">
    <include name="**/**" />

    <if>
        <equals arg1="${edition}" arg2="Common"/>
        <then>
            <exclude name="icons/**" />
        </then>
    </if>
</fileset>

Solution

  • I use condition for this

    <condition property="pass">
        <equals arg1="${edition}" arg2="common" />
    </condition>
    <fileset dir="./images">
        <include name="**/**" />
        <exclude name="icons/**" if="pass" />
    </fileset>