Browse Tag


Setting Aptana to read another file type as PHP

So recently I’ve been following this simple tutorial to learn about creating a simple MVC PHP framework:

It’s so simple that I got a MVC template in less than an hour. But it definitely took me some time to fully understand the code. Luckily I have some experience with WordPress and CakePHP so somehow it wasn’t too long for me. *Trigger proud-mode* 😛

As usual I was using my favorite IDE Aptana but something struck me: I don’t see the PHP color code for the *.tpl files that I have created for the MVC framework. It’s quite annoying and inconvenient.

Turns out it’s actually quite simple to “fix” it.

  1. Just go to Preference (Mac users check the “Aptana Studio 3” menu at the top panel, WIndows and Linux users should check the File or Tool menu)
  2.  Under General -> Editors -> File Associations
  3. Under File Types -> Choose Add, and enter: *.tpl
  4. After added, click on that file type
  5. At the bottom, click Add and choose “PHP Source Editor”.


Now when you reopen all the *.tpl files in Aptana, it will be recognized as PHP files.

Hope this is useful to you. 🙂

Mac osascript pass variable to bash shell

Just wanted to keep this solution found from several sites.

This scripts uses Mac’s osascript to call a simple dialog and asks user for an input. On return, the result will be passed to the bash variable $UserInput.

A very important note here is that the 2nd EOT line must not include any indent or space in front. It will return an error message saying “161:164: execution error: The variable EOT is not defined. (-2753)”. I was searching high and low for the problem and didn’t realize it is so stringent with indent/space.


# Created by Andrews Ang on 6/29/11.

function GetDialog(){

UserInput=`/usr/bin/osascript « EOT

    tell application “System Events”


    set myReply to text returned of (display dialog “Here is a question” default answer “Here is a reply”)

    end tell


    echo ”${UserInput}”