RE: [SMARTY] User smarty template with Dreamweaver MX
| From: | Gary Loescher | Date: | Tue, 23 Jul 2002 18:06:57 +0000 |
| Subject: | RE: [SMARTY] User smarty template with Dreamweaver MX | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5396@lists.php.net to get a copy of this message | ||
Here is some documentation about getting DW to recognize
other file types, such as .tpl:
http://www.macromedia.com/support/dreamweaver/ts/documents/add_ext_mx.ht
m
It's not too bad. I got it to work in a few minutes, even though
I just started playing with DW myself (I'm used to non-WYSIWYG
editors).
If you want to get color syntax highlighting it's a bit
more involved: you need to edit the CodeColoring.xml and
possibly Colors.xml in your Configuration directory (see
caveat below):
1. In CodeColoring.xml, find the HTML scheme (near the top):
<scheme name="HTML" id="HTML" doctypes="ASP.NET_VB,ASP.NET_CSharp,A ...
If you've set DW to recognize TPL as an extension, you
should add it here to the doctypes attribute.
2. Add a Smarty scheme to CodeColoring.xml. I've attached
one I used as a first cut; I'm sure other people will be
able to improve it :) All I did was tell DW to use the
PHP colors on the Smarty keywords. It doesn't work 100%
(with text strings and operators, for instance) but at
least the keywords are highlighted. To add it, just paste
the attached file somewhere between the <codeColoring>
</codeColoring> tags, after one of the existing <scheme>
</scheme> elements.
If you want to set up your own Smarty colors, I believe
it's possible to edit them within DW from a preferences
menu somewhere. Or, you can dive into Colors.xml.
A caveat: DW installs "personal" copies of some of the
config files in \Documents and Settings\<user>\Application
Data\Macromedia\Dreamweaver MX\Configuration\...
These settings will _override_ the ones found in DW's
Configuration directory, so change these files instead.
If anyone comes up with a better way of doing this, or
a more complete colorizing file, please post!
HTH,
Gary
> -----Original Message-----
> From: Jonathan Chum [mailto:jchum@aismedia.com]
> Sent: Tuesday, July 23, 2002 7:52 AM
> To: 'J'; smarty-general@lists.php.net
> Subject: RE: [SMARTY] User smarty template with Dreamweaver MX
>
>
> What I tend to do is just use the .html extension rather than
> .tpl because
> Dreamweaver associates .html upon installation of the application.
>
> I also tend to set the delimiters to <!--{ }--> and use the
> Smarty conf to
> utilize these delimiters as it appears so much better in
> design view rather
> than the curly braces.
>
> I've also attached a zip that was distributed by Mattia
> [mattia.c@libero.it]
> a few weeks ago which works great!
>
> -----Original Message-----
> From: J [mailto:zjs2k@mindspring.com]
> Sent: Tuesday, July 23, 2002 12:01 AM
> To: smarty-general@lists.php.net
> Subject: [SMARTY] User smarty template with Dreamweaver MX
>
>
> Hello, everyone. I am new here and I have a question. It may
> look dumb,
> but I can not use the design view of Dreamweaver to edit the
> .tpl files.
> After I opened the .tpl file in Dreamweaver, only code view is
> available. I can't select "Design" or "Code and Design" from
> view menu.
> I assume this must be some setting in DW. I was using plain
> text editor
> mostly and I am quite new to DW. Could someone give me some hint?
>
> Thank you very much,
>
> Jin
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
<scheme name="Smarty Template" id="Smarty_Template" priority="10"> <ignoreCase>Yes</ignoreCase> <ignoreTags>No</ignoreTags> <blockStart name="Block Delimiter" id="CodeColor_PHPScriptBlock" doctypes="HTML" scheme="customText"><![CDATA[{{\s]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <blockStart doctypes="HTML" scheme="customText"><![CDATA[{{\n]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <blockStart doctypes="HTML" scheme="customText"><![CDATA[{{]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <commentStart name="Comment" id="CodeColor_PHPScriptComment"><![CDATA[{{*]]></commentStart> <commentEnd><![CDATA[*}}]]></commentEnd> <stringStart name="String" id="CodeColor_PHPScriptString"><![CDATA["]]></stringStart> <stringEnd><![CDATA["]]></stringEnd> <stringStart><![CDATA[']]></stringStart> <stringEnd><![CDATA[']]></stringEnd> <stringEsc><![CDATA[\]]></stringEsc> <brackets name="Bracket" id="CodeColor_PHPScriptBracket"><![CDATA[{[()]}]]></brackets> <numbers name="Number" id="CodeColor_PHPScriptNumber" /> <idChar1>_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</idChar1> <idCharRest name="Identifier" id="CodeColor_PHPScriptIdentifier">_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</idCharRest> <keywords name="Reserved Keywords" id="CodeColor_PHPScriptReserved"> <keyword>if</keyword> <keyword>/if</keyword> <keyword>else</keyword> <keyword>elseif</keyword> <keyword>false</keyword> <keyword>foreach</keyword> <keyword>foreachelse</keyword> <keyword>/foreach</keyword> <keyword>capture</keyword> <keyword>/capture</keyword> <keyword>section</keyword> <keyword>sectionelse</keyword> <keyword>/section</keyword> <keyword>include</keyword> <keyword>include_php</keyword> <keyword>insert</keyword> <keyword>literal</keyword> <keyword>ldelim</keyword> <keyword>rdelim</keyword> <keyword>strip</keyword> <keyword>/strip</keyword> <keyword>config_load</keyword> </keywords> <keywords name="Variables" id="CodeColor_PHPScriptVariables"> <keyword>$smarty</keyword> </keywords> <keywords name="Functions" id="CodeColor_PHPScriptFunctionsKeywords"> <keyword>assign</keyword> <keyword>counter</keyword> <keyword>cycle</keyword> <keyword>eval</keyword> <keyword>fetch</keyword> <keyword>html_options</keyword> <keyword>html_select_date</keyword> <keyword>html_select_time</keyword> <keyword>math</keyword> <keyword>popup_init</keyword> <keyword>popup</keyword> </keywords> <sampleText doctypes="HTML,TPL"><![CDATA[{{* Smarty template sample *}} <!--{assign foo="bar"}--> <!--{if foo == "bar"}--> It was a bar. <!--{else}--> It was not a bar. <!--{/if}--> ]]></sampleText> </scheme>
<scheme name="Smarty Template" id="Smarty_Template" priority="10"> <ignoreCase>Yes</ignoreCase> <ignoreTags>No</ignoreTags> <blockStart name="Block Delimiter" id="CodeColor_PHPScriptBlock" doctypes="HTML" scheme="customText"><![CDATA[{{\s]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <blockStart doctypes="HTML" scheme="customText"><![CDATA[{{\n]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <blockStart doctypes="HTML" scheme="customText"><![CDATA[{{]]></blockStart> <blockEnd><![CDATA[}}]]></blockEnd> <commentStart name="Comment" id="CodeColor_PHPScriptComment"><![CDATA[{{*]]></commentStart> <commentEnd><![CDATA[*}}]]></commentEnd> <stringStart name="String" id="CodeColor_PHPScriptString"><![CDATA["]]></stringStart> <stringEnd><![CDATA["]]></stringEnd> <stringStart><![CDATA[']]></stringStart> <stringEnd><![CDATA[']]></stringEnd> <stringEsc><![CDATA[\]]></stringEsc> <brackets name="Bracket" id="CodeColor_PHPScriptBracket"><![CDATA[{[()]}]]></brackets> <numbers name="Number" id="CodeColor_PHPScriptNumber" /> <idChar1>_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</idChar1> <idCharRest name="Identifier" id="CodeColor_PHPScriptIdentifier">_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</idCharRest> <keywords name="Reserved Keywords" id="CodeColor_PHPScriptReserved"> <keyword>if</keyword> <keyword>/if</keyword> <keyword>else</keyword> <keyword>elseif</keyword> <keyword>false</keyword> <keyword>foreach</keyword> <keyword>foreachelse</keyword> <keyword>/foreach</keyword> <keyword>capture</keyword> <keyword>/capture</keyword> <keyword>section</keyword> <keyword>sectionelse</keyword> <keyword>/section</keyword> <keyword>include</keyword> <keyword>include_php</keyword> <keyword>insert</keyword> <keyword>literal</keyword> <keyword>ldelim</keyword> <keyword>rdelim</keyword> <keyword>strip</keyword> <keyword>/strip</keyword> <keyword>config_load</keyword> </keywords> <keywords name="Variables" id="CodeColor_PHPScriptVariables"> <keyword>$smarty</keyword> </keywords> <keywords name="Functions" id="CodeColor_PHPScriptFunctionsKeywords"> <keyword>assign</keyword> <keyword>counter</keyword> <keyword>cycle</keyword> <keyword>eval</keyword> <keyword>fetch</keyword> <keyword>html_options</keyword> <keyword>html_select_date</keyword> <keyword>html_select_time</keyword> <keyword>math</keyword> <keyword>popup_init</keyword> <keyword>popup</keyword> </keywords> <sampleText doctypes="HTML,TPL"><![CDATA[{{* Smarty template sample *}} <!--{assign foo="bar"}--> <!--{if foo == "bar"}--> It was a bar. <!--{else}--> It was not a bar. <!--{/if}--> ]]></sampleText> </scheme>