Hello,
I’m trying to create a transport package for a template.
So far, so good, installation has gone well, all directories, templates and TV’s are being installed but i’m stuck when i want to associate the TV’s to the template.
Can somebody give me a hint on how to achieve that?
My code:
<?php
/* create category */
$category= $modx->newObject('modCategory');
$category->set('id',1);
$category->set('category','My template');
/* create the templates */
$template= $modx->newObject('modTemplate');
$template->set('id',0);
$template->set('templatename', 'My template name');
$template->set('description', 'Cool description');
$template->set('content',file_get_contents($sources['source_tpl'].'/tpl.html'));
/* create the Template variable */
$tvContent = $modx->newObject('modTemplateVar');
$tvContent->set('id',0);
$tvContent->set('type','option');
$tvContent->set('name','content');
$tvContent->set('caption','Principal content');
$tvContent->set('elements','Normal content==Normal||Subnav content==Subnav');
$tvContent->set('display','delim');
$tvContent->set('display_params','&delimiter=||');
$tvContent->set('default_text','Normal');
$category->addMany($tvContent);
$category->addMany($template);
//This is where i'm stuck - I Don't know how to associate the tv to the template