Right I’ve fixed that issue.
Hadn’t Initialised the Class.
Here’s a new one:
How do I create a Template Group that is a Duplicate of another? As the EE documentation doesn’t help!
'group_name' => $groupname,
'group_order' => 2,
'is_site_default' => 'n',
‘duplicate_group’ => 16, ‘site_id’ => 1
That produce a Database Error.
Anyone know the answer?
Here’s the error generated by the above code:
Error Number: 1052
Column ‘group_id’ in where clause is ambiguous
SELECT template_name
, template_data
, template_type
, template_notes
, cache
, refresh
, no_auth_bounce
, allow_php
, php_parse_location
, template_id
, template_name
, group_name
FROM (exp_templates
) JOIN exp_template_groups
ON exp_templates
.group_id
= exp_template_groups
.group_id
WHERE exp_templates
.site_id
= 1 AND group_id
= 16 ORDER BY group_name
, template_name
Filename: C:\wamp\www\system\codeigniter\system\database\DB_driver.php
The documentation says this:
$this->EE->api_template_structure->create_template_group((array) $data, (int) $duplicate) Example Usage:
$data = array( ‘group_name’ => ‘home’, ‘group_order’ => 2, ‘is_site_default’ => ‘n’, ‘site_id’ => 1 );
$this->EE->api_template_structure->create_template_group($data, 1);
Is the ID of the Duplicate supposed to be in the $data, or the $duplicate?
Because neither works!
Thanks for the reply.
I already know that.
It needs to be done in code, hence using the API.
This is what I am doing:
Admin creates an Entry in the Clients Channel, my code then creates a MemberGroup, a TemplateGroup and a Directory on the webserver for uploads.
It is all working with the exception that it doesn’t duplicate the template group, it just creates a new one with an empty Index template.
I’m trying to follow the API Documentation for duplicating a template group using the API, but it either doesn’t work or produces the SQL Error (see previous post).
UKFreelancer.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.