Forums / Cotonti / Core Labs / Archive / Logic blocks for xtemplate

<<<12

KillerSneak
#16 2009-07-20 21:15
# Trustmaster : There are no logic blocks in 0.0.5. In 0.0.6
<!-- IF {PHP.usr.profile.user_maingrp} > 17 -->   
<!-- ENDIF -->
would work. And if you read carefully, all those 547328957483257 TPL tags are Admin area. Which had to be templated somewhen like it or not. Sorry for being that rude to you.
Your not rude (as one of few the admins/dev's) just couldn't find anywhere in this topic/forum on what version / system it works. And I'm against TAGS adding no matter what CMS as it's a pain in the ass (most of the time) to redo already modded templates. So this only works starting with 0.0.6? (just to be clear)
Trustmaster
#17 2009-07-20 21:43
Yes it only works starting with 0.0.6.

I know it's hard to change the templates (because I did it for this site, which was actually running 0.0.4 before). We thought tpltags listing would help, but it is confusing you with all those ADMIN tags, which are really new and had to emerge somewhen. As for the rest, most of all tags are left untouched. The only valuable changes are about the Submit button in page.add.tpl and page.edit.tpl and the PM templates that were split into list and display/reply. An article/tutorial about updating skins would be helpful, but there isn't anybody who has done it in his spare time so far. So, if someone did, we would be very grateful.
May the Source be with you!
KillerSneak
#18 2009-07-20 22:00
Well i have to update my site to 0.0.6 but can't during workign days (making 12 hour shifts because of the vacation perioud) If before this weekend nobody has a TUT i will write down the changes i have made with the templates and post my findings. Thanks for your clear and fast responce Trustmaster.
Trustmaster
#19 2009-07-20 22:05
You're welcome. If everybody makes a small input, it will be a great value overall.
May the Source be with you!
GHengeveld
#20 2009-09-30 05:25
I've just added some extra functionality to the XTemplate logic blocks system. With changeset 988 / 989 you can use two new operators, namely HAS and CONTAINS. These can be used to access the PHP functions array_search() and strpos() respectively.

Examples:
<!-- IF {PHP.usr.name} CONTAINS 'test' -->
Your nickname contains the phrase 'test' !
<!-- ENDIF -->

The second example could be used in conjunction with a plugin listing your user subgroups in an array, something like this:
<!-- IF {PHP.subgroups} HAS 'moderators' -->
You are a member of the 'moderators' user group.
<!-- ENDIF -->

UPDATE: I realized that array_search() would be more practical so I updated the HAS operator to use that instead of in_array(). This will make sure it checks the values, not the keys.

Dit bericht is bewerkt door Koradhil (2009-09-30 05:47, 14 jaren ago)
Trustmaster
#21 2009-09-30 15:57
It is OK for me. Any contras?
May the Source be with you!
GHengeveld
#22 2009-09-30 20:30
Well, it could slow down the parsing when using HAS on a huge array, but that's up to the developer/admin to prevent (or to accept). It will hardly (if at all) slow down parsing when you're not using the new operators.

Dit bericht is bewerkt door Koradhil (2009-09-30 20:41, 14 jaren ago)
tensh
#23 2009-10-02 18:47
I'd like to ask: where are the global TPL tags listed? o_O I'm blind...
http://www.cotonti.com/plug.php?e=tpltags - here are other ones... but not global.
Kilandor
#24 2009-10-02 18:53
There is a near infinite amount of possible global tags, its not possible to list all or basicly any {PHP.*} tags

<<<12