@@ -0,0 +1,208 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PHP Bundle Help</title>
<link rel="stylesheet" href="file:///Applications/TextMate.app/Contents/SharedSupport/Support/themes/default/style.css" type="text/css" charset="utf-8" media="screen">
<link rel="stylesheet" href="../../style.css" type="text/css" charset="utf-8" media="screen">
<link rel="stylesheet" href="file:///Applications/TextMate.app/Contents/SharedSupport/Support/themes/default/print.css" type="text/css" charset="utf-8" media="print">
<link rel="stylesheet" href="../../print.css" type="text/css" charset="utf-8" media="print">
<script src="file:///Applications/TextMate.app/Contents/SharedSupport/Support/script/default.js" type="text/javascript" charset="utf-8"></script>
<script src="file:///Applications/TextMate.app/Contents/SharedSupport/Support/script/webpreview.js" type="text/javascript" charset="utf-8"></script>
<script src="file:///Applications/TextMate.app/Contents/SharedSupport/Support/script/sortable.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="tm_webpreview_body" class="scott">
<div id="tm_webpreview_header">
<img id="gradient" src="../../images/header.png" alt="header">
<p class="headline">PHP Bundle Help</p>
<p class="type">PHP</p>
<img id="teaser" src="../../images/teaser.png" alt="teaser">
<div id="theme_switcher">
<form action="#" onsubmit="return false;">
<div>
Theme:
<select onchange="selectTheme(event);" id="theme_selector">
<option value="bright">Bright</option>
<option value="dark">Dark</option>
<option value="halloween">Halloween</option>
<option value="night">Night</option>
<option selected value="scott">Scott</option>
<option value="shiny">Shiny</option>
</select>
</div>
<script type="text/javascript" charset="utf-8">
document.getElementById('theme_selector').value = 'scott';
</script>
</form>
</div>
</div>
<div id="tm_webpreview_content" class="scott">
<style type="text/css">
.uplink:hover:after {
content: " ⇞";
}
</style>
<script type="text/javascript" charset="utf-8">
function goTo (id) {
document.body.scrollTop = document.getElementById(id).offsetTop - document.images[0].height - 1;
}

function e_sh(string) {
// Backslashes are doubled since we're inside Ruby code
return string.replace(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/g, '\\').replace(/\n/g, "'\n'").replace(/^$/g, "''");
}

function insert_after(new_node, node) {
var parent = node.parentNode;
return node.nextSibling ? parent.insertBefore(new_node, node.nextSibling) : parent.appendChild(new_node);
}

function click_external_link(evt) {
if (!evt.metaKey) return;
evt.preventDefault();
TextMate.system("open " + e_sh(evt.srcElement.href), null);
}

function setup_external_links() {
var link, links = document.links;
for (i = 0; i < links.length; i++) {
link = links[i];
if (link.href.match(/^https?:/)) {
link.title = '⌘-click to open “' + link.href + '” in the default browser.';
link.addEventListener('click', click_external_link, false);
insert_after(document.createTextNode(" ➲"), link);
} else if (link.href.match(/^help:/)) {
link.title = 'Open TextMate help in Help Viewer.';
insert_after(document.createTextNode(" ⓘ"), link);
}
}
}
</script>
<h2 id='sect_0'>Table of Contents</h2>

<ul style='list-style: none'>
<li>1 <a href='javascript:goTo(&quot;sect_1&quot;)'>Language</a></li>
<li>2 <a href='javascript:goTo(&quot;sect_2&quot;)'>Snippets</a>
<ul style='list-style: none'>
<li>2.1 <a href='javascript:goTo(&quot;sect_2.1&quot;)'>Control Structures</a></li>
<li>2.2 <a href='javascript:goTo(&quot;sect_2.2&quot;)'>PHPDoc</a></li>
</ul>
</li>
<li>3 <a href='javascript:goTo(&quot;sect_3&quot;)'>Commands</a>
<ul style='list-style: none'>
<li>3.1 <a href='javascript:goTo(&quot;sect_3.1&quot;)'>Completion</a></li>
<li>3.2 <a href='javascript:goTo(&quot;sect_3.2&quot;)'>Function Reference</a></li>
<li>3.3 <a href='javascript:goTo(&quot;sect_3.3&quot;)'>Drag Commands</a></li>
<li>3.4 <a href='javascript:goTo(&quot;sect_3.4&quot;)'>Project Navigation</a></li>
</ul>
</li>
<li>4 <a href='javascript:goTo(&quot;sect_4&quot;)'>Setup</a>
<ul style='list-style: none'>
<li>4.1 <a href='javascript:goTo(&quot;sect_4.1&quot;)'>PHP Versions</a></li>
<li>4.2 <a href='javascript:goTo(&quot;sect_4.2&quot;)'>Include Path Configuration</a></li>
<li>4.3 <a href='javascript:goTo(&quot;sect_4.3&quot;)'>PHP Manual Location</a></li>
<li>4.4 <a href='javascript:goTo(&quot;sect_4.4&quot;)'>TextMate Support File</a></li>
<li>4.5 <a href='javascript:goTo(&quot;sect_4.5&quot;)'>Short Tags</a></li>
<li>4.6 <a href='javascript:goTo(&quot;sect_4.6&quot;)'>Miscellaneous</a></li>
</ul>
</li>
</ul>

<hr />
<h1><a id='sect_1' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>1 Language</a></h1>
<p><strong>Note</strong>: you should always select the <code>HTML</code> language when working with PHP (and not the <code>PHP</code> language). You can switch language by selecting <code>HTML</code> from the status bar at the bottom of the window, or by pressing <code>⌃⌥⇧H</code>.</p>


<hr />
<h1><a id='sect_2' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>2 Snippets</a></h1>
<h2><a id='sect_2.1' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>2.1 Control Structures</a></h2>
<p>The PHP bundle includes snippets for the common control structures, such as <code>if</code>, <code>while</code>, <code>switch</code> and <code>for</code>, as well as <code>function</code> and <code>class</code> definitions.
These snippets are accessible through a tab trigger for the relevant keyword. <br />
Some snippets are also available in the HTML scope for use in templating using PHP; these will be wrapped in <code>&lt;?php … ?&gt;</code> blocks (See the Short Tags section below for details on how to use short tags instead).</p>

<p>These snippets are designed to conform to the <a href="http://pear.php.net/manual/en/standards.php">PEAR style guide</a>. To summarise:</p>

<ul>
<li>Control structures have a space between the keyword and opening parenthesis and have their opening brace on the same line.</li>
<li>Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter.</li>
<li>Function and class definitions have their brace on the line following the prototype.</li>
</ul>

<h2><a id='sect_2.2' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>2.2 PHPDoc</a></h2>
<p>There are several snippets available for use when writing PHPDoc blocks. See the separate Help command for more information.</p>


<hr />
<h1><a id='sect_3' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>3 Commands</a></h1>
<h2><a id='sect_3.1' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>3.1 Completion</a></h2>
<p>Standard completion for built-in function names is provided by pressing the ⎋ key. <br />
Additionally, completing a built-in function using ⌥⎋ will display a list of available options, and will expand the chosen option into a snippet for the function prototype. <br />
When ⎋ completion is invoked inside of a string following an <code>include</code>/<code>require</code>, the filename will be completed instead. The environment variable <code>PHP_INCLUDE_PATH</code> is used to look for matching files - see &#8220;Include Path Configuration&#8221; below for details on this.</p>

<h2><a id='sect_3.2' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>3.2 Function Reference</a></h2>
<p>There are 2 help commands, both of which work on the current word:</p>

<ul>
<li>Pressing ⌃H will open a browser showing the function definition on the PHP website (or a local file, see <code>PHP Manual Location</code> below).</li>
<li>Pressing ⌥F1 will display a tooltip showing the function prototype and a brief description of its use.</li>
</ul>

<h2><a id='sect_3.3' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>3.3 Drag Commands</a></h2>
<p>Dragging a .php file (from the Project Drawer or Finder, for example) into PHP source will generate an <code>include</code> for that file. <br />
If the environment variable <code>PHP_INCLUDE_PATH</code> is set to your PHP environment&#8217;s <code>include_path</code> directive, it will be searched for the optimal path to the dropped file to include.
You can hold ⌃ when you drop the file to generate a <code>require</code> instead, and you can hold ⌥ to use the <code>_once</code> variant of either method.</p>

<h2><a id='sect_3.4' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>3.4 Project Navigation</a></h2>
<p>The command ⇧⌘D can be used to jump to a file included from the current document. If invoked on a line with an <code>include</code>/<code>require</code> directive, it will search for that file. Otherwise, a menu of all the included files will be displayed. The environment variable <code>PHP_INCLUDE_PATH</code> is searched for the included path as above.</p>


<hr />
<h1><a id='sect_4' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4 Setup</a></h1>
<h2><a id='sect_4.1' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.1 PHP Versions</a></h2>
<p>If you use PHP 5 (rather than PHP 4 which is bundled with OS X) then you’ll want to make sure TextMate is using PHP 5 so that the Validate and Run commands work. To do this you’ll need to have PHP 5 installed – I recommend <a href="http://www.entropy.ch/software/macosx/php/">these packages</a>.</p>

<p>Once PHP is installed, you need to make TextMate use the new PHP binary. You can either replace the default <code>/usr/bin/php</code> with the PHP 5 binary (e.g. with a symlink) or you can set the <code>TM_PHP</code> environment variable to the absolute path to the PHP executable through TextMate → Preferences → Advanced → Shell Variables.</p>

<h2><a id='sect_4.2' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.2 Include Path Configuration</a></h2>
<p>The environment variable <code>PHP_INCLUDE_PATH</code> is used for the 2 commands above. This variable should contain a colon-separated list of directories to scan for PHP include files (as in your PHP configuration). The correct value for this variable can be found either by checking the output of phpInfo() or printing the result of get_include_path(). The best way to set this up is as a <a href="help:anchor='project_dependent_variables'%20bookID='TextMate%20Help'">Project Dependent Variable</a>
– make sure nothing is selected in the project drawer and then press the ⓘ icon to configure these.</p>

<p>See section 9, &#8220;Environment variables&#8221; in the <a href="help:anchor='environment_variables'%20bookID='TextMate%20Help'">TextMate help</a>
for more information on setting environment variables.</p>

<h2><a id='sect_4.3' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.3 PHP Manual Location</a></h2>
<p>If you don&#8217;t have a persistent internet connection (or you just want a quicker response), you can store a local copy of the PHP manual for documentation lookups. You need to download and extract a copy of the “Many HTML files” manual package in your language from <a href="http://www.php.net/download-docs.php">the PHP website</a>. Then set an environment variable <code>PHP_MANUAL_LOCATION</code> to the full path of the extracted files, and your local copy will be used instead of routing to the PHP website.</p>

<h2><a id='sect_4.4' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.4 TextMate Support File</a></h2>
<p>The bundle contains a file with support code that you can include in your project by using the snippet <code>tmphp⇥</code>. This file currently contains 2 things:</p>

<ul>
<li>A function <code>textmate_backtrace</code>() which works just like <code>debug_print_backtrace</code>() but will add a link to jump to files in TextMate</li>
<li><p>JavaScript code which will scan the page for PHP errors and add links to open the relevant file and line in TextMate</p>

<p>There are 3 ways to include this JavaScript:</p>

<ol>
<li>If <code>TEXMATE_ERRORS</code> is define()d before the support file is included then the script tags will automatically be printed at the end of the page. This has the disadvantage that it will invalidate the page source.</li>
<li>You can call <code>textmate_print_error_handler</code>() anywhere in your code to print the JavaScript.</li>
<li>Alternatively, you can use the <code>phperr⇥</code> snippet in HTML to insert the script tags directly into your template.</li>
</ol></li>
</ul>

<h2><a id='sect_4.5' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.5 Short Tags</a></h2>
<p>If you want the various snippets to use short tags, i.e. <code>&lt;? … ?&gt;</code> rather than <code>&lt;?php … ?&gt;</code>, then you can set a shell variable in Preferences (under Advanced):</p>

<ul>
<li>Set <code>TM_PHP_OPEN_TAG</code> to an empty value to use short-tags.</li>
<li>Set <code>TM_PHP_OPEN_TAG_WITH_ECHO</code> to either <code>" echo"</code> (without the quotes) to use short tags, or to <code>=</code> to use the short-form for echo statements.</li>
</ul>

<h2><a id='sect_4.6' href='javascript:goTo(&quot;sect_0&quot;)' style='text-decoration:none' class='uplink'>4.6 Miscellaneous</a></h2>
<p>You may find it preferable to add ‘<code>$</code>’ to the list of word characters recognised by TextMate. To do this, open the TextMate → Preferences… → Text Editing dialog and type a single ‘<code>$</code>’ character in the “Word Characters” text field. With this change, moving by a word with ⌥← and ⌥→ will jump over PHP variables instead of stopping at the ‘<code>$</code>’ symbol.</p>
<script type="text/javascript" charset="utf-8">
setup_external_links();
</script>
</div>
</body>
</html>