Subject: advanced template logic

Posted on: 30/11/18 08:21am
By: remy

I noticed that the following construct 'works':

PHP Formatted Code

{!!if in_array({a_var} , array({another_var})) !!}
myVar: {a_var}
{!endif}
 


The question is: is this supported now and in the future?

This brought me to the following code to process a var that IS an array:

PHP Formatted Code

{!!set myVar array('a', 'b') !!}
{!!set myCount 0 !!}
{!!while !empty(array_slice({myVar}, {myCount}, 1)) !!}
{!!set myVar1 array_slice({myVar}, {myCount}, 1)[0] !!}
myVar: {myVar1}
{!inc myCount}
{!endwhile!}
 


Same question here.

Re: advanced template logic

Posted on: 30/11/18 09:11am
By: Laugh

Yes since it is an advanced action using an expression. I've added you example just now to the Geeklog Wiki Caching Template page.

See http://wiki.geeklog.net/Caching_Template_Library

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=96923