The content of this article is about how to use templates in Dreamweaver (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
The functions of templates:
1. Helps to maintain a consistent appearance and style of the entire website;
2. After modifications are made in the template , all pages to which the template is applied will be updated automatically.
Simple example:
// In its .dwt template
<!-- TemplateBeginEditable name="myName" -->
设置可编辑区域
<!-- TemplateEndEditable -->
// In the page , declare the address of the application template, and the area, etc.
<HTML>
<!-- InstanceBegin template="/Templates/myTemplates.dwt" codeOutsideHTMLIsLocked="false" -->
<HEAD>
</BODY>
<!-- InstanceEnd -->
</HTML>
// In the template area, set the editable area
<!-- InstanceBeginEditable name="myName" -->
放入可编辑区域的内容
<!-- InstanceEndEditable -->
767ca6dca3ed56b69fcd1a934804f194edd161f7c09dc7f4b2fcfa3d583076d7
623bf5a311eb01972e3a038461cfe55e
867dc13d4d8dcc76bcbf47e9b5436535
2a58cf4a25e5e67f880b4dc99533add5Templates72c3bc8c17f26d38fb216c7695f0f357
dd41de28e245a8388c4a6b420f832539
1df7737262ad269b94d7418ec096f18fdd41de28e245a8388c4a6b420f832539
de5784feeaad7ae4ffb1e34f1eac6168
00f38c0f8be778c9e9a7d04b5d656541
86376992b71f6f4c9ac52cfc1ce7a5a9
0defae2befe3b122d038ea04b7d5dc31
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64
d7d7242aa3fe2ba2b0aab2a7399f4872
bd0ef02a49d9e8a424f05ec6b0ca0f9c
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a642f71a04b60e85bfdfa72e1c5d39835fda3d7de8b0c5c41a3588039351ede40aa
73a77e6ec55b8f43c0c19fba91875a640ec3e0e8ef4a7167c5769b2f48c9f36da3d7de8b0c5c41a3588039351ede40aa
73a77e6ec55b8f43c0c19fba91875a64acb3a80fb7c156308a62c2613fc3dab2a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
bff76c8e7181d720027042fe8b0358c5
a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64
7aabdc94043fddad1c83149e90bec325
6f7c79beb4797b91f0200f8698f81db5
2ad9b981838a2cbc23e610d74dafbbe8
d8ce6d1bcd7b9a4bd1928089a1180734
5350a78126988aefe50ffe36c592f6b5
6f7c79beb4797b91f0200f8698f81db5
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a640feca1a2c11ba427ea348ef033336b7ed85bf3fe6ebb7c29b37bf1b02dfcb458442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a648a42b972f8d6b83725612faa4e6201303755445af3a5aec01b786777bdd12251442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64c96c7342d8fb11291876bedb3ead186bd1dd5cb58b65df9a5acd83ecc1ae1549442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64f5624c5e05addfec22880edf16ca8f673422665eb920a30589ae4fc8509c9d2a442aa0b3409575ccae758104a2337647a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a6404dad843e4647e95ad65b019c963c294a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a6414073dd0a7dd2265090e2eb659e79f17a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64d958a9743db3bb668679e0cfc7be5fa4a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
2ad9b981838a2cbc23e610d74dafbbe8
73a77e6ec55b8f43c0c19fba91875a64004a9271b7ae5341c903c974ae7328b4a3d7de8b0c5c41a3588039351ede40aa
22b512e83ce3185a5f75935b3f267550
#> 6b64be6b4bfa7217e59866ef6e50d7fb9c2e91a16a7609738b68cd470b3e51cb385814dc6da80d46357c851211ba7781 TR>
src="Temp_images/left_10.gif">500ffb3fecf42c89a85c1ab3f08ed92c #TABLE>
##a3d7de8b0c5c41a3588039351ede40aa 5121ffcc76eed177e308c780579a670c
ecb2e189b5a582d56643638416321980
## 4a3ae47275887a6f562c7a2b098314a4 ;!--
InstanceBeginEditable name="right" --> width
="450" border="0"> 657c32b7d9398dab06e8aa2e98e71c80 c85abc3c8d1a5103103ff0692d600273
7f0d332c7912fed217fc72cbe38b6a78 7c2a1de8c55936bf9e7776186a9d6ca2 8a3d9cb84e2d3b8768074bc1171c0e0c
52dda75af101dcf2cb484a0f22026742 8a3d9cb84e2d3b8768074bc1171c0e0c
672da5ab908bb38fd37e8492cc852bd2
de9acb942dcc38d8bc06aed4239b26f9
23b6731f659f5b51ded23b9990e8bfee 8a3d9cb84e2d3b8768074bc1171c0e0c
8b9874198e2f9067d090cdaa33e965d0be0cf4e46ab23b84196cc6b9b2aa1fffbe0cf4e46ab23b84196cc6b9b2aa1fff
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 组合键;
方法四:
右键选中区域->“模板”->“新建可编辑区域”
删除可编辑区域:
选中编辑区域,“修改”->“模板”->“删除模板标记”,该区域将被锁定,不可编辑。
修改编辑模板:
Select "Window"->"Resources"->"Template" icon->Select the template you want to edit, and then double-click it. The template will appear in the "Document" window, and you can edit the template at this time.
Apply a template to a web page:
1. Open the document (ie: page) to which you want to apply the template;
2. Select "Window" -> "Resources" - >"Template" icon->Select the template you want to apply;
3. Drag the template from the panel into the page window (or click the "Apply" button);
4. Add or write data in the editable area;
Note:If there is already content in the document, the existing content must be moved to the editable area of the template, otherwise Dreamweaver will delete it content!
The above is the detailed content of How to use templates in Dreamweaver (with code). For more information, please follow other related articles on the PHP Chinese website!