<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>宇都宮ウエブ制作所 &#187; DreamWeaver</title>
	<atom:link href="http://utweb.jp/blog/archives/tag/dreamweaver/feed" rel="self" type="application/rss+xml" />
	<link>http://utweb.jp/blog</link>
	<description>宇都宮さんっていう、夫婦でやってるウエブサイト制作請負の大阪下町家内製手工業業務日誌</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:35:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/tag/dreamweaver/feed" />
		<item>
		<title>zen-codingにswfobjectなど微妙によく使うものを追加する</title>
		<link>http://utweb.jp/blog/archives/671</link>
		<comments>http://utweb.jp/blog/archives/671#comments</comments>
		<pubDate>Sat, 13 Mar 2010 05:42:07 +0000</pubDate>
		<dc:creator>正宗</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[DreamWeaver]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[swfobject]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[zen-coding]]></category>
		<category><![CDATA[まとめ]]></category>
		<category><![CDATA[便利]]></category>
		<category><![CDATA[覚書]]></category>

		<guid isPermaLink="false">http://utweb.jp/blog/?p=671</guid>
		<description><![CDATA[楽しいですね！zen-coding。
html:4t>(div#header>h1+ul.globalNavigation>li.navi$*6>a)+(div#content>div#main+div#sub)+(di [...]]]></description>
			<content:encoded><![CDATA[<p>楽しいですね！<a href="http://code.google.com/p/zen-coding/" target="_blank">zen-coding</a>。</p>
<pre>html:4t>(div#header>h1+ul.globalNavigation>li.navi$*6>a)+(div#content>div#main+div#sub)+(div#footer>ul.globalNavigation>li.navi$*6>a)</pre>
<p>こんなんが一行で書けてしまうので、ついつい仕事の本分を忘れて「いかにzen-codingで済ますか」ばかり興味が行っちゃって、大量にある面倒臭いコーディングもパズルを解くかのように楽しみながら作業できちゃいます。</p>
<p>せっかくなのでコーディングしてたら絶対出てくる他のいろいろと面倒なコードもzen-codingにまかせられないか、その方法を探って参りました。<br />
<span id="more-671"></span><br />
今や説明の必要もないくらい、Flashを埋め込む際に定番となったSWFObject。<br />
よく使うんだけど書き方を微妙に覚えて無くて、毎回どっかのサイトや過去の案件からコピペしてきてファイル名やサイズなんかを書き直してる、って方も多いと思います。<br />
せっかくzen-codingを使うのだから、</p>
<pre>swfobject</pre>
<p>と書けば一発でSWFObjectの記述を書き出すようにしたらいいですね！</p>
<p>参考にしたのはこちらのページ<br />
<a href="http://designblog.ecstudio.jp/htmlcss/my-zen-coding.html" target="_blank">Zen-Codingでさらにコーディングを1.5倍くらい速くするためのカスタマイズ方法</a><br />
もはや説明の必要もないくらいリンク先のページで非常にわかりやすく丁寧に解説されているので、これに習ってzen-codingにswdobjectの記述を追加するようカスタマイズしていきましょう。</p>
<h3>zen_setting.jsを探す</h3>
<p>僕の場合はWindowsVistaのDreamWeaverにzen-codingをインストールしましたので<br />
C:\Users\＜Windowsのユーザー名＞\AppData\Roaming\Adobe\Dreamweaver CS4\ja_JP\Configuration\Commands\ZenCoding<br />
ここに<strong>zen_setting.js</strong>はありました。<br />
Macだと<br />
/Users/＜Macのユーザー名＞/Library/Application Support/Adobe/Dreamweaver CS4/ja_JP/Configuration/Commands/ZenCodingです。<br />
環境によって違うと思いますのでまずは<strong>zen_setting.js</strong>を見つけて下さい。</p>
<h3>書き足す</h3>
<p>ファイル名を見てわかるように、中身はjavascriptになっています。<br />
javascriptになじみのある方は、もうこの時点で書き足す方法もわかったのではないでしょうか。<br />
このファイルの中身はzen_settingsというオブジェクトの固まりが書かれてあります。<br />
javascriptが苦手な方はこの時点で頭が痛いかも知れませんが、最後にコピペだけでカスタマイズできるようにしておきましたんで、もう少しおつきあい下さいね。</p>
<p>ほいで、このzen_settingsというオブジェクトの固まりをざーっと読んでいくと、どうやらその中にはsccとかhtmlっていうこれまた固まりがあって、さらにその中がsnippetsとかabbreviationsとかいう名前の固まりが入っている、みたいな形になっています。<br />
ちなみに<strong>zen_setting.js</strong>の3行目を読むと、このコードを書いた人の名前はセルゲイさんのようです。ハラショー！セルゲイ！！</p>
<p>なので、この<strong>zen_setting.js</strong>の最後の最後にこういう形で追加してやればいいです。<br />
最後の最後というのは、700何十行目かに</p>
<pre class="javascript"><span style="color: #66cc66;">&#125;</span>;</pre>
<p>で終わってると思うんですが、その後に改行とかして新しく追加していけばいいってことです。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">swfobject</span> =	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js&quot;&gt;&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'(function(){<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfDirectory = &quot;./swf/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfFileName = &quot;index.swf&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var targetId = &quot;flashcontent&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var width = &quot;600&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var height = &quot;400&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var version = &quot;9.0.0&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var flashvars = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	flashvars.varsDirectory = &quot;/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var params = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.menu = &quot;false&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.quality = &quot;best&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.scale = &quot;noscale&quot;;//showAll<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.salign = &quot;tl&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	//params.wmode = &quot;opaque&quot;;//transparent<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.swliveconnect = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowfullscreen = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowscriptaccess = &quot;always&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allownetworking = &quot;all&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var attributes = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.id = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.name = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.align = &quot;middle&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	swfobject.embedSWF(swfDirectory+swfFileName, targetId, width, height, version, swfDirectory+&quot;expressInstall.swf&quot;, flashvars, params, attributes);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'})();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</pre>
<p>僕が参考にしたリンク先では、最終的にmy_zen_setting.jsという独自ファイルで管理する前提のためファイルの途中の行に書き足していっていましたが、どっちが良い悪いというわけでもないですが僕の場合は<strong>zen_setting.js</strong>ファイルを直接触る前提のため、後から書き足していったところがわかりやすいので最後に書き足す方法をとりました。つまりもともとあったコードの中間には一切手を加えず、とにかく追加していくやり方ですね。</p>
<p>これでHTMLファイル上で</p>
<pre>swfobject</pre>
<p>と書いて最後尾でCtrl+,（コントロール＋カンマ）すればSWFObjectのややこしい記述が一発でずらずらと出てきます！WOOO！！</p>
<h3>せっかくなので他にも追加してみる</h3>
<p>GoogleAnalyticsのコードなんかも追加してみましょう。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">googleanalytics</span> = 	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'document.write(unescape(&quot;%3Cscript src=<span style="color: #000099; font-weight: bold;">\'</span>&quot; + gaJsHost + &quot;google-analytics.com/ga.js<span style="color: #000099; font-weight: bold;">\'</span> type=<span style="color: #000099; font-weight: bold;">\'</span>text/javascript<span style="color: #000099; font-weight: bold;">\'</span>%3E%3C/script%3E&quot;));<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'try{<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var pageTracker = _gat._getTracker(&quot;UA-|xxxxxx-x&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'pageTracker._trackPageview();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'} catch(err) {}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</pre>
<p>CSSのclearfixのコードなんかも<br />
<a href="http://www.yomotsu.net/wp/?p=561" target="_blank">いまどき ? いまさら ? clear fix のコード</a><br />
こちらを参考に書いてみました。</p>
<pre class="javascript">zen_settings.<span style="color: #006600;">css</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">clearfix</span> =	<span style="color: #3366CC;">&quot;.clearfix { /zoom : 1; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> +
					<span style="color: #3366CC;">&quot;.clearfix:after { content: ''; display: block; clear: both; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span></pre>
<p>書き方のコツがわかったら、ほかにもどんどんと自分好みのzen-codingができそうです。</p>
<h3>コードをまとめてみた</h3>
<p>今回紹介した3つの追加項目をまとめときました。</p>
<pre class="javascript"><span style="color: #009900; font-style: italic;">/**
 *	added 2010/03/13
 *	http://utweb.jp/
 *	Masamune Utsunomiya
 **/</span>
zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">swfobject</span> =	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject_src.js&quot;&gt;&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'(function(){<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfDirectory = &quot;./swf/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var swfFileName = &quot;index.swf&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var targetId = &quot;flashcontent&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var width = &quot;600&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var height = &quot;400&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var version = &quot;9.0.0&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var flashvars = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	flashvars.varsDirectory = &quot;/&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var params = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.menu = &quot;false&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.quality = &quot;best&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.scale = &quot;noscale&quot;;//showAll<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.salign = &quot;tl&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	//params.wmode = &quot;opaque&quot;;//transparent<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.swliveconnect = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowfullscreen = &quot;true&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allowscriptaccess = &quot;always&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	params.allownetworking = &quot;all&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	var attributes = {};<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.id = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.name = &quot;swfID&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	attributes.align = &quot;middle&quot;;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'	swfobject.embedSWF(swfDirectory+swfFileName, targetId, width, height, version, swfDirectory+&quot;expressInstall.swf&quot;, flashvars, params, attributes);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'})();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
					<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;
zen_settings.<span style="color: #006600;">html</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">googleanalytics</span> = 	<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'document.write(unescape(&quot;%3Cscript src=<span style="color: #000099; font-weight: bold;">\'</span>&quot; + gaJsHost + &quot;google-analytics.com/ga.js<span style="color: #000099; font-weight: bold;">\'</span> type=<span style="color: #000099; font-weight: bold;">\'</span>text/javascript<span style="color: #000099; font-weight: bold;">\'</span>%3E%3C/script%3E&quot;));<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;script type=&quot;text/javascript&quot;&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'try{<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'var pageTracker = _gat._getTracker(&quot;UA-|xxxxxx-x&quot;);<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'pageTracker._trackPageview();<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'} catch(err) {}<span style="color: #000099; font-weight: bold;">\n</span>'</span> +
						<span style="color: #3366CC;">'&lt;/script&gt;<span style="color: #000099; font-weight: bold;">\n</span>'</span>;
zen_settings.<span style="color: #006600;">css</span>.<span style="color: #006600;">snippets</span>.<span style="color: #006600;">clearfix</span> =	<span style="color: #3366CC;">&quot;.clearfix { /zoom : 1; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> +
					<span style="color: #3366CC;">&quot;.clearfix:after { content: ''; display: block; clear: both; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span></pre>
<p>ようはいままでの記事ぜんぶすっ飛ばして読んでない人も、このコードをまるごとコピーして<strong>zen_setting.js</strong>の最後に貼り付けておけばいいって事です！</p>
<p>みなさんも「こんなのもスニペットにしてみたよ」ってのがあれば是非おしえてくださいませ。<br />
では良いzen-codingを！ハラショー！</p>
]]></content:encoded>
			<wfw:commentRss>http://utweb.jp/blog/archives/671/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/671" />
	</item>
		<item>
		<title>DreamWeaverテンプレート機能のオプション領域などでグローバルナビゲーションを便利にする</title>
		<link>http://utweb.jp/blog/archives/585</link>
		<comments>http://utweb.jp/blog/archives/585#comments</comments>
		<pubDate>Mon, 25 Jan 2010 17:13:14 +0000</pubDate>
		<dc:creator>正宗</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[DreamWeaver]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[便利]]></category>
		<category><![CDATA[制作]]></category>

		<guid isPermaLink="false">http://utweb.jp/blog/?p=585</guid>
		<description><![CDATA[年末進行のせいにして年賀状も書いてない男。正宗です。さっきやっと寒中見舞いが刷り上がりました。
DreamWeaverのテンプレート機能。便利ですよね。うまくつかうとライブラリ機能と組み合わせる事によって大規模なサイト制 [...]]]></description>
			<content:encoded><![CDATA[<p>年末進行のせいにして年賀状も書いてない男。正宗です。さっきやっと寒中見舞いが刷り上がりました。</p>
<p>DreamWeaverのテンプレート機能。便利ですよね。うまくつかうとライブラリ機能と組み合わせる事によって大規模なサイト制作におけるケアレスミスを大幅に減らすことが出来ます。<br />
今回はそのテンプレート機能でグローバルメニューをどう作ろうか考えたので、現時点で見つけた一番スマートではないかと思えるやり方を紹介したいと思います。</p>
<p><span id="more-585"></span></p>
<p>まずは僕が一生懸命作ったDreamWeaverのテンプレートを見て下さい。</p>
<pre class="xml"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;doctitle&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span>=<span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/css/import.css&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;head&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;page&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;header&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;h1<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/h1<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ul</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;globalNavigation&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/ul<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contents&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;maincontents&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ここにコンテンツが入ります。</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;footer&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">コピーライト</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/html<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li></ol></pre>
<p>こうしたテンプレートを作っておく場合、例えば「/profile/」以下のファイルには全部</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;self&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>こんな感じで他のリストとは違ったクラス名を付けたくなるかもしれません。</p>
<p>また、/profile/index.htmlページは、メニューからプロフィールのリンクを押しても自身のページに飛ぶだけなのでアンカーを付けたくない、などといったようにページによってメニューが細かく変化する場合が出てきます。</p>
<p>グローバルメニューは編集可能領域にしてしまうとか、それだとテンプレート機能の便利さがスポイルされてしまうのでライブラリと組み合わせて運用するとか、いろいろ試してみたんですがどれも一長一短あって困っていましたが、面白いものを見つけました。</p>
<p>それが「<strong>編集可能オプション領域</strong>」と「<strong>オプション領域</strong>」です。<br />
それぞれテンプレート編集画面から「挿入」→「テンプレートオブジェクト」から挿入できます。<br />
普段よく使う「編集可能領域」と一緒の場所にあるので、これは何なのか不思議に思った方も多いと思います。<br />
ところがこれ、実際に使ってみようと思っても、変な画面が出るだけでナニが何やらわけがわからないんですよね。</p>
<p>じつはこれ、JavaScriptの書式でテンプレートを動的に変化させることができるものみたいなんです。</p>
<h3>編集可能オプション領域</h3>
<p>まずは「編集可能オプション領域」の説明から。</p>
<pre class="xml"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;doctitle&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span>=<span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/css/import.css&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;head&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;profile_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;gallery_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;contact_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;link_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;page&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;header&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;h1<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/h1<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ul</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;globalNavigation&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(profile_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(gallery_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(contact_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(link_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/ul<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contents&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateBeginEditable name=&quot;maincontents&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ここにコンテンツが入ります。</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;footer&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">コピーライト</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/html<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li></ol></pre>
<p>ややこしい記述が増えてきたので順番に見て行きます。<br />
先ずは１３行目〜１６行目</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;profile_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;gallery_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;contact_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;link_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
&nbsp;</pre>
<p>これはDreamWeaverのテンプレート用の記述方式で、例えば１３行目はprofile_classという変数の中に"menu"という値がセットすることを意味します。１４行目、１５行目、１６行目も全く同じで、それぞれgallery_class、contact_class、link_classという変数に"menu"という値をセットしています。<br />
そんな変数なんて変なものセットしてどこで使うんだYO!!と思いたいところですが、次に２４行目〜２７行目を見てみます。</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(profile_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(gallery_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(contact_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(link_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>「class="@@(profile_class)@@"」なんていうオットロシイ文字が出てきましたが、落ち着いてみるとこれ、ただのli タグに追加されたクラス属性です。</p>
<p>class="何々”の中がちょっと変わった書き方になってるので複雑に見えますが、<br />
@@(　　　)@@の中はさっき１３行目〜１６行目で設定した変数が入っています。<br />
先ほどセットした変数をここで実際につかっている、というイメージですね。</p>
<p>テンプレートをこのようにしておくと、このテンプレートからページを作った時に</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>こんな感じで作成してくれる、っていうのが「編集可能オプション領域」になります。</p>
<p>ここから当初の目的である「どうやってページごとの特定のメニューだけクラス名を変えるのか？」を実際に試してみます。</p>
<p>テンプレート機能を使おうという記事なので、ここまで読んでる方はその前段階である、DreamWeaverのサイト定義はもう済ませてあると前提で進めて行きます。<br />
サイト定義がよくわからない場合は「DreamWeaver サイト定義」などの語句でヘルプやWEB上の情報を検索してみて下さい。</p>
<p>ファイルの新規作成で「test.html」などのHTMLファイルを作成して開いておいて、メニューの「修正」→「テンプレート」→「テンプレートをページに適用」でHTMLファイルをテンプレートと関連づけます。<br />
<a href="http://utweb.jp/blog/wp-content/uploads/2010/01/427feeba2c3a5b495c286f27ae1fdcc3.png"><img src="http://utweb.jp/blog/wp-content/uploads/2010/01/427feeba2c3a5b495c286f27ae1fdcc3-300x227.png" alt="テンプレートをページに適用" title="テンプレートをページに適用" width="300" height="227" class="alignnone size-medium wp-image-586" /></a></p>
<pre class="xml"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceBegin template=&quot;/Templates/main.dwt&quot; codeOutsideHTMLIsLocked=&quot;false&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceBeginEditable name=&quot;doctitle&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span>=<span style="color: #ff0000;">&quot;all&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/css/import.css&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceBeginEditable name=&quot;head&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceParam name=&quot;profile_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceParam name=&quot;gallery_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceParam name=&quot;contact_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceParam name=&quot;link_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/head<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;page&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;header&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;h1<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>マサムネット<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/h1<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;ul</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;globalNavigation&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/ul<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;contents&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;top&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceBeginEditable name=&quot;maincontents&quot; --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ここにコンテンツが入ります。</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceEndEditable --&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;footer&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">コピーライト</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- InstanceEnd --&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/html<span style="font-weight: bold; color: black;">&gt;</span></span></span></div></li></ol></pre>
<p>test.htmlはこんな感じになると思います。</p>
<p>ここでメニューから「修正」→「テンプレートプロパティ」を選択します。<br />
<a href="http://utweb.jp/blog/wp-content/uploads/2010/01/2bfc96a45921677282a36721a07709ca.png"><img src="http://utweb.jp/blog/wp-content/uploads/2010/01/2bfc96a45921677282a36721a07709ca-300x75.png" alt="テンプレートプロパティをえらぶ！" title="テンプレートプロパティをえらぶ！" width="300" height="75" class="alignnone size-medium wp-image-592" /></a></p>
<p>さきほど苦労してテンプレートで作った変数がずらっと並んでいると思うので、そこからうまく「profile_class」という変数を見つけて、中身の「menu」を「self」と書き換えて下さい。<br />
<a href="http://utweb.jp/blog/wp-content/uploads/2010/01/7ba1f0a8ac2230876c7ad091cc32c8cc.png"><img src="http://utweb.jp/blog/wp-content/uploads/2010/01/7ba1f0a8ac2230876c7ad091cc32c8cc-300x233.png" alt="きみはうまくみつけられるか！？" title="きみはうまくみつけられるか！？" width="300" height="233" class="alignnone size-medium wp-image-594" /></a></p>
<p>お見事！グローバルナビゲーション部分のリストが次のように変わったかと思います。</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;self&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<h3>オプション領域</h3>
<p>次に「オプション領域」を試してみたいと思います。<br />
これは何かと言うと、テンプレートの中に、オプションとして「付けるか付けないか」をページごとに決められる部分を作る機能です。</p>
<p>（一個前にやったtest.html<strong>ではなく</strong>）先ほどのテンプレートに戻って、テンプレート変数を増やしてみます。</p>
<pre class="xml"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;profile_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;gallery_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;contact_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;link_class&quot; type=&quot;text&quot; value=&quot;menu&quot; --&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;profile_anchor&quot; type=&quot;boolean&quot; value=&quot;true&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;gallery_anchor&quot; type=&quot;boolean&quot; value=&quot;true&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;contact_anchor&quot; type=&quot;boolean&quot; value=&quot;true&quot; --&gt;</span></span>
<span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- TemplateParam name=&quot;link_anchor&quot; type=&quot;boolean&quot; value=&quot;true&quot; --&gt;</span></span></pre>
<p>追加しているのは下４行目です。上４行と比べて、今度は<br />
type="boolean"<br />
となっています。</p>
<p>プログラムに慣れた方で勘の良い方はこれで理解したかと思いますが、「オプション領域」と「編集可能オプション領域」の違いは、変数がbooleanかそうでないかの違いだけです。</p>
<p>なので先ほどの「編集可能オプション領域」と同じように、こんども変数のセットを行ったら、次はその変数を実際に使う部分を作っていきます。</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(profile_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>@@( (profile_anchor) ? '<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/profile/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>' : 'プロフィール' )@@<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(gallery_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>@@( (gallery_anchor) ? '<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>' : 'ギャラリー' )@@<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(contact_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>@@( (contact_anchor) ? '<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>' : 'お問い合わせ' )@@<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;@@(link_class)@@&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>@@( (link_anchor) ? '<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>' : 'リンク' )@@<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>なにやら@@ばっかりで複雑になったようですが、落ち着いて下さい。</p>
<p>実は<strong>@@(　　　)@@この中にはJavaScriptが書ける</strong>んです。<br />
なので例えば</p>
<pre class="xml">@@( (link_anchor) ? '<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>' : 'リンク' )@@</pre>
<p>こんなのも@@(　　　)@@の中だけに注目してみると</p>
<pre class="javascript"><span style="color: #66cc66;">&#40;</span>link_anchor<span style="color: #66cc66;">&#41;</span> ? <span style="color: #3366CC;">'&lt;a href=&quot;/link/&quot;&gt;リンク&lt;/a&gt;'</span> : <span style="color: #3366CC;">'リンク'</span></pre>
<p>こうなります。</p>
<p>こうしてみると、オプション領域の中はただの二項演算子（if 〜 elseのかっこいいやつ）で書けるということになります。</p>
<p>テンプレートを編集したら、test.htmlに戻ってみましょう。<br />
<a href="http://utweb.jp/blog/wp-content/uploads/2010/01/d8eddf5329882d76f0b5323c6fd8e79a.png"><img src="http://utweb.jp/blog/wp-content/uploads/2010/01/d8eddf5329882d76f0b5323c6fd8e79a-300x230.png" alt="さっき作った変数profile_ancher" title="さっき作った変数profile_ancher" width="300" height="230" class="alignnone size-medium wp-image-595" /></a><br />
さっき作ったばかりの変数「profile_anchor」を選択して下の「profile_anchorを表示」のチェックを外して下さい。</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;self&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>プロフィール<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/gallery/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>ギャラリー<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/contact/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>お問い合わせ<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;menu&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/link/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>リンク<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/li<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>こんな感じで、プロフィールだけアンカーが無いリストになったと思います。</p>
<h3>まとめ</h3>
<p>実は@@(　　　)@@とかJavascriptなんてものを使わなくても、最初からテンプレート編集画面で「挿入」→「テンプレートオブジェクト」から「編集可能オプション領域」や「オプション領域」を選ぶと、何かUIが現れて設定できるのですが、そっちを覚えるよりは僕はJavascriptのほうが馴染みがあるのでこっちの方法を紹介しました。<br />
とにかくテンプレート機能が見違えるくらい柔軟かつ強力になる機能には間違いないので、興味がある方でJavascriptよりはUIからの設定に自信のある方はそちらを試してみても良いと思います！</p>
]]></content:encoded>
			<wfw:commentRss>http://utweb.jp/blog/archives/585/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://utweb.jp/blog/archives/585" />
	</item>
	</channel>
</rss>

