Articles Anywhere

If Structures don't work as expected

4 months 1 week ago #89587

Laurent's Avatar Laurent

Hello,

I have this tag

<div class="grid-actus">
    {articles category="13,14,15,16,17,18" limit="5" ordering="ordering"}
	    <div class="grid-actus-item">
            {if category="14 || 15 || 16 || 17 || 18"}
                <a title="Voir tous nos cours de cuisine" href="index.php?option=com_content&amp;view=article&amp;id=12&amp;Itemid=140">
			        <div class="image-cropper">[image-acti]</div>
			        <h3>[title]</h3>
                </a>
            {/if}
           {if category="13"}
                <a title="Voir toutes nos soirées à thèmes" href="index.php?option=com_content&amp;view=article&amp;id=13&amp;Itemid=141">
			        <div class="image-cropper">[image-acti]</div>
			        <h3>[title]</h3>
                </a>
            {/if}
            [introtext]
		<div class="grid-actus-button">
            [bouton output="value"]
        </div>
		<div class="grid-actus-date">
            [date-actu]
        </div>
	</div>
    {/articles}
    {article article="6"}
	    <div class="grid-actus-item promos">[introtext]</div>
    {/article}
</div>

But the {if category="13"} don't work, instead i have the first if content {if category="14 || 15 || 16 || 17 || 18"} display in front.

Thanks.

4 months 1 week ago #89590

Peter van Westen's Avatar Peter van Westen Admin

Do you have this online?
Can you also give me (s)ftp access so I can take a deeper look?
You can use the 'Hidden text' button in the forum editor to hide the confidential information.

4 months 1 week ago #89591

Laurent's Avatar Laurent

Ok thanks i prepare this infos, thanks.

4 months 1 week ago #89592

Laurent's Avatar Laurent

Confidential information:
(hidden)

4 months 1 week ago #89593

Peter van Westen's Avatar Peter van Westen Admin

Ok, the issue was the syntax of the if structure was off.
The syntax is a little different than what you use in the main {article} tag for filters.

So the correct syntax is:

{if catid=14 OR catid=15 OR catid=16 OR catid=17 OR catid=18}
...
{/if}{if catid=13}
...
{/if}

You could also change this to:
{if catid=14 OR catid=15 OR catid=16 OR catid=17 OR catid=18}
...
{elseif catid=13}
...
{/if}
Or simply use an else, so that it always falls back on the second block.
So maybe just:
{if catid=13}
...
{else}
...
{/if}

4 months 1 week ago #89594

Peter van Westen's Avatar Peter van Westen Admin

PS: more on the syntax for the {if} tags:
www.regularlabs.com/extensions/articlesa...torial#if-structures

4 months 1 week ago #89595

Laurent's Avatar Laurent

Ohh Yes OK i see, thanks a lot Peter 🙂 👍