Template Logic Question
-
Hi all,
I am working on a custom template, and I am running into an issue that was hoping one of the folks here who is smarter than me (I think that is everyone) can help with.
I've created a partial that is referenced in home.tpl that displays content above the forum category listing. The partial is working just fine and the markup is rendering properly. But I want the content displayed to change depending on whether the user is logged in or not. This part doesn't seem to be working.
This is the code I have... am I missing something?
<!-- IF isLoggedIn --> Logged In Content <!-- ELSE --> Not logged in content <!-- ENDIF isLoggedIn -->
I've also tried the below to no avail.
<!-- IF isLoggedIn --> Logged In Content <!-- ENDIF isLoggedIn --> <!-- IF !isLoggedIn --> Not logged in content <!-- ENDIF !isLoggedIn -->
Thanks yall!!
-
Which part is showing, the true or false case? (Or neither or both? Lol)
Can you have a look at your 'domain.org/api/home' and verify if the isLoggedIn parameter is being sent in?
-
LOL okay I got it. The parameter is "loggedIn" not "isLoggedIn"
And here I was really dreading trying to fix template bugs at 9pm
-
Ahh sorry - Should have explained that part.
In the if/else/endif case, the else displays when I am logged in.
In the if/endif if/endif case, nothing shows.
-
You beat my reply by a min (on mobile). Try switching your if cases to "loggedIn" and let me know if it works
-
holy monkey butts it works!!
Just out of curiosity, is that a different parameter from what is in the menu.tpl file? In the vanilla theme, the logic shows <!-- IF isLoggedIn --> to control what displays in the header.
Thanks for the help!!!! Here are three buns just for you.
credit: http://imgur.com/iFdZQze -
Lol so we had a discussion on Skype and apparently there's an anomaly, our exposed config has isLoggedIn while our template globals is loggedIn. We will standardize it for v0.5 sorry for the confusion!
EDIT: if anything changes I'll submit a PR on your theme, if it's publically available
-
@psychobunny Apologies far from necessary! Thanks again.
-
No prob