Umbraco-自动将内容节点名称与文档类型属性同步



Am使用Umbraco 4.11.10

是否有一种标准的方法来创建文档类型属性,该属性在更新时会自动与内容节点名称同步?

我知道这可以在"名称"字段的"属性"部分中完成,但该字段不能从"属性"选项卡中移动,而且有点不方便——用户会感到困惑。

这通常是怎么做的?

机翼

有一些特殊用途的umbraco字段别名。一个是umbracoUrlName,它将覆盖页面url-只需将其添加到您的doctype中,并将其放在您想要更改url的任何选项卡中。

编辑

另一种选择是创建一个自定义数据类型,并使用它来创建一个覆盖节点名称的字段。添加一个文本字段作为自定义数据类型的UI;添加当文本框更改时激发的事件并更新名称。

http://our.umbraco.org/wiki/reference/api-cheatsheet/modifying-document-properties

// Get the document by its ID
Document doc = new Document(node.Id);
// Get the properties you wish to modify by it's alias and set their value
// the value is saved in the database instantly!
doc.getProperty("name").Value = <input textbox value?;
// After modifying the document, prepare it for publishing
User author = User.GetUser(0); 
doc.Publish(author);
// Tell umbraco to publish the document so the updated properties are visible on website
umbraco.library.UpdateDocumentCache(doc.Id);

最新更新