{"id":4382,"date":"2014-03-05T14:38:47","date_gmt":"2014-03-05T06:38:47","guid":{"rendered":"http:\/\/wp.chunhsin.idv.tw\/?p=4382"},"modified":"2014-10-08T00:43:31","modified_gmt":"2014-10-07T16:43:31","slug":"tinymce%e7%9a%84template%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/wp.chunhsin.idv.tw\/?p=4382","title":{"rendered":"tinymce\u7684template\u529f\u80fd"},"content":{"rendered":"<p>\u641e\u4e86\u597d\u4e45\uff0c\u7d42\u65bc\u5f04\u61c2tiny_mce\u7684template\u529f\u80fd\u3002\u6b64\u529f\u80fd\u53ef\u5728\u7de8\u8f2f\u5668\u7684\u5de5\u5177\u5217\u627e\u5230\u300c\u4f7f\u7528\u7248\u578b\u300d\u958b\u555f\uff0c\u4f5c\u7528\u662f\u9078\u64c7\u9810\u5148\u8a2d\u5b9a\u7684html\u7d50\u69cb\u5230\u76ee\u524d\u7684\u7de8\u8f2f\u5340\u88e1\u3002\u6b64\u8a2d\u5b9a\u6211\u662f\u5728\u820a\u7248tinymce\u6e2c\u8a66\uff0c\u65b0\u7248\u61c9\u8a72\u4e5f\u53ef\u4ee5\u76f8\u5bb9\u624d\u5c0d\u3002\u5148\u4f86\u8aaa\u660e\u8a2d\u5b9a\u53ca\u5176\u904b\u4f5c\u65b9\u5f0f\u3002<\/p>\n<p><!--more--><\/p>\n<h4>#tiny_mce\u7684\u521d\u59cb\u8a2d\u5b9a<\/h4>\n<p style=\"padding-left: 30px;\">template_replace_values: {<\/p>\n<p style=\"padding-left: 60px;\">username : &#8220;Jack Black&#8221;,<\/p>\n<p style=\"padding-left: 60px;\">staffid : &#8220;991234&#8221;,<\/p>\n<p style=\"padding-left: 60px;\">mybb: function(e){<\/p>\n<p style=\"padding-left: 90px;\">e.innerHTML = &#8216;mybb&#8217;;<\/p>\n<p style=\"padding-left: 60px;\">}<\/p>\n<p style=\"padding-left: 30px;\">},<\/p>\n<p style=\"padding-left: 30px;\">template_templates : [<\/p>\n<p style=\"padding-left: 60px;\">{<\/p>\n<p style=\"padding-left: 90px;\">title: &#8220;Editor Details&#8221;,<\/p>\n<p style=\"padding-left: 90px;\">src: &#8220;templates\/editor_details.htm&#8221;,<\/p>\n<p style=\"padding-left: 90px;\">description: &#8220;Adds Editor Name and Staff ID&#8221;<\/p>\n<p style=\"padding-left: 60px;\">},<\/p>\n<p style=\"padding-left: 60px;\">{<\/p>\n<p style=\"padding-left: 90px;\">title: &#8220;Timestamp&#8221;,<\/p>\n<p style=\"padding-left: 90px;\">src: &#8220;templates\/time.htm&#8221;,<\/p>\n<p style=\"padding-left: 90px;\">description: &#8220;Adds an editing timestamp.&#8221;<\/p>\n<p style=\"padding-left: 60px;\">}<\/p>\n<p style=\"padding-left: 30px;\">]<\/p>\n<h4>#templates\/time.htm<\/h4>\n<p style=\"padding-left: 30px;\">&lt;div class=&#8221;mceTmpl&#8221;&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;table width=&#8221;98%&#8221; border=&#8221;0&#8243; cellspacing=&#8221;0&#8243; cellpadding=&#8221;0&#8243;&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;tr&gt;<\/p>\n<p style=\"padding-left: 90px;\">&lt;th scope=&#8221;col&#8221;&gt;sfasdf &lt;\/th&gt;<\/p>\n<p style=\"padding-left: 90px;\">&lt;th scope=&#8221;col&#8221;&gt; asdfasdf&lt;\/th&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;\/tr&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;tr&gt;<\/p>\n<p style=\"padding-left: 90px;\">&lt;td&gt; fadf&lt;\/td&gt;<\/p>\n<p style=\"padding-left: 90px;\">&lt;td&gt; asdfas&lt;\/td&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;\/tr&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;\/table&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;div class=&#8221;username&#8221;&gt;{$username}&lt;\/div&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;div class=&#8221;staffid&#8221;&gt;{$staffid}&lt;\/div&gt;<\/p>\n<p style=\"padding-left: 60px;\">&lt;div class=&#8221;mybb&#8221;&gt;&lt;\/div&gt;<\/p>\n<p style=\"padding-left: 30px;\">&lt;\/div&gt;<\/p>\n<p>\u8acb\u5148\u5c07#tiny_mce\u5340\u584a\u7684\u521d\u59cb\u8a2d\u5b9a\u52a0\u5230tiny_mce\u7684\u8a2d\u5b9a\u6a94\u88e1\uff0c\u5176\u4e2dtemplate_replace_values\u9805\u76ee\u70ba\u7684\u662f\u5c07\u6a23\u7248\u63d2\u5165\u7de8\u8f2f\u5668\u524d\u9032\u884c\u5167\u5bb9\u7684\u53d6\u4ee3\uff0c\u5176key\u503c\u662f\u6307\u8b8a\u6578\u540d\u7a31\u6216classname\uff0c\u5167\u5bb9\u5247\u53ef\u4ee5\u6307\u5b9a\u5b57\u4e32\u53ca\u51fd\u6578\uff0c\u82e5\u662f\u6307\u5b9a\u5b57\u4e32\u5167\u5bb9\uff0c\u4ee3\u8868\u8981\u53d6\u4ee3\u6a23\u7248\u88e1\u7684\u8b8a\u6578(\u8b8a\u6578\u540d\u7a31\u662f\u5c0d\u61c9\u7684key\u503c)\uff0c\u9700\u5728\u6a23\u7248\u88e1\u5d4c\u5165\u6a23\u7248\u8b8a\u6578\uff0c\u5982\u6b64\u683c\u5f0f:{$var}\uff0c\u8acb\u53c3\u8003#templates\/time.htm\u88e1\u7684{$username}\u3002<br \/>\n\u53e6\u5916\uff0c\u82e5\u662f\u6307\u5b9a\u70ba\u51fd\u6578\uff0c\u5247\u4ee3\u8868\u8981\u627e\u5230\u9078\u64c7\u6a23\u7248\u88e1classname\u8207key\u503c\u76f8\u540c\u7684dom\u7269\u4ef6\uff0c\u51fd\u6578\u50b3\u5165\u7684\u53c3\u6578\u5373\u662f\u6b64\u7269\u4ef6\u7684\u53c3\u8003\uff0c\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\uff0c\u4f8b\u5982\u6307\u5b9a\u503c\u7d66\u5176\u5c6c\u6027innerHTML\uff0c\u53ef\u4ee5\u9019\u500b\u90e8\u4efd\u53ef\u4ee5\u505a\u66f4\u5f48\u6027\u7684\u52d5\u4f5c\u3002<\/p>\n<p>template_templates\u662f\u8a2d\u5b9a\u6a23\u7248\u6a94\u6848\u7684\u8aaa\u660e\u53ca\u4f4d\u7f6e\u3002title\u53cadescription\u6703\u5728\u9078\u64c7\u7684\u6642\u5019\u986f\u793a\u3002\u6a94\u6848\u8def\u5f91\u5247\u662f\u6307\u6a23\u7248\u5b58\u5728\u7684\u4f4d\u7f6e\uff0c\u5982\u679c\u8a2d\u6210\u76f8\u5c0d\u4f4d\u7f6e\uff0c\u5247\u8d77\u59cb\u4f4d\u7f6e\u6703\u662f\u7de8\u8f2f\u5668\u57f7\u884c\u6642\u7684\u8def\u5f91\u3002<\/p>\n<p>\u6a23\u7248\u6a94\u6848\u88e1\u7684\u7d50\u69cb\u6709\u4e00\u4e9b\u602a\u7570\u7684\u73fe\u8c61\uff0c\u4f8b\u5982\u5982\u679c\u4f7f\u7528\u4e0b\u8ff0div\u4f86\u5305\u5167\u5bb9\uff0c<br \/>\n&lt;div class=&#8221;mceTmpl&#8221;&gt;&lt;\/div&gt;<br \/>\ndiv\u5916\u4e0d\u80fd\u5305\u542b\u5176\u4ed6\u5167\u5bb9\uff0c\u5373\u4fbf\u6709\u4e5f\u6703\u4e0d\u898b\u3002\u597d\u50cf\u662f\u6703\u5224\u65b7classname\u662f\u4e0d\u662fmceTmpl\u3002<br \/>\n\u53e6\u5916\u9084\u6709\u66f4\u591a\u8a2d\u5b9a\u9805\u76ee\uff0c\u8acb\u898b:<a href=\"http:\/\/www.tinymce.com\/wiki.php\/plugin:template\" target=\"_blank\">http:\/\/www.tinymce.com\/wiki.php\/plugin:template<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u641e\u4e86\u597d\u4e45\uff0c\u7d42\u65bc\u5f04\u61c2tiny_mce\u7684template\u529f\u80fd\u3002\u6b64\u529f\u80fd\u53ef\u5728\u7de8\u8f2f\u5668\u7684\u5de5\u5177\u5217\u627e\u5230\u300c\u4f7f\u7528\u7248\u578b\u300d\u958b\u555f\uff0c\u4f5c\u7528\u662f &hellip; <a href=\"https:\/\/wp.chunhsin.idv.tw\/?p=4382\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008tinymce\u7684template\u529f\u80fd\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,13],"tags":[336],"class_list":["post-4382","post","type-post","status-publish","format-standard","hentry","category-javascript","category-software-knowhow","tag-tinymce"],"_links":{"self":[{"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4382"}],"version-history":[{"count":3,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4382\/revisions"}],"predecessor-version":[{"id":4405,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/4382\/revisions\/4405"}],"wp:attachment":[{"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.chunhsin.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}