Search
Other Articles Anywhere questions
Forum

Not getting the Results I'm expecting with IF statement

Vinny Hebert's Avatar Vinny Hebert
	{articles category="Events" ordering="event-date ASC"}
	{if cancelled = "Cancelled"}
		<li class="[eventscategory:value]">
			<div class="uk-inline-clip">
				<div class="uk-transition-fade uk-position-cover uk-overlay uk-overlay-default uk-flex uk-flex-center uk-flex-middle" >
					<div class="uk-overlay uk-dark uk-position-center uk-text-center">
						<img src="/events/cancelled.jpg" />
					</div>
				</div>
			</div>
		</li>
	{else}	
		<li class="[eventscategory:value]">
			<div class="uk-inline-clip uk-transition-toggle" tabindex="0">
				[link][event-image class="uk-border-rounded"][/link]
				<div class="uk-transition-fade uk-position-cover uk-overlay uk-overlay-default uk-flex uk-flex-center uk-flex-middle" >
					<div class="uk-overlay uk-dark uk-position-center uk-text-center">
						<p class="uk-margin-remove">[event-date] [end-time]</p>
						<p>[venue-name]</p>

						[readmore text="More Info" class="button button-bevel"]
					</div>
				</div>
	
			</div>
		</li>
	{/if}
{/articles}	



The output of [cancelled] is "Cancelled" on the one that is set to cancelled. But it's only showing the 'else' for everyone one.
Peter van Westen's Avatar Peter van Westen ADMIN
What is the value of that field? So:
[cancelled:value]
Please post a rating at the Joomla! Extensions Directory
Vinny Hebert's Avatar Vinny Hebert
Sorry if I wasn't clear. I was letting you know what [cancelled] was outputting so the if statement should be doing the first part but instead is doing the else.
{if cancelled = "Cancelled"}
Peter van Westen's Avatar Peter van Westen ADMIN
I know... but use the value in the if check.
If the 'cancelled' field is for instance a checkbox where the actual value is '1', check for that.

If the value of 'cancelled' is empty for the articles that are not Cancelled, then you could simply do:
{if cancelled}

Assuming you are using Joomla 4, see:
docs4.regularlabs.com/articlesanywhere/g...ctures#custom-fields
Please post a rating at the Joomla! Extensions Directory
Vinny Hebert's Avatar Vinny Hebert
So the field is Tassos Marinos Advance Custom Field True/False field. I'm wandering if it's the field that's a problem and simply should do a checkbox.
Peter van Westen's Avatar Peter van Westen ADMIN
So again, what does this output?
[cancelled:value]
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
Or try:
{if cancelled:text = "Cancelled"}
Please post a rating at the Joomla! Extensions Directory
Vinny Hebert's Avatar Vinny Hebert
That last one worked! Thank you
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription