-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering records from idiorm #22
Comments
I can't test this right now, but I think that Mustache promotes the scope of the object inside the loop, so the correct syntax would be:
Sorry if you've tried this already.. |
Yes, I've tried that too. and would seem logical to do that. I thought that was a problem with the structure of the ORM object, so I did a test using the complex example provided with mustache, something like this (roughly, will get the proper example later):
and in mutache but only age is rendered. Turning all the parser's exceptions to true tells that name is an unknown variable |
I've found the problem - on line 609 of The following code example now works:
|
I can confirm that the fix is working. More an idiorm issue than mustache's sorry for reporting here and thanks j4mie :) |
No worries, glad you got it figured out. |
Hi, I've been playing with mustache in combination with idiorm and slim.
So I have this view:
where albums are records from the database that has two columns, "name" and "description".
Naively, I've tried this in test.html:
or a combination of that kind of things. I don't know much of idiorm or mustache's internals and I'm new to PHP myself, but for what I get to see my problem relies in that I don't know the value of the inner object in the loop (the index inside the #albums section) so I can't access it's variables or anything.
Mustache doesn't provide any way to map the inner object to a variable, as would result with a foreach loop (which in turn works as expected):
How would you solve this situation?
PD: I'm not really sure if this is not the place to ask this questions :)
PD: I have the complete app here
The text was updated successfully, but these errors were encountered: