I have more than 1000 nodes with the template "firstTemplate". But now, I'd like to change the template for another one "anotherTemplate". I changed the default template for the docyType and each new node as "anotherTemplate" as default template, but the existing ones are still publish with "firstTemplate".
Do I have to manually change et save&publish each existing nodes to get them use "anotherTemplate"?
you could create a dashboard, and do it programatically...
Something like... with a couple of controls on the dashboard to pick the parent page of your nodes to update, and whether they should be published or not.
Document doc = new Document(Convert.ToInt32(SimpleContentPicker1.Value));
if (doc.HasChildren)
{
//you need to do this because doc.Children is an array. If you directly use it
//in the foreach it'll execute the Array call each time (and it is a very
//database heavy operation). Alternatively there is a AsList method which
//is better too
Document[] children = doc.Children;
foreach (Document dChild in children)
{
d.Template = umbraco.cms.businesslogic.template.Template.GetTemplateIdFromAlias("YOURNEWTEMPLATE");
d.Save();
//if checked, publish document node
if (cbxPublish.Checked)
{
// if we were already publish publish us... if not don't
if (d.Published)
{
//create/publish new version
d.Publish(umbraco.BusinessLogic.User.GetCurrent());
//umbraco.library.PublishSingleNode(d.Id);
umbraco.library.UpdateDocumentCache(d.Id);
}
else
{
d.Published = false;
d.Save();
}
}
else
{
//only save the changes
d.Published = false;
d.Save();
}
}
}
There are quite a few "omissions" in terms of bulk updates... you can't select to move files on mass... or delete selectively on mass... no inbuilt search and replace across your entire site...
But the beauty of umbraco is that it's so easy to extend to whatever you want it to do ;-) in many other cms's you'd be stuck with no it doesn't do that...
Hi Mike, can you help me just a little more? So, I changed my dashboard file to include a new tab in developper section and it must call profiterole.ascx... but what should I do next? I never developped for Umbraco, in fact, I always relied on html only...
if I get chance... I'll put something together.. I think there is a quick solution to drop the cs file in the app_data folder, so that it compiles on the fly rather than having to install visual studio and all that understanding that entails..
Simple SQL for changing a template within a particular node.
Update cmsDocument
Set cmsDocument.templateId = 2687
FROM cmsContentXml INNER JOIN
cmsContent ON cmsContentXml.nodeId = cmsContent.nodeId INNER JOIN
cmsDocument ON cmsContent.nodeId = cmsDocument.nodeId
WHERE (cmsContentXml.xml LIKE '%path="-1,1537,2696,2754%')
and cmsDocument.templateId = 2689
Change template for more than 1000 nodes
Hi,
I have more than 1000 nodes with the template "firstTemplate". But now, I'd like to change the template for another one "anotherTemplate". I changed the default template for the docyType and each new node as "anotherTemplate" as default template, but the existing ones are still publish with "firstTemplate".
Do I have to manually change et save&publish each existing nodes to get them use "anotherTemplate"?
you could create a dashboard, and do it programatically...
Something like... with a couple of controls on the dashboard to pick the parent page of your nodes to update, and whether they should be published or not.
Thank you, I'll try this. But I would have liked "built-in" solution!
There are quite a few "omissions" in terms of bulk updates... you can't select to move files on mass... or delete selectively on mass... no inbuilt search and replace across your entire site...
But the beauty of umbraco is that it's so easy to extend to whatever you want it to do ;-) in many other cms's you'd be stuck with no it doesn't do that...
Hi Mike, can you help me just a little more? So, I changed my dashboard file to include a new tab in developper section and it must call profiterole.ascx... but what should I do next? I never developped for Umbraco, in fact, I always relied on html only...
Hi Mike, finaly, I read a little about the subject and I will quit! It's too much for me. I'll think another way. But thank you!
if I get chance... I'll put something together.. I think there is a quick solution to drop the cs file in the app_data folder, so that it compiles on the fly rather than having to install visual studio and all that understanding that entails..
@Mike you can mass delete using the Content maintenance dashboard package.http://our.umbraco.org/projects/developer-tools/content-maintenance-dashboard-package Other mass options will be added to the V5 version of the package.
Simple SQL for changing a template within a particular node.
Oh completely forgot to update this post. But Bulkmanager is released. Assign templates is one of the bulk actions.
http://soetemansoftware.nl/bulkmanager
is working on a reply...