I'm currently using the Extended Template Parser Library for CodeIgniter. I'm running into issues when trying to template-parse nested arrays. Here is the array I am feeding the view:
Array
(
[users] => Array
(
[0] => Array
(
[id] => 42
[username] => jordanarseno
[posts] => Array
(
[0] => Array
(
[id] => 1354
[title] => foo
)
[1] => Array
(
[id] => 1350
[title] => bar
)
)
)
)
)
I am able to render the users details...{username}, {firstname} etc. But I am not able to render the posts details.
My template code is straightforward and the following:
{users}
{username}
{posts}
{title}
{/posts}
{/users}
PHP throws the following errors:
A PHP Error was encountered Severity: Warning Message: preg_match_all() [function.preg-match-all]: Compilation failed: nothing to repeat at offset 2 Filename: libraries/Parser.php Line Number: 474
I'm beginning to think that the library does not support nested arrays insofar as multiple sub arrays as I need. The library comes with many tests. There is a specific test that takes:
[posts] => Array
(
[0] => Array
(
[title] => first post
[paras] => Array
(
[main] => foo
[short] => bar
)
)
And renders it in the view properly. However, as you can see, My requirements are that it go in one layer further.
Does anybody else use this library and have you run into similar issues? If not, what do you use for CodeIgniter template parsing? How nested will it go? I'm open to all suggestions and will move to another library if needed.