Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 09:13 pm EST

Geeklog Forums

Can I use arrays in templates' variables?


Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
Geeklog uses a lot of variables like {this} inside its templates.
But what if {this} is an array?
In real time, it just says "Array" (no quotes).
Both {this["index X"]} and {this[index X]} (the first one with quotes, the second one - without) pass "" (empty strings).

Does it just pass the word "Array" or the array itself? I was willing to believe the first choice if only the latter two hadn't returned empty strings, which built my hopes...

I can, of course, just do a "for" loop and pass each index as its own variables, but I just want to make sure there's no way to use arrays in {this} first.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You get the "Array" text when you try to use an array where a scalar variable is expected, so it seems you can't do that ...

bye, Dirk
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
A normal array would give me that unless I used array["index"]. The question is if I can provide the "index" for a scalar variable.
 Quote

ted

Anonymous
reading the comments in the template class file will give you more of an idea about why that won't work. basically, the template class will not parse that placeholder, but will only replace it with output set before the template object is parsed... something like that.

btw, any text within the curly braces that is not set in the template object will return empty strings. Leave the text out and you'll just get curly braces.
 Quote

All times are EST. The time is now 09:13 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