If you code in PHP, even if you’re a newcomer to PHP, HTML-Kit Tools makes it easier to use that knowledge to improve the way you use HTML-Kit.
Getting Started
First things first… make sure that PHP is installed on your local system. PHP 5+ is recommended, which you can download from www.php.net. For details on how to install PHP, refer to How to install PHP.
Also make sure that you’re using HTML-Kit Tools 20090406+.
First plugin in PHP
Here are the quick steps:
- Select "File > Insert > Add New Snippet" from HTML-Kit Tools main menu.
- Enter "My first PHP plugin" (or other title) in the "Title" field, and select "PHP" for the "Plugin Language."
- Type the following PHP code in to the "Snippet" field and click "OK" to close the snippet dialog.
<?php echo "Hello, world! It's " . date('h:i A'); ?>
To test your new snippet plugin, create a new document and select "File > Insert > My first PHP plugin" from the main menu.
Caret Action in PHP
Here’s how to manipulate selected text with a PHP plugin:
- Right click inside a document and select "Extra > Edit Caret Actions."
- Click "New" to create a new Caret Action.
- In "Short name" field enter "phpcaretaction1″ (without quotes). Enter "My First PHP Caret Action" in "Title" field. Click "OK" to create the new Caret Action.
- Paste the following code inside newly created action:
#@begin-text "default" [plang="php"] <?php echo strtoupper( $HKit->GetSelText() ); ?> #@end-text "default"
- Click "OK" to save changes.
To test the Caret Action, select some text in the current document and right click while pressing Ctrl key down. Select "My First PHP Caret Action" from the menu.