Creating custom datatypes using the umbraco usercontrol wrapper
本篇文章介绍的是基于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的更多相关文章
- 【IOS笔记】Creating Custom Content View Controllers
Creating Custom Content View Controllers 自定义内容视图控制器 Custom content view controllers are the heart of ...
- 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 ...
- 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 ...
- Collection View Programming Guide for iOS---(六)---Creating Custom Layouts
Creating Custom Layouts 创建自定义布局 Before you start building custom layouts, consider whether doing so ...
- View Controller Programming Guide for iOS---(四)---Creating Custom Content View Controllers
Creating Custom Content View Controllers 创建自定义内容视图控制器 Custom content view controllers are the heart ...
- 管理后台-第一部分:Creating custom sections in Umbraco 7 - Part 1(翻译文档)
在Umbraco上每个部分都可以被称为一个应用程序,所以这些部分和应用程序基本上是一样的.我们首先要做的事情是需要创建应用程序.在这个例子中,我不会去摆弄xml文件或是数据库——我将使用类来创建我的内 ...
- [TensorFlow] Creating Custom Estimators in TensorFlow
Welcome to Part 3 of a blog series that introduces TensorFlow Datasets and Estimators. Part 1 focuse ...
- 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 ...
- Creating Custom Login Screen In Oracle Forms 10g
Below is the example plsql unit to validate login credentials and after successful validation open a ...
随机推荐
- 网站seo优化--jsoup 批量分析相关网站 标签,描述,关键词.
网站seo优化--jsoup 批量分析相关网站 标签,描述,关键词. 因为自己写了一个磁力搜索网站Btgoogle,准备进行优化一下,需要分析其他的网站的优化情况. Java的Jsoup类库和PHP的 ...
- java中抽象类与接口的区别
1.abstract class 在 Java 语言中表示的是一种继承关系,一个类只能使用一次继承关系.但是,一个类却可以实现多个interface. 2.在abstract class 中可以有自己 ...
- C语言-07其它相关
预处理指令 /* 不带参数的宏定义 1.所有的预处理指令都是以#开头 2.预处理指令分3种 1> 宏定义 2> 条件编译 3> 文件包含 3.预处理指令在代码翻译成0和1之前执行 4 ...
- POJ 2252 Dungeon Master 三维水bfs
题目: http://poj.org/problem?id=2251 #include <stdio.h> #include <string.h> #include <q ...
- Aspose.Cells 导入导出EXCEL(转)
Aspose.Cells 导入导出EXCEL 修改样式 Workbook workbook = new Workbook(); //工作簿 Worksheet ...
- 分享七款视差滚动效果的jQuery 插件
视差(Parallax)是指从不同的点看一个物体时形成的视觉差异,这个名词是源自希腊文的παράλλαξις (parallaxis),意思是”改变”.在网页设计中,视差滚动(Parallax Scr ...
- Linux 下编译、安装、配置 QT
转自Linux 下编译.安装.配置 QT 注意:编译安装耗时费力,且很容易出错,要不断调整编译参数,不推荐使用,否则这将会是一个纠结痛苦的过程. 打算做嵌入式图像处理,计划方案嵌入式Linux+Ope ...
- 移动周报:十款最实用的Android UI设计工具
上一周可以说是一个不断Mark周,从最实用的Android UI设计工具.免费移动应用测试框架推荐,到HTML5开发框架等等,各种开发工具.框架精彩丰呈,看得小伙伴们是不亦乐乎.当然,还有不容错过的M ...
- JSON数据与JavaScript对象转换
使用JSON时,最基本的工作就是JSON数据与JavaScript对象之间的互相转换.如浏览器 从服务器端获得JSON数据,然后转换为JavaScript对象在网页输出. SON: JavaScrip ...
- 灰度图像--图像增强 直方图均衡化(Histogram equalization)
灰度图像--图像增强 直方图均衡化(Histogram equalization) 转载请标明本文出处:http://blog.csdn.net/tonyshengtan,欢迎大家转载,发现博客被某些 ...