Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 02:21 pm EST
Geeklog Forums
advanced template logic
Status: offline
remy
Forum User
Full Member
Registered: 06/09/03
Posts: 162
Location:Rotterdam & Bonn
I noticed that the following construct 'works':
{!!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:
{!!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.
Text 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:
Text 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.
27
22
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
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
One of the Geeklog Core Developers.
See http://wiki.geeklog.net/Caching_Template_Library
One of the Geeklog Core Developers.
18
25
Quote
All times are EST. The time is now 02:21 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content