@All Couchies,
My folders are generated using the "dynamic_folder".
I have the following code to display the folder structure in JSON.
I made the above refering to the post:
viewtopic.php?f=2&t=3112
But I have the following problem. The folders are not outputting as they should.
I have the structure:
But the JSON is outputted as here. Please see object #5.
Also I was wondering if an N-Depth JSON can be achieved or not, coz the number of department and their child or child-of-child, etc are not defined beforehand.
Regards,
GenXCoders
My folders are generated using the "dynamic_folder".
I have the following code to display the folder structure in JSON.
- Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
<cms:content_type 'application/json'/>
<cms:template title='Department JSON' order='101' icon='home' hidden='1 '/>
<cms:content_type 'application/json'/>
<cms:set deptId="<cms:gpc 'deptId' method='get' />" />
<cms:set dept_count='0' scope='global' />
{
"department" :
[
<cms:folders masterpage='dept-emp.php' order='desc' depth='1'>
{
"deptId":"<cms:show k_folder_id />",
"deptName":"<cms:show k_folder_title />",
"hasChild":"<cms:if k_folder_totalchildren = '0'>0<cms:else />1</cms:if>",
"<cms:show k_folder_title />":
[
<cms:set sub_dept_count='0' />
<cms:if k_folder_immediate_children >
<cms:folders masterpage='dept-emp.php' order='desc' childof=k_folder_name depth='0'>
{
"deptId":"<cms:show k_folder_id />",
"deptName":"<cms:show k_folder_title />",
"hasChild":"<cms:if k_folder_totalchildren = '0'>0<cms:else />1</cms:if>",
"<cms:show k_folder_title />":
[
<cms:set sub_sub_dept_count='0' />
<cms:if k_folder_immediate_children >
<cms:folders masterpage='dept-emp.php' order='desc' childof=k_folder_name depth='1'>
{
"deptId":"<cms:show k_folder_id />",
"deptName":"<cms:show k_folder_title />",
"hasChild":"<cms:if k_folder_totalchildren = '0'>0<cms:else />1</cms:if>"
}<cms:incr sub_sub_dept_count /><cms:if sub_sub_dept_count!=k_total_folders> , </cms:if>
</cms:folders>
</cms:if>
]
}<cms:incr sub_dept_count /><cms:if sub_dept_count!=k_total_folders> , </cms:if>
</cms:folders>
</cms:if>
]
}
<cms:incr dept_count />
<cms:if dept_count!=k_total_folders> , </cms:if>
</cms:folders>
]
}
<?php COUCH::invoke(); ?>
I made the above refering to the post:
viewtopic.php?f=2&t=3112
But I have the following problem. The folders are not outputting as they should.
I have the structure:
Development
- Software Developer
- - Mobile Developer
- - - iPhone Developer
But the JSON is outputted as here. Please see object #5.
Also I was wondering if an N-Depth JSON can be achieved or not, coz the number of department and their child or child-of-child, etc are not defined beforehand.
Regards,
GenXCoders