I realize this is not the correct forum but I am sadly not a license holder after spending way too much money on my trip to EECI2010 US. 😊
I am working on a module which is 90% complete, but I am having trouble looping through multi-dimensional arrays.
Basically, this works fine:
<ul>
{exp:rest name="twitter_timeline"}
<li>
<strong>{created_at}</strong> - {text}
</li>
{/exp:rest}
</ul>That gives me:
# Sat May 22 18:34:34 +0000 2010 - @ErikReagan For the sake of your followers, next time mention what of mine you are looking forward to playing with. # Sat May 22 17:30:52 +0000 2010 - Announcing my #eecms module: REST http://is.gd/ckIqa http://is.gd/ckIq9 http://is.gd/ckIq8 http://is.gd/ckIq5 # Sat May 22 15:03:36 +0000 2010 - Maintaining the correct development-to-pub ratio. 3 hours of #webdev, 1 hour of pub.
However, when I add in an extra line to get {name} from inside the {user} array (I have done some reformatting to make EE happier) like this:
<ul>
{exp:rest name="twitter_timeline"}
<li>
{user}{name}{/user}<br>
<strong>{created_at}</strong> - {text}
</li>
{/exp:rest}
</ul>I get this:
# Phil Sturgeon {created_at} - @ErikReagan For the sake of your followers, next time mention what of mine you are looking forward to playing with. # Phil Sturgeon {created_at} - Announcing my #eecms module: REST http://is.gd/ckIqa http://is.gd/ckIq9 http://is.gd/ckIq8 http://is.gd/ckIq5 # Phil Sturgeon {created_at} - Maintaining the correct development-to-pub ratio. 3 hours of #webdev, 1 hour of pub.
Here is the array I am working with.
Is this because I am looping through what EE considers to be the same array?
Nobody seems to use the IRC channel and other than Jamie Rumbelow I have no real support structure for any difficulties I run into developing modules until I have a license. That will be the first thing I buy when this module sells a few copies. :shut:
[Mod Edit: Moved to the Modules forum]
Hi Phil,
I’m afraid that I can’t provide direct assistance for this. All I can do is point to you the Developer Documentation but I think you should pay special attention to the Template class if you’ve not looked at that yet.
I’ll move this thread into the How To forum for you.
Cheers
Greg
Hi Phil,
If you place the created_at tag behind the text tag, what happens then?
<ul>
{exp:rest name="twitter_timeline"}
<li>
{user}{name}{/user}<br>
{text} - <strong>{created_at}</strong>
</li>
{/exp:rest}
</ul>Does it break the text variable or is it still the created_at that is borked?
Greetz, Wouter
Hey Wouter,
I have tried moving everything around. Swapping the first line within li with the second, swapping text and created_at as you suggested, none of that helps.
Jamie Rumbelow has hacked Template library to work by commenting out line 4049:
$this->unfound_vars[$name] = TRUE;This seems to work fine, but not exactly helpful for anyone using EE2 right now. I need a plan of action here. Am I trying to do something wrong or is this a bug? 😏
Okay… I did some manual labour and I stumbled upon something that might be worth looking at.
You know there are 2 keys named ‘created_at’, 1 in the main array and 1 in the ‘user’ array.
Somehow it is adding one to the unfound_vars array and by doing so, also disabling the other variable. EE doesn’t store these keys in context, so it can’t tell the two apart.
So this might be a bug in EE… but that is not up to me to say.
This is the snippet I used to test it btw: http://pastie.org/973852 (I dropped it into a module I am developing)
I changed the ‘created_at’ in the user array to ‘joined’ and it started working.
Greetz, Wouter
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.