Expert PHP and Smarty Consulting services. 

Contact Marion Consulting for your web development needs.

Home arrow Smarty
Smarty
Shared Hosting Smarty Installation PDF Print E-mail
Written by Marion Consulting   

Basic Implementation of Smarty (PHP Templating Engine) for Shared Hosting.
 
-- These installation instructions with slight modification can be used for any webserver, not just a shared host.  By shared hosting I am assuming that the user doesn't have access to /usr/local/, etc and they don't have the capability of modifying the php.ini.

I've used many shared hosting companies over the years and my preference is BlueHost.com They have reliable service and low cost.
Read more...
Creating Smarty plugins PDF Print E-mail
Written by Marion Consulting   

Plugins are a nice way to extend the functionality of Smarty.  You can create plugins for (functions, modifiers, prefilters, postfilters, and output filters).  This tutorial will cover the creation of a very simple plugin.  Smarty has excellent documentation and already a wealth of plugins available at http://smarty.php.net/contribs/plugins/

This plugin can be used on a live site, but it isn't very useful.  It is only to demonstrate how to create plugins.  Our plugin will take a name and return a message to the user. 

1.)  Name your file function.function_name.php and place it in your plugins directory
          - Ours will be named function.welcome_message.php

2.)  Inside the code you should have a function named the same as your php file
          - function smarty_function_welcome_message($params, &$smarty){

3.)  The body of the function will perform some activity with the parameter (name) that was passed in. 
      In this case output a mesage
          - return 'Hello ' . $params['name'] . ' we are happy that you are visiting our website';}

4.)  Now you need to invoke the plugin from your tpl file
          - {welcome_message name='Marion Consulting'}

5.)  You should receive the following output
          - Hello Marion Consulting we are happy that you are visiting our website

 


Good luck!

 

 

(C) 2010 Marion Consulting - Expert PHP/MYSQL/Smarty consulting services. PHP/MySQL developer Experienced Web developer LAMP (PHP, MySQL) Programmer