Page 1 of 1

any .tpl editor ?

Posted: Tue Feb 27, 2007 10:15 am
by PHPycho
Do anybody know the good .tpl editor for smarty ?
If yes somebody would be very greatful .
Thank you !!

Posted: Tue Feb 27, 2007 10:29 am
by feyd
Google knows all, apparently: http://www.google.com/search?q=smarty+editor

Posted: Tue Feb 27, 2007 10:33 am
by PHPycho
who doesnt know there is existence of so called google...
but i want if somebody had used some type of .tpl editor for smarty.
Again pardoning...

Posted: Tue Feb 27, 2007 10:35 am
by feyd
I don't use an editor specifically for smarty (when I use it.) Any editor worth it's salt will be able to edit them fine enough.

Posted: Tue Feb 27, 2007 11:12 am
by PHPycho
what i want is ?
the editor should highlight the smarty syntax..

Posted: Tue Feb 27, 2007 11:33 am
by AKA Panama Jack
I use UE Studio. It's a fantastic programmers editor. It will allow you to create your own Syntax Highlighting Wordlist. So I created one for Template Lite/Smarty .tpl files. Template Lite has far more tags than Smarty. I used to use Homesite for everyting but UE Studio just won me over completely.

Posted: Tue Feb 27, 2007 1:55 pm
by AKA Panama Jack
If you are using UE Studio find the wordfile.txt in the UEStudio main directory and load it into a text editor. Make sure you make a backup of the wordfile.txt before you continue.

Find the HTML block. It will start with

Code: Select all

/L3"HTML" HTML_LANG Nocase Noquote Block Comment On = <!-- Block Comment Off = -->  File Extensions = HTM HTML SHTML HTT HTA HTX CFM JSP PHP PHTML ASP INC TPL
The HTML block will continue to the java block.

Code: Select all

/L4"Java" JAVA_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = JAV JAVA
You want to delete the entire HTML block from the /L3 (including the /L3) to the /L4 line (do not delete the L4 line).

You will be inserting this block of code to replace what you deleted.

Code: Select all

/L3"HTML+TemplateLite/Smarty" HTML_LANG Nocase Noquote Block Comment On = <!-- Block Comment Off = -->  File Extensions = HTM HTML SHTML HTT HTA HTX CFM JSP PHP PHTML ASP INC TPL
/Delimiters = ~!@$%^&*()+=|\{}[]:;"'<> ,	.?
/Function String = "<form*>"
/Member String = "$S[ ^t]++=[ ^t&]++new[ ^t]+^([A-Za-z_]+[A-Za-z0-9_]++^)"
/Variable String = "$S[ ^t]++=[ ^t&]++new[ ^t]+^([A-Za-z_]+[A-Za-z0-9_]++^)"
/Indent Strings = "<" "{if" "{section" "{else" "{strip}" "{php}" "{capture}" "{sectionelse}" "{literal}" "{for" "{while"
/Unindent Strings = "</" "{else" "{/if}" "{/section}" "{/strip}" "{/php}" "{/capture}" "{sectionelse}" "{/literal}" "{/for}" "{/while}"
/Open Brace Strings =  "{" "(" "[" "<"
/Close Brace Strings = "}" ")" "]" ">"
/Open Fold Strings = "{section" "{sectionelse}" "{if" "{else}" "{*" "{php}" "{capture}" "{foreach}" "{foreachelse}" "{for" "{while"
/Close Fold Strings = "{sectionelse}" "{/section}" "{else}" "{/if}" "*}" "{/php}" "{/capture}" "{foreachelse}" "{/foreach}" "{/for}" "{/while}"
/Marker Characters = "[]"
/C1"Tags" STYLE_TAG
<A </A> <ABBR> <ABBR </ABBR> <ABOVE> <ACRONYM> <ACRONYM </ACRONYM> <ADDRESS> <ADDRESS </ADDRESS>
<APPLET </APPLET> <AREA </AREA <ARRAY>
<B> <B </B> <BASE <BASEFONT <BDO> <BDO </BDO> <BGSOUND <BIG> <BIG </BIG> <BLINK> <BLINK </BLINK>
<BLOCKQUOTE> <BLOCKQUOTE </BLOCKQUOTE> <BODY> <BODY </BODY> <BOX> <BR/> <BR> <BR <BUTTON> </BUTTON>
<CAPTION> <CAPTION </CAPTION> <CENTER> <CENTER </CENTER> <CITE> <CITE </CITE> <CODE> <CODE </CODE>
<COL> <COL <COLGROUP> <COLGROUP </COLGROUP> <COMMENT> </COMMENT>
<DD> <DD </DD> <DEL> <DEL </DEL> <DFN> <DFN </DFN> <DIR> <DIR </DIR> <DIV> <DIV </DIV> <DL> <DL </DL>
<DT> <DT </DT>
<EM> <EM </EM> <EMBED
<FIELDSET> <FIELDSET </FIELDSET> <FIG> <FONT </FONT> <FORM> <FORM </FORM> <FRAME <FRAMESET </FRAMESET>
<H1> <H1 </H1> <H2> <H2 </H2> <H3> <H3 </H3> <H4> <H4 </H4> <H5> <H5 </H5> <H6> <H6 </H6> <HEAD> <HEAD
</HEAD> <HR/> <HR> <HR <HTML> <HTML </HTML>
<I> <I </I> <IFRAME> </IFRAME> <ILAYER> </ILAYER> <IMG <INPUT> <INPUT <INS> <INS </INS> <ISINDEX> <ISINDEX
<KBD> <KBD </KBD>
<LABEL> <LABEL </LABEL> <LAYER> <LAYER </LAYER> <LEGEND> <LEGEND </LEGEND> <LI> <LI </LI> <LINK <LISTING>
</LISTING>
<MAP </MAP> <MARQUEE </MARQUEE> <MENU> <MENU </MENU> <META <MULTICOL> </MULTICOL>
<NEXTID <NOBR> </NOBR> <NOFRAMES> </NOFRAMES> <NOLAYER> </NOLAYER> <NOSCRIPT> </NOSCRIPT> <NOTE> </NOTE>
<OBJECT> <OBJECT </OBJECT> <OL> <OL </OL> <OPTGROUP> <OPTGROUP </OPTGROUP> <OPTION> <OPTION </OPTION>
<P> <P </P> <PARAM <PRE> <PRE </PRE>
<Q> <Q </Q> <QUOTE>
<RANGE> <ROOT>
<S> <S </S> <SAMP> <SAMP </SAMP> <SCRIPT> <SCRIPT </SCRIPT> <SELECT> <SELECT </SELECT> <SMALL> <SMALL
</SMALL> <SOUND <SPACER> <SPAN> <SPAN </SPAN> <SQRT> <STRIKE> <STRIKE </STRIKE> <STRONG> <STRONG </STRONG>
<STYLE> <STYLE </STYLE> <SUB> <SUB </SUB> <SUP> <SUP </SUP>
<TABLE> <TABLE </TABLE> <TBODY> <TBODY </TBODY> <TD> <TD </TD> <TEXT> <TEXTAREA> <TEXTAREA </TEXTAREA>
<TFOOT> <TFOOT </TFOOT> <TH> <TH </TH> <THEAD> <THEAD </THEAD> <TITLE> </TITLE> <TR> <TR </TR> <TT>
<TT </TT>
<U> <U </U> <UL> <UL </UL>
<VAR> <VAR </VAR>
<WBR>
<XMP> </XMP>
// />
>
/C2"Attributes" STYLE_ATTRIBUTE
[]
ABBR= ACCEPT-CHARSET= ACCEPT= ACCESSKEY= ACTION= ALIGN= ALINK= ALT= ARCHIVE= AXIS=
BACKGROUND= BEHAVIOR BEHAVIOR> BELOW BELOW> BGCOLOR= BORDER=
CELLPADDING= CELLSPACING= CHAR= CHAROFF= CHARSET= CHECKED CHECKED> CITE= CLASS= CLASSID= CLEAR= CODE=
CODEBASE= CODETYPE= COLOR= COLS= COLSPAN= COMPACT COMPACT> CONTENT= COORDS=
DATA= DATETIME= DECLARE DECLARE> DEFER DEFER> DIR= DISABLED DISABLED>
ENCTYPE=
FACE= FOR= FRAME= FRAMEBORDER= FRAMESPACING=
HEADERS= HEIGHT= HIDDEN= HREF= HREFLANG= HSPACE= HTTP-EQUIV=
ID= ISMAP=
LABEL= LANG= LANGUAGE= LINK= LONGDESC= LOOP=
MAILTO= MARGINHEIGHT= MARGINWIDTH= MAXLENGTH= MEDIA= METHOD= MULTIPLE MULTIPLE>
NAME= NOHREF NOHREF> NORESIZE NORESIZE> NOSHADE NOSHADE> NOWRAP NOWRAP>
OBJECT= ONBLUR= ONCHANGE= ONCLICK= ONDBLCLICK= ONFOCUS= ONKEYDOWN= ONKEYPRESS= ONKEYUP= ONLOAD=
ONMOUSEDOWN= ONMOUSEMOVE= ONMOUSEOUT= ONMOUSEOVER= ONMOUSEUP= ONRESET= ONSELECT= ONSUBMIT= ONUNLOAD=
PROFILE= PROMPT=
READONLY READONLY> REL= REV= ROWS= ROWSPAN= RULES=
SCHEME= SCOPE= SCROLLING= SELECTED SELECTED> SHAPE= SIZE= SPAN= SRC= STANDBY= START= STYLE= SUMMARY=
TABINDEX= TARGET= TEXT= TITLE= TOPMARGIN= TYPE=
URL= USEMAP=
VALIGN= VALUE= VALUETYPE= VERSION= VLINK= VSPACE=
WIDTH=
=

/C4"Template Lite Variables"
** $ .

/C5"Template Lite Modifiers"
capitalize cat count_characters count_paragraphs count_sentences count_words
date_format default
escape
indent
lower
nl2br 
regex_replace replace
spacify string_format strip strip_tags substr
truncate
upper
wordwrap

/C6"Template Lite Functions"
{assign
{config_load {case
{elseif {else
{foreach {/foreach {for {/for
{html_Checkboxes {html_Image {html_Options {html_Radios {html_Select_Date {html_Select_Time {html_Table
{if {/if {include {include_Php {insert
{ldelim} {literal {/literal
{php {/php
{rdelim}
{section {/section {sectionelse {switch {/switch
{while
{/while
{
}

/C7"Template Lite Custom"
{capture {/capture {counter {cycle
{db_function_call {db_result_call
{html_checkboxes {html_hidden {html_image {html_input {html_options {html_radios {html_select_date {html_select_time {html_table {html_textbox
{in_array
{mailto {math
{popup {popup_init
{resize_image
{strip {/strip
{textformat {/textformat

/C8"Template Lite Constants"
.capture .config .const .content .execute .ext .first .foreach .index_next .index_prev .last .ldelim .main .menu .name .now .object .objectid .parent .parents .pageid .rdelim .result .REQUEST_URI .search .section .SERVER_NAME .stylesheet .template .version
UEStudio will auto indent and unindent on the proper Template Lite/Smarty functions when you are typing.

You will need to load UE Studio and change the coloring for the different types of tags.
  • 1. Click on Advanced in the menu bar.

    2. Click on Configuration.

    3. Open the Editor Display tree

    4. Click on Syntax Highlighting

    5. You should already be set for HTML+TemplateLite/Smarty for the language. If not select it.

    6. Under the Color Group you will find selections for Template Lite Variables, Template Lite Functions, Template Lite Custom and Template Lite Constants. Select each one and change the color and highlighting style you would like.
You are finished. UE Studio will now highlight the template syntax. A little bit of work but worth it. :D

If you don't want to do all of the file editing you can download the wordfile.txt from here... wordfile.txt

The worfile.txt work in UE Studio 6.00a. It should work in earlier versions as well.

Posted: Tue Feb 27, 2007 2:55 pm
by RobertGonzalez
I am pretty sure you can define syntax styles for your own file types in Eclipse, Notepad++, Notepad2 and PSPad. I use eclipse, but I am not too much into smarty highlighting, though it does highlight somewhat straight out of the chutes.