<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li Yue [学习笔记] &#187; dreamweaver</title>
	<atom:link href="http://www.liyue.org/tech/archives/tag/dreamweaver/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liyue.org/tech</link>
	<description>技术笔记</description>
	<lastBuildDate>Sun, 18 Jul 2010 02:14:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>为CMS系统制作dreamweaver模板插件</title>
		<link>http://www.liyue.org/tech/archives/17</link>
		<comments>http://www.liyue.org/tech/archives/17#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:06:23 +0000</pubDate>
		<dc:creator>李悦</dc:creator>
				<category><![CDATA[系统]]></category>
		<category><![CDATA[dreamweaver]]></category>

		<guid isPermaLink="false">http://www.liyue.org/tech/?p=17</guid>
		<description><![CDATA[　　CMS系统的在线模板编辑功能很弱，处理不好还会过滤掉有用的代码。一般来说，很少有人使用在线的模板编辑器，而是使用dreamweaver将模板做好，再将模板文件传到系统上去，或者是将源代码粘贴到模板编辑器中。在模板的可编辑区中，需要插入CMS系统相应的标记代码，便于系统识别执行。每个产品定义的标记方式不尽相同。　　Velocity模板引擎中，可以定义为${getTag-123}，这个就是标记。数字123是可编辑单元的编号，由CMS系统自动生成。在模板中经常要插入这样的标记，总是记不住怎么写这个标记，复制粘贴太不方便。在DREAMWEAVER中做个插件，输入编号插入上面的标记岂不方便。
　　可以参考dreamweaver自带的插件作为模板。
　　１、需要制作一个.mxi的xml类型文件。








Velocity模板插件，用于在模板中插入标记！
]]&#62;



作者主页：http://www.liyue.org
]]&#62;



]]&#62;
























２、按上面文件描述这个插件有两个按钮，标记数字编号和当前位置。下面就制作这两个按钮的执行文件。
　　（１）gettagname.htm:












标记数字编号:







　　（２）这个gettagname.htm调用了一个js脚本文件gettagname.js来处理用户的输入：

// Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved
//&#8212;&#8212;&#8212;&#8212;&#8212; GLOBAL VARIABLES &#8212;&#8212;&#8212;&#8212;&#8212;
var helpDoc = MM.HELP_objAnchor;
//&#8212;&#8212;&#8212;&#8212;&#8212; LOCAL FUNCTIONS &#8212;&#8212;&#8212;&#8212;&#8212;
function initUI() {
var curDOM = dw.getDocumentDOM(&#8216;document&#8217;);
if (curDOM &#038;&#038; (curDOM.getSelectedNode().nodeType == Node.TEXT_NODE)) {
var curSel = dw.getSelection();
document.theform.anchorname.value = curDOM.documentElement.outerHTML.slice(curSel[0],curSel[1]);
}
document.theform.anchorname.focus();
}
function errorCheck()
{
var theString = document.forms[0].anchorname.value;
if (theString.search(/W/) != -1)
{
alert(MM.MSG_InvalidName);
document.forms[0].anchorname.value = theString.replace(/W/g,&#8221;")
}
}
//&#8212;&#8212;&#8212;&#8212;&#8212; API FUNCTIONS &#8212;&#8212;&#8212;&#8212;&#8212;
function isDOMRequired() {
// Return false, indicating that this object [...]]]></description>
		<wfw:commentRss>http://www.liyue.org/tech/archives/17/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
