Hi,
I’m using php in this template. And I’m getting the Parsing error. So this is part of the code:
1<?php
2 $entries = array();
3 {exp:channel:entries channel="locatie" disable="categories|category_fields|member_data|pagination" dynamic="yes" limit="1" }
4 $entries['titel'] = '{locatie_naam_{language_code}}';
5 {exp:playa:children channel="locatie_categorie" field="categorie" status="open" }
6 $entries['categorie']['subcategorie'][{entry_id}]['titel'] = "{cat_naam_{language_code}}";
7 {embed="api/hoofd" eid="{entry_id}"}
8 {/exp:playa:children}
9 {/exp:channel:entries}
10
11 header('Content-type: application/json');
12 echo json_encode($entries);
13?>I’m embedding a second template:
1{exp:playa:children channel="locatie_categorie" field="cat_parent" entry_id="{embed:eid}" status="Hoofdcategorie" }
2 if(empty($entries['categorie']['hoofdcategorie'][{entry_id}])){
3 $entries['categorie']['hoofdcategorie'][{entry_id}]['titel'] = "{cat_naam_{language_code}}";
4 }
5{/exp:playa:children}PHP Parsing was set to occur after rendering of the template tags.
This is one of many templates like that, but the only one with embedding another template.
The error occurs on line 7.
So I disabled the PHP Parsing to have a look at the source code. And it looks like this:
1<?php
2 $entries = array();
3 {exp:channel:entries channel="locatie" disable="categories|category_fields|member_data|pagination" dynamic="yes" limit="1" }
4 $entries['titel'] = "test titel";
5
6 $entries['categorie']['subcategorie'][{entry_id}]['titel'] = "bezienswaardigheden";
7 if(empty($entries['categorie']['hoofdcategorie'][2])){
8 $entries['categorie']['hoofdcategorie'][2]['titel'] = "visit heritage";
9 }
10…That looked ok. But why, did EE throw an error?
So I copy pasted the PHP into a php file and tried it on the server. It gave no error…
Does anyone know what the problem could be?