• Resolved vesnama

    (@vesnama)


    Hello,

    I am trying to display event data from related event post only if for the main post boolean value for “rezervacije_otvorene” (meaning bookings open) is checked to “yes”. But value check doesn’t work neither outside nor inside each loop. The value itself is ok, I tested display in frontend and it shows Yes.

    [if rezervacije_otvorene="Yes"]test value check outside of loop[/if]
    
    [if events]
    
    	[each events]{@event_type}: {@datum}, {@mjesto}
    
    		[if rezervacije_otvorene="Yes"]	<p>{@event_link}
    						<br>{@ulaznice}
    						<p>{@rezervacije}[/if]
    
    	[/each] [/if]
    

    What am I doing wrong in value check in if conditional?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    The test is done on the storage value, not the display value.
    It should be: [if rezervacije_otvorene="1"] (or just: [if rezervacije_otvorene])

    Cheers, Jory

    Thread Starter vesnama

    (@vesnama)

    Tnx, check against value 1 and 0 works, but only outside of each loop. Is there a solution for it to work inside each loop also?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Within an each loop the current context is changed to the object in that each loop.
    I don’t think fields from the “parent” context are available at that point within Pods templates.
    PHP would be your best option!

    Cheers, Jory

    Thread Starter vesnama

    (@vesnama)

    I understand. Than to avoid php my solution could be to have if check first and then else with each loop in both results. ??

    Plugin Author Jory Hogeveen

    (@keraweb)

    Honestly, I would advice to get familiar with PHP seeing the amount of topics where you encounter limits with Pods. As I mentioned, Pods can do a lot but with actual PHP you can do so much more!

    Cheers, Jory

    Thread Starter vesnama

    (@vesnama)

    Yes, I see that I should. ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Pods template: Boolean field value check’ is closed to new replies.