Tag Archives: smarty

Using Adobe Dreamweaver to color code modules, zend templates, & other file types

Getting Dreamweaver to open template files

dreamweaver-preferencesAdobe Dreamweaver makes coding easier with it’s color coding and auto-complete features. I use the Zend Framework on many of my projects and I wanted to take advantage of features in Dreamweaver for my template files that have an extension of .tpl that are basically PHP files. Here’s how I added the file type to Dreamweaver.

  • Open Dreamweaver
  • Open Edit>Preferences
  • Select “File Types / Editor”
  • Add .tpl to items in “Open in Code View”
  • Click “OK”

Updating your Dreamweaver Extension File

Open Extensions.txt in the Configuration directory where you installed Dreamweaver. Adobe Dreamweaver default install directory is “/Program Files/Adobe/Adobe Dreamweaver{version}/Configuration”.

Open Extensions.txt with your text editor (notepad). You should see a line towards the top of the files that ends in “:All Documents”. Update this to “,TPL:All Documents”. Note the extension is added in uppercase without a period. Now look for a line that ends with “:PHP Files”. Update this to “,TPL:PHP Files”. Save this file.

Updating your Dreamweaver Document Types

Open “Configuration\DocumentTypes\MMDocumentTypes.xml” in your text editor. Update the documenttype section with the id of “PHP_MySQL”. Add “tpl” to the winfileextension list. Add “tpl” to the macfileextension list. Save this file.

Zend Template files treated as PHP files in Dreamweaver

Open your template files (.tpl) in Adobe Dreamweaver. Now Dreamweaver will treat these files as PHP files and give you the proper color-coding & PHP auto-complete features.

Using this technique with Smarty, Drupal, Zend, & other file types

You can use these same steps to help Dreamweaver understand your other file types. I have other file type associated with PHP in Dreamweaver. I use .phtml files for a template engine and other special extensions for a wide variety of Content Management Systems.

Associating these file types with the right tools has improved my work flow and I hope it helps you. Please feel free to share your tips here.

A Fresh Install of Smarty Template System

What is Smarty?

Smarty is a template engine for PHP. More specifically, it facilitates a manageable way to separate application logic and content from its presentation. This is best described in a situation where the application programmer and the template designer play different roles, or in most cases they are not the same person.


Using Smarty with the Zend Framework

Every Enterprise 2.0 strategy should include a plan for the base code. Our base code should easily support our Web 2.0 needs on our Enterprise 2.0 platform. The Model View Controller structure of the Zend Framework automatically supports a built-in template system. The Framework is flexible enough to plug-in your custom template system or existing systems. Smarty is a very well documented and supported system. The strategy of using Smarty with Zend will provide a solid foundation for our Enterprise 2.0 platform. This is what we define as Strategy 2.0, leveraging the effort of crowds. Thanks to all the dedicated developers at Smarty for keeping our costs down and making our lives easier.

Connecting to Your Server

Connect to your server with a command line tool like PuTTY

PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham.

These steps are executed by super user (su) in your site’s root directory

Install Steps

  1. wget http://www.smarty.net/do_download.php?download_file=Smarty-2.6.20.tar.gz (Note: Check http://www.smarty.net for the latest version.)
  2. tar – zxf Smarty-2.6.20.tar.gz
  3. rm Smarty-2.6.20.tar.gz
  4. mv Smarty-2.6.20/libs /usr/local/lib/php/Smarty
  5. rm -rf Smarty-2.6.20

Install Steps Explained

  1. Get file package from site.wget http://www.smarty.net/do_download.php?download_file=Smarty-2.6.20.tar.gz (Note: Check http://www.smarty.net for the latest version.)
  2. Decompress the file.tar – zxf Smarty-2.6.20.tar.gz
  3. Delete the compressed file.rm Smarty-2.6.20.tar.gz
  4. Move the library files to your standard location.
    This is usually something like “/usr/local/lib/php”, but you may need to check your PHP Include Path to validate your standard location.mv Smarty-2.6.20/libs /usr/local/lib/php/Smarty
  5. Delete the decompressed directory and all it’s contents.rm -rf Smarty-2.6.20