$templates


Template Methods

$template->save()

Introduced in Version 2.0

Description

Save this template to the database.

In this example we create and save a new template. Each template has an associated fieldgroup so we must also create this.

//create a new field group for the new template we are creating
$fg = new Fieldgroup();
$fg->name = "skyscraper";

//add some fields to the fieldgroup
$fg->add("title");
$fg->add("architects");
$fg->add("height");
$fg->add("floors");
$fg->save();

$t = new Template();
$t->name = "skyscraper";
$t->fieldgroup = $fg; //associate the template with its fieldgroup
$t->save();

Related

Post Comment