EllisLab text mark
Advanced Search
     
EE
Posted: 27 March 2012 09:36 AM
Joined: 2012-02-29
76 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?

 
Posted: 27 March 2012 09:57 AM   [ # 1 ]   [ Rating: 0 ]
Joined: 2012-02-29
76 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?

 
Posted: 27 March 2012 10:27 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-02-29
76 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

 
Posted: 27 March 2012 10:29 AM   [ # 3 ]   [ Rating: 0 ]
Joined: 2012-02-29
76 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!

 
Posted: 28 March 2012 09:57 AM   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-02-29
76 posts

Anyone?

Or does this need to be raised as a BUG?

 
Posted: 28 March 2012 03:58 PM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-24
2575 posts

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

 Signature 

Rob - http://www.blue-dreamer.co.uk/ - because I like blue!

 
Posted: 28 March 2012 05:05 PM   [ # 6 ]   [ Rating: 0 ]
Joined: 2012-02-29
76 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).


UKFreelancer.