Fluid और अनुवाद · प्रश्न 10 / 12
एक button को class active या inactive मिलनी चाहिए, इस पर निर्भर करते हुए कि {conference.online} true है या नहीं। कौन-सा notation सही है?
1 उत्तर सही है। मध्यम
उत्तर दिखाएँ
उत्तर
- B class="{f:if(condition: conference.online, then: 'active', else: 'inactive')}"
व्याख्या
f:if जैसे condition ViewHelpers में arguments then और else होते हैं, इसलिए उन्हें attributes में inline उपयोग किया जा सकता है। inline कॉल्स को named arguments चाहिए, syntax में positional values नहीं होते। attribute के अंदर tag HTML को अमान्य बना देता है, और else शाखा गायब है।