fraze |
|
---|---|
Hi I've got some issues with CoTemplate statements... I have created an extra iserfield for the site i've built that lets them choose which class they play in-game. what i'd like to be able to do is that when they choose a class the CoTemplate picks up that class and shows a div. This is what i've got but when i use it, it loads all of the divs, not just the one shown by {USERS_DETAILS_CLASS} <!-- IF {USERS_DETAILS_CLASS} = 'Heavy Assault' --> <div class="heavy"></div> <!-- ENDIF --> <!-- IF {USERS_DETAILS_CLASS} = 'Engineer' --> <div class="engi"></div> <!-- ENDIF --> <!-- IF {USERS_DETAILS_CLASS} = 'Infiltrator' --> <div class="infil"></div> <!-- ENDIF --> <!-- IF {USERS_DETAILS_CLASS} = 'Light Assault' --> <div class="lighta"></div> <!-- ENDIF --> <!-- IF {USERS_DETAILS_CLASS} = 'MAX' --> <div class="max"></div> <!-- ELSE --> <div class="noclass"></div> <!-- ENDIF --> Any help would be greatly appreciated :) Added 6 minutes later: i just realised i'd only put one '=' - with '==' in the statements....nothing shows up. Added 4 minutes later: ok i've fixed the problem... http://www.cotonti.com/docs/ext/themes/xtemplate_introduction is wrong. it shows that the following statement will work as an example: <!-- IF {USER_DETAILS_NAME} = 'Mark' AND {PHP.g} >= 6 OR !{PHP.error_string} --> <div>The expression is true!</div> <!-- ELSE --> <div>The expression is false!</div> <!--END:TEST--> where it actually needs to be <!-- IF {USER_DETAILS_NAME} == "Mark" AND {PHP.g} >= 6 OR !{PHP.error_string} --> <div>The expression is true!</div> <!-- ELSE --> <div>The expression is false!</div> <!--END:TEST--> had to re-read the article 3 times to make sure I wasnt missing things while reading... at least its sorted :) |
|
This post was edited by fraze (2012-07-09 21:03, 12 years ago) |
Trustmaster |
|
---|---|
There is no '=' operator in CoTemplate, it is '=='. You're right, those examples are wrong. I've corrected them, thanks for noticing! Also it should be 'ENDIF' instead of 'END:TEST'. May the Source be with you!
|