Skip to search.
phpresource · Storehouse of PHP Resources

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
Writting your own smarty plugins   Message List  
Reply Message #495 of 2794 |
Hi All,
Writting own smarty plugins is very easy. In your smarty based applications, you
can create own plugins when you want to simplify your logic.

 Here is a short guideline and an example to write your own smarty pugins:
  
   1. Create plugin file named function.yourpluginname.php in the smarty plugins
directory
   2. Define a function named smarty_function_yourpluginname(and parameters
 $params, &$smarty)
   3. Use this plugin from template file same as the other plugins
 
   Lets say our plugin name is "encloseByText". So our function.encloseByText.php file should contain this:

------------------------------------------------------------------------------------------------- 
   <?php
       function smarty_function_encloseByText($params, &$smarty)
       {
          $string = $params['string'];
          $text   = $params['text'];
         
          return $text.$string.$text;
         
       }

   ?>
   ----------------------------------------------------------------------------------
   And our template file will use this plugin as:
   {encloseByText string="InputString" text="delim"}
 
   Output will be : delimInputStringdelim
 
   That's all of creating and using a smarty plugin. This is just an example.
  
   Hope you will enjoy !!
  
  Regards,
  Rupom



 
Join phpResource Group And Enjoy PHPing...


Get amazing travel prices for air and hotel in one click on Yahoo! FareChase

Sun May 7, 2006 9:27 am

rupom_315
Offline Offline
Send Email Send Email

Message #495 of 2794 |
Expand Messages Author Sort by Date

Hi All, Writting own smarty plugins is very easy. In your smarty based applications, you can create own plugins when you want to simplify your logic. Here is a...
Rupom
rupom_315 Offline Send Email
May 7, 2006
9:28 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help