<HTML ><HEAD ><TITLE >Naming Conventions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Smarty Manual" HREF="index.html"><LINK REL="UP" TITLE="Extending Smarty With Plugins" HREF="plugins.html"><LINK REL="PREVIOUS" TITLE="Extending Smarty With Plugins" HREF="plugins.html"><LINK REL="NEXT" TITLE="Writing Plugins" HREF="plugins.writing.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Smarty Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="plugins.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 16. Extending Smarty With Plugins</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="plugins.writing.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="plugins.naming.conventions" ></A >Naming Conventions</H1 ><P > Plugin files and functions must follow a very specific naming convention in order to be located by Smarty. </P ><P > <SPAN CLASS="bold" ><B CLASS="emphasis" >plugin files</B ></SPAN > must be named as follows: <A NAME="AEN7122" ></A ><BLOCKQUOTE CLASS="BLOCKQUOTE" ><P > <TT CLASS="filename" > <TT CLASS="replaceable" ><I >type</I ></TT >.<TT CLASS="replaceable" ><I >name</I ></TT >.php </TT > </P ></BLOCKQUOTE > </P ><P ></P ><UL ><LI ><P > Where <TT CLASS="literal" >type</TT > is one of these plugin types: <P ></P ><UL COMPACT="COMPACT" ><LI ><SPAN >function</SPAN ></LI ><LI ><SPAN >modifier</SPAN ></LI ><LI ><SPAN >block</SPAN ></LI ><LI ><SPAN >compiler</SPAN ></LI ><LI ><SPAN >prefilter</SPAN ></LI ><LI ><SPAN >postfilter</SPAN ></LI ><LI ><SPAN >outputfilter</SPAN ></LI ><LI ><SPAN >resource</SPAN ></LI ><LI ><SPAN >insert</SPAN ></LI ></UL > </P ></LI ><LI ><P > And <TT CLASS="literal" >name</TT > should be a valid identifier; letters, numbers, and underscores only, see <A HREF="http://php.net/language.variables" TARGET="_top" >php variables</A >. </P ></LI ><LI ><P > Some examples: <TT CLASS="filename" >function.html_select_date.php</TT >, <TT CLASS="filename" >resource.db.php</TT >, <TT CLASS="filename" >modifier.spacify.php</TT >. </P ></LI ></UL ><P > <SPAN CLASS="bold" ><B CLASS="emphasis" >plugin functions</B ></SPAN > inside the PHP files must be named as follows: <A NAME="AEN7161" ></A ><BLOCKQUOTE CLASS="BLOCKQUOTE" ><P > <B CLASS="function" >smarty_<TT CLASS="replaceable" ><I >type</I ></TT >_<TT CLASS="replaceable" ><I >name</I ></TT >()</B > </P ></BLOCKQUOTE > </P ><P ></P ><UL ><LI ><P > The meanings of <TT CLASS="literal" >type</TT > and <TT CLASS="literal" >name</TT > are the same as above. </P ></LI ><LI ><P > An example modifier name <TT CLASS="varname" >foo</TT > would be <TT CLASS="literal" >function smarty_modifier_foo()</TT >. </P ></LI ></UL ><P > Smarty will output appropriate error messages if the plugin file it needs is not found, or if the file or the plugin function are named improperly. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="plugins.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="plugins.writing.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Extending Smarty With Plugins</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="plugins.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Writing Plugins</TD ></TR ></TABLE ></DIV ></BODY ></HTML >