本篇文章介绍的是基于UmbracoCMS技术搭建的网站所使用的相关技术。

1.      需求

Umbraco CMS的dataType中有richTexhEditor控件,但是它不是太完善,比如没有对字体进行大小颜色等设置,所以需要对此控件进行替换,用一个功能更加完善一些的控件,从网上找到了一个第三方控件叫fckEditor,就是文本编辑器。

2.      添加步骤

1.            首先创建一个usercontrol,代码如下:

RichTextEditorControl.ascx

<%@ ControlLanguage="C#" AutoEventWireup="true"CodeFile="RichTextEditorControl.ascx.cs"

Inherits="UserControls_RichTextEditorControl" %>

<%@ RegisterAssembly="CKEditor.NET" Namespace="CKEditor.NET"TagPrefix="CKEditor" %>

<CKEditor:CKEditorControlID="CKEditor1" BasePath="~/ckeditor"runat="server" Height="450"

Width="590"></CKEditor:CKEditorControl>

RichTextEditorControl.ascx.cs

using System;

usingSystem.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

usingSystem.Web.UI.WebControls;

public partial classUserControls_RichTextEditorControl :System.Web.UI.UserControl,umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor

{

public string m_UmbracoValue;

protected void Page_Load(object sender,EventArgs e)

{

if (Page.IsPostBack)

{

m_UmbracoValue = CKEditor1.Text;

}

CKEditor1.Text = m_UmbracoValue;

//设置fckEditor的工具栏选项

CKEditor1.config.toolbar = new object[]

{

new object[] {"Source", "-", "NewPage", "Preview","-", "Templates" },

new object[] {"Cut", "Copy", "Paste", "PasteText","PasteFromWord"},

new object[] {"Undo", "Redo", "-", "Find", "Replace","-", "SelectAll", "RemoveFormat" },

"/",

new object[] {"NumberedList", "BulletedList", "-","Outdent", "Indent", "Blockquote"},

new object[] {"JustifyLeft", "JustifyCenter", "JustifyRight","JustifyBlock" },

new object[] {"Link", "Unlink", "Anchor" },

new object[] {"Image", "Table", "HorizontalRule","SpecialChar", "PageBreak", "Iframe" },

"/",

new object[] {"Bold", "Italic", "Underline"},

new object[] {"Styles", "Format", "Font", "FontSize"},

new object[] {"TextColor", "BGColor" }

};

}

public object value

{

get

{

returnm_UmbracoValue;

}

set

{

m_UmbracoValue = value.ToString();

}

}

}

2.            Xslt代码:

登录Umbraco后台选择Develeoper页签,创建一个DataType。

然后在renderControl中选择umbraco usercontrol wrapper并保存。

然后可以看到usercontrol的选择框,即选择我们创建的usercontrol即可。

到此为止我们就创建成功一个datatype,在Settings也页签中的Document type中就可以选择该DataType了。

Creating custom datatypes using the umbraco usercontrol wrapper的更多相关文章

  1. 【IOS笔记】Creating Custom Content View Controllers

    Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of ...

  2. ASP.NET MVC- VIEW Creating Custom HTML Helpers Part 2

    The goal of this tutorial is to demonstrate how you can create custom HTML Helpers     that you can ...

  3. Extending JMeter – Creating Custom Config Element – Property File Reader

    JMeter is one of the best open source tools in the Test Automation Community. It comes with all the ...

  4. Collection View Programming Guide for iOS---(六)---Creating Custom Layouts

    Creating Custom Layouts 创建自定义布局 Before you start building custom layouts, consider whether doing so ...

  5. View Controller Programming Guide for iOS---(四)---Creating Custom Content View Controllers

    Creating Custom Content View Controllers 创建自定义内容视图控制器 Custom content view controllers are the heart ...

  6. 管理后台-第一部分:Creating custom sections in Umbraco 7 - Part 1(翻译文档)

    在Umbraco上每个部分都可以被称为一个应用程序,所以这些部分和应用程序基本上是一样的.我们首先要做的事情是需要创建应用程序.在这个例子中,我不会去摆弄xml文件或是数据库——我将使用类来创建我的内 ...

  7. [TensorFlow] Creating Custom Estimators in TensorFlow

    Welcome to Part 3 of a blog series that introduces TensorFlow Datasets and Estimators. Part 1 focuse ...

  8. Creating Custom Connector Sending Claims with SharePoint 2013

    from:http://blogs.msdn.com/b/security_trimming_in_sharepoint_2013/archive/2012/10/29/creating-custom ...

  9. Creating Custom Login Screen In Oracle Forms 10g

    Below is the example plsql unit to validate login credentials and after successful validation open a ...

随机推荐

  1. 普及下Oracle hints语法

    普及下Oracle hints的语法:{DELETE|INSERT|SELECT|UPDATE} /*+ hint [text] [hint[text]]... */ 1.hint只能出现在诸如sel ...

  2. JS代码判断IE6,IE7,IE8,IE9的函数代码

    JS代码判断浏览器版本,支持IE6,IE7,IE8,IE9!做网页有时候会用到JS检测IE的版本,下面是检测Microsoft Internet Explorer版本的三种代码 做网页有时候会用到JS ...

  3. 解决iOS应用内购买报错:invalidProductIdentifiers

    当写完IAP业务过程后,点击测试却发现没有返回成功的商品Id,反而返回了无效的商品:response.invalidProductIdentifiers 这种情况下考虑以下因素: 创建的App ID是 ...

  4. NCPC 2012 Galactic Warlords

    湖南大学的oj上有这套比赛: 这题是个简单的计算几何,首先去掉重复的边,然后判断是否全部平行: 代码: #include<cstdio> #define maxn 105 using na ...

  5. myeclipse启动报“java was started but returned exit code=13”

    在win8系统中的myeclipse拷贝到win7系统中后,解压缩打开提示"java was started but returned exit code=13", 可能是myec ...

  6. Spring中的事务管理详解

    在这里主要介绍Spring对事务管理的一些理论知识,实战方面参考上一篇博文: http://www.cnblogs.com/longshiyVip/p/5061547.html 1. 事务简介: 事务 ...

  7. 李洪强漫谈iOS开发[C语言-026]-符合赋值表达式

  8. 《鸟哥的Linux私房菜》读书笔记四

    1.Linux的目录配置以『树状目录』来配置,至於磁碟分割槽(partition)则需要与树状目录相配合! 请问,在预设的情况下,在安装的时候系统会要求你一定要分割出来的两个Partition为何? ...

  9. 检查并创建目录mkdir

    os.listdir() os.path.isdir() os.path.join() os.mkdir() # -*- coding:utf-8 -*- import os,sys def mkdi ...

  10. Apache Struts 安全措施绕过漏洞(CVE-2013-4310)

    漏洞版本: Apache Group Struts < 2.3.15.2 漏洞描述: BUGTRAQ ID: 62584 CVE(CAN) ID: CVE-2013-4310 Struts2 是 ...