本篇文章给大家带来的内容是关于Dreamweaver中如何使用模板(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
模板的作用:
一、有助于保持整个网站外观和风格的一致;
二、在模板中进行修改后,所有应用模板的页面都将自动更新。
简单示例:
// 在其.dwt 模板中
<!-- TemplateBeginEditable name="myName" -->
设置可编辑区域
<!-- TemplateEndEditable -->
// 在页面中,声明应用模板的地址,以及区域等
<HTML>
<!-- InstanceBegin template="/Templates/myTemplates.dwt" codeOutsideHTMLIsLocked="false" -->
<HEAD>
</BODY>
<!-- InstanceEnd -->
</HTML>
// 在模板区域内,设置可编辑区域
<!-- InstanceBeginEditable name="myName" -->
放入可编辑区域的内容
<!-- InstanceEndEditable -->
767ca6dca3ed56b69fcd1a934804f194edd161f7c09dc7f4b2fcfa3d583076d7
623bf5a311eb01972e3a038461cfe55e
867dc13d4d8dcc76bcbf47e9b5436535
2a58cf4a25e5e67f880b4dc99533add5Templates72c3bc8c17f26d38fb216c7695f0f357
dd41de28e245a8388c4a6b420f832539
1df7737262ad269b94d7418ec096f18fdd41de28e245a8388c4a6b420f832539
de5784feeaad7ae4ffb1e34f1eac6168
00f38c0f8be778c9e9a7d04b5d656541
86376992b71f6f4c9ac52cfc1ce7a5a9
0defae2befe3b122d038ea04b7d5dc31
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64
d7d7242aa3fe2ba2b0aab2a7399f4872
bd0ef02a49d9e8a424f05ec6b0ca0f9c
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a643b34822ed45de5e190c8eb5f4c319e06a3d7de8b0c5c41a3588039351ede40aa
73a77e6ec55b8f43c0c19fba91875a64d3124bfb40b759e683574ece8b2e825ca3d7de8b0c5c41a3588039351ede40aa
73a77e6ec55b8f43c0c19fba91875a64655c59772c2ba5b45c27428608295675a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
bff76c8e7181d720027042fe8b0358c5
a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64
757ff7bbc00c32a5de64470942a165e3
bd0ef02a49d9e8a424f05ec6b0ca0f9c
2ad9b981838a2cbc23e610d74dafbbe8
089b2f06d2c61b1261b6c37ef9003344
41343b2f042b1b3a1fbc11b808862c88
bd0ef02a49d9e8a424f05ec6b0ca0f9c
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64ef1d6ef819d1d87c4f5bb0890842451be0abe2c0fdb3f805a199ca5c835992e1442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64b33be5615aa2d6935ed165a3e50f4d6a8c4adce7a2187532a3b2e97d1a7a038c442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a646d9dd735b260ac1e3b9f12d96e5f0127fc26e00ba5569f589910fb344d4f8150442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a6401b88750c604c772b4460ebae8dc33ca9e28d45c7eb179ba2268e9db3c4fb269442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a6496459a7f5d390bbb452e104e79c69150a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a646f2605892e1231b5693b4cc68c552136a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64bcd62d0ee7d29d25cae158dc37244350a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a644c4c24a968e769cbf37ea961b0a1db87a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64c1fef749777b77d40fde07022e86ab37a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a6495fd69eadc6f29cb9afb2106d3de2d41a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
bff76c8e7181d720027042fe8b0358c5
a3d7de8b0c5c41a3588039351ede40aa
089b2f06d2c61b1261b6c37ef9003344 1e000c15fb80997aacfd84347bb3a0ab
3b2fc7338b18886b24904c4281ea83a5
5d17d6dfce0369dabca732e8a79bf63b
d1e7781207572325b4a670081ac304ee
de9acb942dcc38d8bc06aed4239b26f9
887ad32652701238bd4af54183b01dcd 8a3d9cb84e2d3b8768074bc1171c0e0c
3e921e8ab4fe0872ed16ee867eaf9bcd 8a3d9cb84e2d3b8768074bc1171c0e0c
13ad7ab09749864624a9f4073b3fce23 8a3d9cb84e2d3b8768074bc1171c0e0c
672da5ab908bb38fd37e8492cc852bd2
de9acb942dcc38d8bc06aed4239b26f9
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
4033e811a3be731b2ca5591202c57c99be0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fff
a10b6b8f86a96e22c977659eb13b2dfa欢迎来到我的站点!415df25e129f106257652a0407120ccc
be0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fff
xugang be0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fff
2008.10.26be0cf4e46ab23b84196cc6b9b2aa1fff
8a3d9cb84e2d3b8768074bc1171c0e0c
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
672da5ab908bb38fd37e8492cc852bd2
de9acb942dcc38d8bc06aed4239b26f9
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
672da5ab908bb38fd37e8492cc852bd2
a260abd15b36d9da0b08d8823355e09a
dd41de28e245a8388c4a6b420f832539a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
bff76c8e7181d720027042fe8b0358c5
a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
bff76c8e7181d720027042fe8b0358c5
fe2bf1b00e0f3a21cb39d94e2fc72c5f
4bcbeea3dce8d5942ee62f6c993d3c5e
d60c79aa20a75302e1741ffc2e5eae6c“另存为模板”,保存模板;
新建空白模板:
1.选择“窗口”->“资源”命令(或按 F11键)。
2.单击“资源”面板上的“模板”图标,显示“模板”面板。
3.单击“模板”面板右下角的“新建模板”图标。
默认情况下,整个模板都处于锁定状态。
添加可编辑区域:
方法一:
在“插入”栏->“常用”选项卡->“模板”图标->“可编辑区域”;
方法二:
在“插入”->“模板对象”->“可编辑区域”;
方法三:
按Ctrl+Alt+V 组合键;
方法四:
右键选中区域->“模板”->“新建可编辑区域”
删除可编辑区域:
选中编辑区域,“修改”->“模板”->“删除模板标记”,该区域将被锁定,不可编辑。
修改编辑模板:
选择“窗口”->“资源”->“模板”图标->选择要编辑的模板,然后双击,该模板将出现在“文档”窗口,此时即可编辑该模板。
对网页应用模板:
1.打开要应用模板的文档(即:页面);
2.选择“窗口”->“资源”->“模板”图标->选择要应用的模板;
3.将模板从面板拖到页面窗口中(或单击“应用”按钮);
4.在可编辑区域添加或编写数据;
注意:如果文档中已经有内容,必须将现有内容移到模板的可编辑区域内,否则Dreamweaver将会删除这些内容!
以上是Dreamweaver中如何使用模板(附代码)的详细内容。更多信息请关注PHP中文网其他相关文章!