March 27, 2012 9:36am

Subscribe [2]
  • #1 / Mar 27, 2012 9:36am


    49 posts

    How are you supposed to do any development?

    I’m using EE’s example for adding a Template Group, and all I get is a blank page.

    No error messages?

  • #2 / Mar 27, 2012 9:57am


    49 posts

    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?

  • #3 / Mar 27, 2012 10:27am


    49 posts

    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

  • #4 / Mar 27, 2012 10:29am


    49 posts

    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!

  • #5 / Mar 28, 2012 9:57am


    49 posts


    Or does this need to be raised as a BUG?

  • #6 / Mar 28, 2012 3:58pm

    Rob (bluedreamer)'s avatar

    Rob (bluedreamer)

    2792 posts

    Not sure what you’re trying to do but you can duplicate a template group from the Templates manager in the Control panel…?

  • #7 / Mar 28, 2012 5:05pm


    49 posts

    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).


ExpressionEngine News

#eecms, #events, #releases