Updating TextPad for New Document Types

TextPad is a wonderful text editor that has a lot of complex (but unobtrusive) features for developers. The base version supports syntax highlighting for C/C++, HTML and Java, etc. However, it seems that their support for PHP (inside HTML files) is broken. It does not handle PHP scripts very well at all.

You can update TextPad's ability to highlight syntax for various document classes by going here. Unfortunately there are no less than 10 entries on this site that mention "PHP". This is because these files are submitted by users I think.

Here are the steps I undertook to fix PHP support into TextPad:

1) Download the syntax definition file marked "PHP/HTML" (Ok, Here is the download if you insist!)

2) Unzip the contents into the Samples subdirectory inside the TextPad installation folder (mine was C:\Program Files\TextPad 4\Samples)

3) Open TextPad (hopefully it's 4.2 or later!). Go to Configure > Preferences.

4) Expand Document Classes and select HTML.

5) Under Files in Class HTML, select *.php and click the Delete button (red 'X') or alternately press the Delete key. Click "Ok". We are removing PHP files from the HTML class so we can create a new document class.

6) Go to Configure > New Document Class.

7) Enter "PHP" as the Document class name and click "Next"

8) Enter "*.php" for the Class members and click "Next"

9) Click "Enable syntax highlighting" and then choose "php4html.syn" from the Syntax definition file pulldown box. Click Next.

10) Click Finish.

Note, you can go back into Configure > Preferences, expand Document Classes, select the PHP doc class and then tweak some of the PHP options, but I didn't feel a strong need to do this.

Also note that the syntax file you downloaded may even be able to handle HTML files as well, but I didn't bother to change TextPad's doc class for HTML files as it doesn't appear to be broken to me.

Regards,
Jeff

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor, sorry but we need it to help prevent automated submissions.
5 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.