Location: PHPKode > projects > PHP on Trax > johnpipi-trax-f599562/trax/doc/__filesource/fsource_PHPonTrax__vendortraxaction_controller.php.html
<html>
<head>
<title>File Source for action_controller.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">PHPonTrax</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
  		  [ <a href="../classtrees_PHPonTrax.html" class="menu">class tree: PHPonTrax</a> ]
		  [ <a href="../elementindex_PHPonTrax.html" class="menu">index: PHPonTrax</a> ]
		  [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_PHPonTrax.html">PHPonTrax</a><br />
              <a href="../li_PHPonTraxTest.html">PHPonTraxTest</a><br />
            <br /><br />
                  
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file action_controller.php</h1>
<p>Documentation is available at <a href="../PHPonTrax/_vendor_trax_action_controller_php.html">action_controller.php</a></p>
<div class="php">
<div class="listing"><pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>
<li><a name="a2"></a><span class="src-doc">/**</span></li>
<li><a name="a3"></a><span class="src-doc"> *  File containing ActionController class</span></li>
<li><a name="a4"></a><span class="src-doc"> *</span></li>
<li><a name="a5"></a><span class="src-doc"> *  (PHP 5)</span></li>
<li><a name="a6"></a><span class="src-doc"> *</span></li>
<li><a name="a7"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@package</span><span class="src-doc"> PHPonTrax</span></li>
<li><a name="a8"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@version</span><span class="src-doc"> $Id: action_controller.php 198 2006-04-20 16:20:30Z haas $</span></li>
<li><a name="a9"></a><span class="src-doc"> *  </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> (c) 2005 John Peterson</span></li>
<li><a name="a10"></a><span class="src-doc"> *</span></li>
<li><a name="a11"></a><span class="src-doc"> *   Permission is hereby granted, free of charge, to any person obtaining</span></li>
<li><a name="a12"></a><span class="src-doc"> *   a copy of this software and associated documentation files (the</span></li>
<li><a name="a13"></a><span class="src-doc"> *   &quot;Software&quot;), to deal in the Software without restriction, including</span></li>
<li><a name="a14"></a><span class="src-doc"> *   without limitation the rights to use, copy, modify, merge, publish,</span></li>
<li><a name="a15"></a><span class="src-doc"> *   distribute, sublicense, and/or sell copies of the Software, and to</span></li>
<li><a name="a16"></a><span class="src-doc"> *   permit persons to whom the Software is furnished to do so, subject to</span></li>
<li><a name="a17"></a><span class="src-doc"> *   the following conditions:</span></li>
<li><a name="a18"></a><span class="src-doc"> *</span></li>
<li><a name="a19"></a><span class="src-doc"> *   The above copyright notice and this permission notice shall be</span></li>
<li><a name="a20"></a><span class="src-doc"> *   included in all copies or substantial portions of the Software.</span></li>
<li><a name="a21"></a><span class="src-doc"> *</span></li>
<li><a name="a22"></a><span class="src-doc"> *   THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,</span></li>
<li><a name="a23"></a><span class="src-doc"> *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span></li>
<li><a name="a24"></a><span class="src-doc"> *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span></li>
<li><a name="a25"></a><span class="src-doc"> *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE</span></li>
<li><a name="a26"></a><span class="src-doc"> *   LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION</span></li>
<li><a name="a27"></a><span class="src-doc"> *   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION</span></li>
<li><a name="a28"></a><span class="src-doc"> *   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></li>
<li><a name="a29"></a><span class="src-doc"> */</span></li>
<li><a name="a30"></a>&nbsp;</li>
<li><a name="a31"></a><span class="src-doc">/**</span></li>
<li><a name="a32"></a><span class="src-doc"> *  Action controller</span></li>
<li><a name="a33"></a><span class="src-doc"> *</span></li>
<li><a name="a34"></a><span class="src-doc"> *  &lt;p&gt;The ActionController base class operates as follows:&lt;/p&gt;</span></li>
<li><a name="a35"></a><span class="src-doc"> *  &lt;ol&gt;</span></li>
<li><a name="a36"></a><span class="src-doc"> *    &lt;li&gt;Accept a URL as input&lt;/li&gt;</span></li>
<li><a name="a37"></a><span class="src-doc"> *    &lt;li&gt;Translate the URL into a controller and action&lt;/li&gt;</span></li>
<li><a name="a38"></a><span class="src-doc"> *    &lt;li&gt;Create the indicated controller object (which is a subclass</span></li>
<li><a name="a39"></a><span class="src-doc"> *      of ActionController) and call its action method&lt;/li&gt;</span></li>
<li><a name="a40"></a><span class="src-doc"> *    &lt;li&gt;Render the output of the action method&lt;/li&gt;</span></li>
<li><a name="a41"></a><span class="src-doc"> *    &lt;li&gt;Redirect to the next URL&lt;/li&gt;</span></li>
<li><a name="a42"></a><span class="src-doc"> *  &lt;/ol&gt;</span></li>
<li><a name="a43"></a><span class="src-doc"> *</span></li>
<li><a name="a44"></a><span class="src-doc"> *  For details see the</span></li>
<li><a name="a45"></a><span class="src-doc"> *  </span><span class="src-doc-inlinetag">{@tutorial PHPonTrax/ActionController.cls class tutorial}</span></li>
<li><a name="a46"></a><span class="src-doc"> */</span></li>
<li><a name="a47"></a><span class="src-key">class </span><a href="../PHPonTrax/ActionController.html">ActionController</a> <span class="src-sym">{</span></li>
<li><a name="a48"></a>&nbsp;</li>
<li><a name="a49"></a>    <span class="src-doc">/**</span></li>
<li><a name="a50"></a><span class="src-doc">     *  Name of the controller (without the _controller.php)</span></li>
<li><a name="a51"></a><span class="src-doc">     *</span></li>
<li><a name="a52"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span><span class="src-doc"> by parsing the URL and the</span></li>
<li><a name="a53"></a><span class="src-doc">     *  routes in </span><span class="src-doc-inlinetag">{@link routes.php}</span><span class="src-doc">.  The value of this string is set</span></li>
<li><a name="a54"></a><span class="src-doc">     *  before any attempt is made to find the file containing the</span></li>
<li><a name="a55"></a><span class="src-doc">     *  controller.</span></li>
<li><a name="a56"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a57"></a><span class="src-doc">     */</span></li>
<li><a name="a58"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$controller">$controller</a><span class="src-sym">;</span></li>
<li><a name="a59"></a>&nbsp;</li>
<li><a name="a60"></a>    <span class="src-doc">/**</span></li>
<li><a name="a61"></a><span class="src-doc">     *  Name of the action method in the controller class</span></li>
<li><a name="a62"></a><span class="src-doc">     *</span></li>
<li><a name="a63"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a64"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a65"></a><span class="src-doc">     */</span></li>
<li><a name="a66"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$action">$action</a><span class="src-sym">;</span></li>
<li><a name="a67"></a>&nbsp;</li>
<li><a name="a68"></a>    <span class="src-doc">/**</span></li>
<li><a name="a69"></a><span class="src-doc">     *  Value of :id parsed from URL then forced to lower case</span></li>
<li><a name="a70"></a><span class="src-doc">     *</span></li>
<li><a name="a71"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a72"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a73"></a><span class="src-doc">     */</span></li>
<li><a name="a74"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$id">$id</a><span class="src-sym">;</span></li>
<li><a name="a75"></a>&nbsp;</li>
<li><a name="a76"></a>    <span class="src-doc">/**</span></li>
<li><a name="a77"></a><span class="src-doc">     *  Path to add to other filesystem paths</span></li>
<li><a name="a78"></a><span class="src-doc">     *</span></li>
<li><a name="a79"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a80"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a81"></a><span class="src-doc">     */</span></li>
<li><a name="a82"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$added_path">$added_path</a> = <span class="src-str">''</span><span class="src-sym">;</span></li>
<li><a name="a83"></a>     </li>
<li><a name="a84"></a>    <span class="src-doc">/**</span></li>
<li><a name="a85"></a><span class="src-doc">     *  Parameters for the action routine</span></li>
<li><a name="a86"></a><span class="src-doc">     *</span></li>
<li><a name="a87"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span><span class="src-doc">, passed as arguments to the</span></li>
<li><a name="a88"></a><span class="src-doc">     *  controller's action routine.</span></li>
<li><a name="a89"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string[] </span></li>
<li><a name="a90"></a><span class="src-doc">     */</span></li>
<li><a name="a91"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$action_params">$action_params</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a92"></a>&nbsp;</li>
<li><a name="a93"></a>    <span class="src-doc">/**</span></li>
<li><a name="a94"></a><span class="src-doc">     *  Filesystem path to ../app/controllers/ directory</span></li>
<li><a name="a95"></a><span class="src-doc">     *</span></li>
<li><a name="a96"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a97"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a98"></a><span class="src-doc">     */</span></li>
<li><a name="a99"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$controllers_path">$controllers_path</a><span class="src-sym">;</span></li>
<li><a name="a100"></a>&nbsp;</li>
<li><a name="a101"></a>    <span class="src-doc">/**</span></li>
<li><a name="a102"></a><span class="src-doc">     *  Filesystem path to ../app/helpers/&lt;i&gt;extras&lt;/i&gt; directory</span></li>
<li><a name="a103"></a><span class="src-doc">     *</span></li>
<li><a name="a104"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link set_paths()}</span></li>
<li><a name="a105"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a106"></a><span class="src-doc">     */</span></li>
<li><a name="a107"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$helpers_path">$helpers_path</a><span class="src-sym">;</span></li>
<li><a name="a108"></a>&nbsp;</li>
<li><a name="a109"></a>    <span class="src-doc">/**</span></li>
<li><a name="a110"></a><span class="src-doc">     *  Filesystem path to ../app/helpers/ directory</span></li>
<li><a name="a111"></a><span class="src-doc">     *</span></li>
<li><a name="a112"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a113"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a114"></a><span class="src-doc">     */</span></li>
<li><a name="a115"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$helpers_base_path">$helpers_base_path</a><span class="src-sym">;</span></li>
<li><a name="a116"></a>&nbsp;</li>
<li><a name="a117"></a>    <span class="src-doc">/**</span></li>
<li><a name="a118"></a><span class="src-doc">     *  Filesystem path to ../app/views/layouts/&lt;i&gt;extras&lt;/i&gt; directory</span></li>
<li><a name="a119"></a><span class="src-doc">     *</span></li>
<li><a name="a120"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span><span class="src-doc">, </span><span class="src-doc-inlinetag">{@link set_paths()}</span></li>
<li><a name="a121"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a122"></a><span class="src-doc">     */</span></li>
<li><a name="a123"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$layouts_path">$layouts_path</a><span class="src-sym">;</span></li>
<li><a name="a124"></a>&nbsp;</li>
<li><a name="a125"></a>    <span class="src-doc">/**</span></li>
<li><a name="a126"></a><span class="src-doc">     *  Filesystem path to ../app/views/layouts/ directory</span></li>
<li><a name="a127"></a><span class="src-doc">     *</span></li>
<li><a name="a128"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a129"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a130"></a><span class="src-doc">     */</span></li>
<li><a name="a131"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$layouts_base_path">$layouts_base_path</a><span class="src-sym">;</span></li>
<li><a name="a132"></a>&nbsp;</li>
<li><a name="a133"></a>    <span class="src-doc">/**</span></li>
<li><a name="a134"></a><span class="src-doc">     *  User's URL in components</span></li>
<li><a name="a135"></a><span class="src-doc">     *</span></li>
<li><a name="a136"></a><span class="src-doc">     *  Contains user's URL stripped of TRAX_URL_PREFIX and leading</span></li>
<li><a name="a137"></a><span class="src-doc">     *  and trailing slashes, then exploded into an array on slash</span></li>
<li><a name="a138"></a><span class="src-doc">     *  boundaries.</span></li>
<li><a name="a139"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string[] </span></li>
<li><a name="a140"></a><span class="src-doc">     */</span></li>
<li><a name="a141"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$url_path">$url_path</a><span class="src-sym">;</span></li>
<li><a name="a142"></a>&nbsp;</li>
<li><a name="a143"></a>    <span class="src-doc">/**</span></li>
<li><a name="a144"></a><span class="src-doc">     *  Filesystem path to the controllername_helper.php file</span></li>
<li><a name="a145"></a><span class="src-doc">     *</span></li>
<li><a name="a146"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a147"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a148"></a><span class="src-doc">     */</span></li>
<li><a name="a149"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$helper_file">$helper_file</a><span class="src-sym">;</span></li>
<li><a name="a150"></a>&nbsp;</li>
<li><a name="a151"></a>    <span class="src-doc">/**</span></li>
<li><a name="a152"></a><span class="src-doc">     *  Filesystem path to application.php file</span></li>
<li><a name="a153"></a><span class="src-doc">     *</span></li>
<li><a name="a154"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a155"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@see</span><span class="src-doc"> $controller_file</span></li>
<li><a name="a156"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a157"></a><span class="src-doc">     */</span></li>
<li><a name="a158"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$application_controller_file">$application_controller_file</a><span class="src-sym">;</span></li>
<li><a name="a159"></a>&nbsp;</li>
<li><a name="a160"></a>    <span class="src-doc">/**</span></li>
<li><a name="a161"></a><span class="src-doc">     *  Filesystem path to application_helper.php file</span></li>
<li><a name="a162"></a><span class="src-doc">     *</span></li>
<li><a name="a163"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a164"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a165"></a><span class="src-doc">     */</span></li>
<li><a name="a166"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$application_helper_file">$application_helper_file</a><span class="src-sym">;</span></li>
<li><a name="a167"></a>&nbsp;</li>
<li><a name="a168"></a>    <span class="src-doc">/**</span></li>
<li><a name="a169"></a><span class="src-doc">     *  URL recognized, paths resoved, controller file found</span></li>
<li><a name="a170"></a><span class="src-doc">     *</span></li>
<li><a name="a171"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a172"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a173"></a><span class="src-doc">     */</span></li>
<li><a name="a174"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$loaded">$loaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a175"></a>&nbsp;</li>
<li><a name="a176"></a>    <span class="src-doc">/**</span></li>
<li><a name="a177"></a><span class="src-doc">     *  Whether a Router object was loaded</span></li>
<li><a name="a178"></a><span class="src-doc">     *</span></li>
<li><a name="a179"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a180"></a><span class="src-doc">     *   </span><span class="src-doc">&lt;ul&gt;</span></li>
<li><a name="a181"></a><span class="src-doc">     *     &lt;li&gt;true =&gt; $router points to the Router object&lt;/li&gt;</span></li>
<li><a name="a182"></a><span class="src-doc">     *     &lt;li&gt;false =&gt; no Router object exists&lt;/li&gt;</span></li>
<li><a name="a183"></a><span class="src-doc">     *   &lt;/ul&gt;</span></li>
<li><a name="a184"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> &lt;b&gt;FIXME:&lt;/b&gt; No declaration of $router so no place to hang</span></li>
<li><a name="a185"></a><span class="src-doc">     *     its documentation.</span></li>
<li><a name="a186"></a><span class="src-doc">     */</span></li>
<li><a name="a187"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$router_loaded">$router_loaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a188"></a>&nbsp;</li>
<li><a name="a189"></a>    <span class="src-doc">/**</span></li>
<li><a name="a190"></a><span class="src-doc">     *  List of additional helper files for this controller object</span></li>
<li><a name="a191"></a><span class="src-doc">     *</span></li>
<li><a name="a192"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link add_helper()}</span></li>
<li><a name="a193"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string[] </span></li>
<li><a name="a194"></a><span class="src-doc">     */</span></li>
<li><a name="a195"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$helpers">$helpers</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a196"></a>&nbsp;</li>
<li><a name="a197"></a>    <span class="src-doc">/**</span></li>
<li><a name="a198"></a><span class="src-doc">     *  List of filters to execute before calling action method</span></li>
<li><a name="a199"></a><span class="src-doc">     *</span></li>
<li><a name="a200"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link add_before_filters()}</span></li>
<li><a name="a201"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string[] </span></li>
<li><a name="a202"></a><span class="src-doc">     */</span></li>
<li><a name="a203"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$before_filters">$before_filters</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a204"></a>&nbsp;</li>
<li><a name="a205"></a>    <span class="src-doc">/**</span></li>
<li><a name="a206"></a><span class="src-doc">     *  List of filters to execute after calling action method</span></li>
<li><a name="a207"></a><span class="src-doc">     *</span></li>
<li><a name="a208"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link add_after_filters()}</span></li>
<li><a name="a209"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string[] </span></li>
<li><a name="a210"></a><span class="src-doc">     */</span></li>
<li><a name="a211"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$after_filters">$after_filters</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;     </span></li>
<li><a name="a212"></a>&nbsp;</li>
<li><a name="a213"></a>    <span class="src-doc">/**</span></li>
<li><a name="a214"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this attribute</span></li>
<li><a name="a215"></a><span class="src-doc">     */</span></li>
<li><a name="a216"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$render_performed">$render_performed</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a217"></a>&nbsp;</li>
<li><a name="a218"></a>    <span class="src-doc">/**</span></li>
<li><a name="a219"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this attribute</span></li>
<li><a name="a220"></a><span class="src-doc">     */</span></li>
<li><a name="a221"></a>    <span class="src-key">private </span><a href="../PHPonTrax/ActionController.html#var$action_called">$action_called</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a222"></a>&nbsp;</li>
<li><a name="a223"></a>    <span class="src-doc">/**</span></li>
<li><a name="a224"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this attribute</span></li>
<li><a name="a225"></a><span class="src-doc">     */</span></li>
<li><a name="a226"></a>    <span class="src-key">protected </span><a href="../PHPonTrax/ActionController.html#var$before_filter">$before_filter</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a227"></a>&nbsp;</li>
<li><a name="a228"></a>    <span class="src-doc">/**</span></li>
<li><a name="a229"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this attribute</span></li>
<li><a name="a230"></a><span class="src-doc">     */</span></li>
<li><a name="a231"></a>    <span class="src-key">protected </span><a href="../PHPonTrax/ActionController.html#var$after_filter">$after_filter</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a232"></a>&nbsp;</li>
<li><a name="a233"></a>    <span class="src-doc">/**</span></li>
<li><a name="a234"></a><span class="src-doc">     *  Filesystem path to the PHP program file for this controller</span></li>
<li><a name="a235"></a><span class="src-doc">     *</span></li>
<li><a name="a236"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a237"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@see</span><span class="src-doc"> $application_controller_file</span></li>
<li><a name="a238"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a239"></a><span class="src-doc">     */</span></li>
<li><a name="a240"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$controller_file">$controller_file</a><span class="src-sym">;</span></li>
<li><a name="a241"></a>&nbsp;</li>
<li><a name="a242"></a>    <span class="src-doc">/**</span></li>
<li><a name="a243"></a><span class="src-doc">     *  Filesystem path to the view file selected for this action</span></li>
<li><a name="a244"></a><span class="src-doc">     *</span></li>
<li><a name="a245"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link process_route()}</span></li>
<li><a name="a246"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a247"></a><span class="src-doc">     */</span></li>
<li><a name="a248"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$view_file">$view_file</a><span class="src-sym">;</span></li>
<li><a name="a249"></a>&nbsp;</li>
<li><a name="a250"></a>    <span class="src-doc">/**</span></li>
<li><a name="a251"></a><span class="src-doc">     *  Filesystem path to the ../app/views/ directory</span></li>
<li><a name="a252"></a><span class="src-doc">     *</span></li>
<li><a name="a253"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span></li>
<li><a name="a254"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a255"></a><span class="src-doc">     */</span></li>
<li><a name="a256"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$views_path">$views_path</a><span class="src-sym">;</span></li>
<li><a name="a257"></a>&nbsp;</li>
<li><a name="a258"></a>    <span class="src-doc">/**</span></li>
<li><a name="a259"></a><span class="src-doc">     *  Class name of the controller</span></li>
<li><a name="a260"></a><span class="src-doc">     *</span></li>
<li><a name="a261"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link recognize_route()}</span><span class="src-doc">.</span></li>
<li><a name="a262"></a><span class="src-doc">     *  Derived from contents of </span><span class="src-doc-inlinetag">{@link $controller}</span><span class="src-doc">.</span></li>
<li><a name="a263"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a264"></a><span class="src-doc">     */</span></li>
<li><a name="a265"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$controller_class">$controller_class</a><span class="src-sym">;</span></li>
<li><a name="a266"></a>&nbsp;</li>
<li><a name="a267"></a>    <span class="src-doc">/**</span></li>
<li><a name="a268"></a><span class="src-doc">     *  Instance of the controller class</span></li>
<li><a name="a269"></a><span class="src-doc">     *</span></li>
<li><a name="a270"></a><span class="src-doc">     *  Set by </span><span class="src-doc-inlinetag">{@link process_route()}</span></li>
<li><a name="a271"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">object </span></li>
<li><a name="a272"></a><span class="src-doc">     */</span></li>
<li><a name="a273"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$controller_object">$controller_object</a><span class="src-sym">;</span></li>
<li><a name="a274"></a>&nbsp;</li>
<li><a name="a275"></a>    <span class="src-doc">/**</span></li>
<li><a name="a276"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this attribute</span></li>
<li><a name="a277"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> &lt;b&gt;FIXME:&lt;/b&gt; Not referenced in this class - is it used</span></li>
<li><a name="a278"></a><span class="src-doc">     *         by subclasses?  If so, for what?</span></li>
<li><a name="a279"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a280"></a><span class="src-doc">     */</span></li>
<li><a name="a281"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$asset_host">$asset_host</a> = <span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a282"></a>&nbsp;</li>
<li><a name="a283"></a>    <span class="src-doc">/**</span></li>
<li><a name="a284"></a><span class="src-doc">     *  File extension appended to view files</span></li>
<li><a name="a285"></a><span class="src-doc">     *</span></li>
<li><a name="a286"></a><span class="src-doc">     *  Set from a define in </span><span class="src-doc-inlinetag">{@link environment.php}</span><span class="src-doc">.  Usually phtml</span></li>
<li><a name="a287"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">string </span></li>
<li><a name="a288"></a><span class="src-doc">     */</span></li>
<li><a name="a289"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">$views_file_extention</a> = <span class="src-id">TRAX_VIEWS_EXTENTION</span><span class="src-sym">;</span></li>
<li><a name="a290"></a>&nbsp;</li>
<li><a name="a291"></a>    <span class="src-doc">/**</span></li>
<li><a name="a292"></a><span class="src-doc">     *  Render controllers layout</span></li>
<li><a name="a293"></a><span class="src-doc">     *</span></li>
<li><a name="a294"></a><span class="src-doc">     *  Can be overridden in the child controller to false</span></li>
<li><a name="a295"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a296"></a><span class="src-doc">     */</span></li>
<li><a name="a297"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$render_layout">$render_layout</a> = <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a298"></a>    </li>
<li><a name="a299"></a>    <span class="src-doc">/**</span></li>
<li><a name="a300"></a><span class="src-doc">     *  Whether to keep flash message after displaying it</span></li>
<li><a name="a301"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@var </span><span class="src-doc-type">boolean </span></li>
<li><a name="a302"></a><span class="src-doc">     */</span></li>
<li><a name="a303"></a>    <span class="src-key">public </span><a href="../PHPonTrax/ActionController.html#var$keep_flash">$keep_flash</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a304"></a>&nbsp;</li>
<li><a name="a305"></a>    <span class="src-doc">/**</span></li>
<li><a name="a306"></a><span class="src-doc">     *  Build a Router object and load routes from config/route.php</span></li>
<li><a name="a307"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> load_router()</span></li>
<li><a name="a308"></a><span class="src-doc">     */</span></li>
<li><a name="a309"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a310"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router</span><span class="src-sym">) </span>|| <span class="src-sym">!</span><a href="http://www.php.net/is_object">is_object</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a311"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodload_router">load_router</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a312"></a>        <span class="src-sym">}</span></li>
<li><a name="a313"></a>    <span class="src-sym">}</span></li>
<li><a name="a314"></a>&nbsp;</li>
<li><a name="a315"></a>    <span class="src-doc">/**</span></li>
<li><a name="a316"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this method</span></li>
<li><a name="a317"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> add_after_filter()</span></li>
<li><a name="a318"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> add_before_filter()</span></li>
<li><a name="a319"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> add_helper()</span></li>
<li><a name="a320"></a><span class="src-doc">     */</span></li>
<li><a name="a321"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#method__set">__set</a><span class="src-sym">(</span><span class="src-var">$key</span><span class="src-sym">, </span><span class="src-var">$value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a322"></a>        <span class="src-comm">//error_log(&quot;__set($key, $value)&quot;);</span></li>
<li><a name="a323"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$key </span>== <span class="src-str">&quot;before_filter&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a324"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodadd_before_filter">add_before_filter</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a325"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$key </span>== <span class="src-str">&quot;after_filter&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a326"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodadd_after_filter">add_after_filter</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a327"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$key </span>== <span class="src-str">&quot;helper&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a328"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodadd_helper">add_helper</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a329"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$key </span>== <span class="src-str">&quot;render_text&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a330"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_text">render_text</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a331"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$key </span>== <span class="src-str">&quot;redirect_to&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a332"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodredirect_to">redirect_to</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;       </span></li>
<li><a name="a333"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a334"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">$key </span>= <span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a335"></a>        <span class="src-sym">}</span></li>
<li><a name="a336"></a>    <span class="src-sym">}</span></li>
<li><a name="a337"></a>&nbsp;</li>
<li><a name="a338"></a>    <span class="src-doc">/**</span></li>
<li><a name="a339"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> Document this method</span></li>
<li><a name="a340"></a><span class="src-doc">     *   Implement before_filter(), after_filter(), helper()</span></li>
<li><a name="a341"></a><span class="src-doc">     */</span></li>
<li><a name="a342"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#method__call">__call</a><span class="src-sym">(</span><span class="src-var">$method_name</span><span class="src-sym">, </span><span class="src-var">$parameters</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a343"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-var">$method_name</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a344"></a>            <span class="src-comm"># If the method exists, just call it</span></li>
<li><a name="a345"></a>            <span class="src-var">$result </span>= <a href="http://www.php.net/call_user_func">call_user_func</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-var">$method_name</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a346"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{        </span></li>
<li><a name="a347"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$method_name </span>== <span class="src-str">&quot;before_filter&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a348"></a>                <span class="src-var">$result </span>= <a href="http://www.php.net/call_user_func">call_user_func</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'add_before_filter'</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a349"></a>            <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$method_name </span>== <span class="src-str">&quot;after_filter&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a350"></a>                <span class="src-var">$result </span>= <a href="http://www.php.net/call_user_func">call_user_func</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'add_after_filter'</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a351"></a>            <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$method_name </span>== <span class="src-str">&quot;helper&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a352"></a>                <span class="src-var">$result </span>= <a href="http://www.php.net/call_user_func">call_user_func</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-str">'add_helper'</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a353"></a>            <span class="src-sym">} </span></li>
<li><a name="a354"></a>        <span class="src-sym">}</span></li>
<li><a name="a355"></a>        <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a356"></a>    <span class="src-sym">}</span></li>
<li><a name="a357"></a>&nbsp;</li>
<li><a name="a358"></a>    <span class="src-doc">/**</span></li>
<li><a name="a359"></a><span class="src-doc">     *  Load routes from configuration file config/routes.php</span></li>
<li><a name="a360"></a><span class="src-doc">     *</span></li>
<li><a name="a361"></a><span class="src-doc">     *  Routes are loaded by requiring </span><span class="src-doc-inlinetag">{@link routes.php}</span><span class="src-doc"> from the</span></li>
<li><a name="a362"></a><span class="src-doc">     *  configuration directory.  The file routes.php contains</span></li>
<li><a name="a363"></a><span class="src-doc">     *  statements of the form &quot;$router-&gt;connect(path,params);&quot; where</span></li>
<li><a name="a364"></a><span class="src-doc">     *  (path,params) describes the route being added by the</span></li>
<li><a name="a365"></a><span class="src-doc">     *  statement. Route syntax is described in</span></li>
<li><a name="a366"></a><span class="src-doc">     *  </span><span class="src-doc-inlinetag">{@tutorial PHPonTrax/Router.cls the Router class tutorial}</span><span class="src-doc">.</span></li>
<li><a name="a367"></a><span class="src-doc">     *</span></li>
<li><a name="a368"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> Router</span></li>
<li><a name="a369"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $router</span></li>
<li><a name="a370"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $router_loaded</span></li>
<li><a name="a371"></a><span class="src-doc">     */</span></li>
<li><a name="a372"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodload_router">load_router</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a373"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$router_loaded">router_loaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a374"></a>        <span class="src-var">$router </span>= <span class="src-key">new </span><span class="src-id"><a href="../PHPonTrax/Router.html">Router</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a375"></a>&nbsp;</li>
<li><a name="a376"></a>        <span class="src-comm">// Load the routes.</span></li>
<li><a name="a377"></a>        require<span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a></span>.<span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'config'</span><span class="src-sym">]</span>.<span class="src-str">&quot;/routes.php&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a378"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router </span>= <span class="src-var">$router</span><span class="src-sym">;</span></li>
<li><a name="a379"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_object">is_object</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a380"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$router_loaded">router_loaded</a> = <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a381"></a>        <span class="src-sym">}</span></li>
<li><a name="a382"></a>    <span class="src-sym">}</span></li>
<li><a name="a383"></a>&nbsp;</li>
<li><a name="a384"></a>    <span class="src-doc">/**</span></li>
<li><a name="a385"></a><span class="src-doc">     *  Convert URL to controller, action and id</span></li>
<li><a name="a386"></a><span class="src-doc">     *</span></li>
<li><a name="a387"></a><span class="src-doc">     *  Parse the URL in</span></li>
<li><a name="a388"></a><span class="src-doc">     *  </span><span class="src-doc-inlinetag">{@link }</span></li>
<li><a name="a389"></a><span class="src-doc">     *  http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server $_SERVER}['REDIRECT_URL']</span></li>
<li><a name="a390"></a><span class="src-doc">     *  into elements.</span></li>
<li><a name="a391"></a><span class="src-doc">     *  Compute filesystem paths to the various components used by the</span></li>
<li><a name="a392"></a><span class="src-doc">     *  URL and store the paths in object private variables.</span></li>
<li><a name="a393"></a><span class="src-doc">     *  Verify that the controller exists.</span></li>
<li><a name="a394"></a><span class="src-doc">     *</span></li>
<li><a name="a395"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> load_router()</span></li>
<li><a name="a396"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $action</span></li>
<li><a name="a397"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $action_params</span></li>
<li><a name="a398"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $application_controller_file</span></li>
<li><a name="a399"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller</span></li>
<li><a name="a400"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_class</span></li>
<li><a name="a401"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_file</span></li>
<li><a name="a402"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controllers_path</span></li>
<li><a name="a403"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helper_file</span></li>
<li><a name="a404"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helpers_path</span></li>
<li><a name="a405"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $id</span></li>
<li><a name="a406"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $layouts_path</span></li>
<li><a name="a407"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $loaded</span></li>
<li><a name="a408"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $router</span></li>
<li><a name="a409"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $router_loaded</span></li>
<li><a name="a410"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> set_paths()</span></li>
<li><a name="a411"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $url_path</span></li>
<li><a name="a412"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $views_file_extention</span></li>
<li><a name="a413"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $views_path</span></li>
<li><a name="a414"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span></li>
<li><a name="a415"></a><span class="src-doc">     *   &lt;ul&gt;</span></li>
<li><a name="a416"></a><span class="src-doc">     *     &lt;li&gt;true =&gt;  route recognized, controller found.&lt;/li&gt;</span></li>
<li><a name="a417"></a><span class="src-doc">     *     &lt;li&gt;false =&gt; failed, route not recognized.&lt;/li&gt;</span></li>
<li><a name="a418"></a><span class="src-doc">     *   &lt;/ul&gt;</span></li>
<li><a name="a419"></a><span class="src-doc">     */</span></li>
<li><a name="a420"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrecognize_route">recognize_route</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a421"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$router_loaded">router_loaded</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a422"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodload_router">load_router</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a423"></a>        <span class="src-sym">}</span></li>
<li><a name="a424"></a>&nbsp;</li>
<li><a name="a425"></a>        <span class="src-comm"># current url</span></li>
<li><a name="a426"></a>        <span class="src-var">$browser_url </span>= <span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'REDIRECT_URL'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a427"></a>        <span class="src-comm">#if(strstr($_SERVER['REQUEST_URI'], &quot;?&quot;))</span></li>
<li><a name="a428"></a>        <span class="src-comm">#    $browser_url = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], &quot;?&quot;));</span></li>
<li><a name="a429"></a>        <span class="src-comm">#else</span></li>
<li><a name="a430"></a>        <span class="src-comm">#    $browser_url = $_SERVER['REQUEST_URI'];    </span></li>
<li><a name="a431"></a>        </li>
<li><a name="a432"></a>        <span class="src-comm">//error_log('browser url='.$browser_url);</span></li>
<li><a name="a433"></a>        <span class="src-comm"># strip off url prefix, if any</span></li>
<li><a name="a434"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_URL_PREFIX">TRAX_URL_PREFIX</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a435"></a>            <span class="src-var">$browser_url </span>= <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_URL_PREFIX">TRAX_URL_PREFIX</a></span><span class="src-sym">,</span><span class="src-str">&quot;&quot;</span><span class="src-sym">,</span><span class="src-var">$browser_url</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a436"></a>        <span class="src-sym">}</span></li>
<li><a name="a437"></a>&nbsp;</li>
<li><a name="a438"></a>        <span class="src-comm"># strip leading slash</span></li>
<li><a name="a439"></a>        <span class="src-comm">// FIXME: Do we know for sure that the</span></li>
<li><a name="a440"></a>        <span class="src-comm">// initial '/' will be there?</span></li>
<li><a name="a441"></a>        <span class="src-var">$browser_url </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$browser_url</span><span class="src-sym">,</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a442"></a>&nbsp;</li>
<li><a name="a443"></a>        <span class="src-comm"># strip trailing slash (if any)</span></li>
<li><a name="a444"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$browser_url</span><span class="src-sym">, </span>-<span class="src-num">1</span><span class="src-sym">) </span>== <span class="src-str">&quot;/&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a445"></a>            <span class="src-var">$browser_url </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$browser_url</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span>-<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a446"></a>        <span class="src-sym">}</span></li>
<li><a name="a447"></a>&nbsp;</li>
<li><a name="a448"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$browser_url</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a449"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a> = <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">&quot;/&quot;</span><span class="src-sym">, </span><span class="src-var">$browser_url</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a450"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a451"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a> = <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a452"></a>        <span class="src-sym">}</span></li>
<li><a name="a453"></a>&nbsp;</li>
<li><a name="a454"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router</span><span class="src-sym">-&gt;</span><span class="src-id">routes_count </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a455"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controllers_path">controllers_path</a> = <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a> </span>. <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'controllers'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a456"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_path">helpers_path</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_base_path">helpers_base_path</a> = <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a> </span>. <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'helpers'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a457"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_controller_file">application_controller_file</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controllers_path">controllers_path</a> . <span class="src-str">&quot;/application.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a458"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_helper_file">application_helper_file</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_path">helpers_path</a> . <span class="src-str">&quot;/application_helper.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a459"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$layouts_path">layouts_path</a> = <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a> </span>. <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'layouts'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a460"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a> = <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a> </span>. <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'views'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a461"></a>&nbsp;</li>
<li><a name="a462"></a>            <span class="src-var">$route </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">router</span><span class="src-sym">-&gt;</span><span class="src-id">find_route</span><span class="src-sym">(</span><span class="src-var">$browser_url</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a463"></a>&nbsp;</li>
<li><a name="a464"></a>            <span class="src-comm">//  find_route() returns an array if it finds a path that</span></li>
<li><a name="a465"></a>            <span class="src-comm">//  matches the URL, null if no match found</span></li>
<li><a name="a466"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$route</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a467"></a>&nbsp;</li>
<li><a name="a468"></a>                <span class="src-comm">//  Matching route found.  Try to get</span></li>
<li><a name="a469"></a>                <span class="src-comm">//  controller and action from route and URL</span></li>
<li><a name="a470"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodset_paths">set_paths</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a471"></a>                <span class="src-var">$route_path </span>= <a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">&quot;/&quot;</span><span class="src-sym">,</span><span class="src-var">$route</span><span class="src-sym">[</span><span class="src-str">'path'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a472"></a>                <span class="src-var">$route_params </span>= <span class="src-var">$route</span><span class="src-sym">[</span><span class="src-str">'params'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a473"></a>&nbsp;</li>
<li><a name="a474"></a>                <span class="src-comm">//  Find the controller from the route and URL</span></li>
<li><a name="a475"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$route_params</span><span class="src-sym">)</span></li>
<li><a name="a476"></a>                   &amp;&amp; <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">&quot;:controller&quot;</span><span class="src-sym">,</span><span class="src-var">$route_params</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a477"></a>&nbsp;</li>
<li><a name="a478"></a>                    <span class="src-comm">//  ':controller' in route params overrides URL</span></li>
<li><a name="a479"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a> = <span class="src-var">$route_params</span><span class="src-sym">[</span><span class="src-str">&quot;:controller&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a480"></a>                <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$route_path</span><span class="src-sym">)</span></li>
<li><a name="a481"></a>                         &amp;&amp; <a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">&quot;:controller&quot;</span><span class="src-sym">,</span><span class="src-var">$route_path</span><span class="src-sym">)</span></li>
<li><a name="a482"></a>                         &amp;&amp; <span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">)</span>&gt;<span class="src-num">0</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a483"></a>&nbsp;</li>
<li><a name="a484"></a>                    <span class="src-comm">//  Set controller from URL if that field exists</span></li>
<li><a name="a485"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a> = <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">[</span><a href="http://www.php.net/array_search">array_search</a><span class="src-sym">(</span><span class="src-str">&quot;:controller&quot;</span><span class="src-sym">, </span><span class="src-var">$route_path</span><span class="src-sym">)</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a486"></a>                <span class="src-sym">}</span></li>
<li><a name="a487"></a>                <span class="src-comm">//error_log('controller='.$this-&gt;controller);</span></li>
<li><a name="a488"></a>&nbsp;</li>
<li><a name="a489"></a>                <span class="src-comm">//  Find the action from the route and URL</span></li>
<li><a name="a490"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$route_params</span><span class="src-sym">)</span></li>
<li><a name="a491"></a>                   &amp;&amp; <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">&quot;:action&quot;</span><span class="src-sym">,</span><span class="src-var">$route_params</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a492"></a>&nbsp;</li>
<li><a name="a493"></a>                    <span class="src-comm">//  ':action' in route params overrides URL</span></li>
<li><a name="a494"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a> = <span class="src-var">$route_params</span><span class="src-sym">[</span><span class="src-str">':action'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a495"></a>                <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$route_path</span><span class="src-sym">)</span></li>
<li><a name="a496"></a>                         &amp;&amp; <a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">&quot;:action&quot;</span><span class="src-sym">,</span><span class="src-var">$route_path</span><span class="src-sym">)</span></li>
<li><a name="a497"></a>                         &amp;&amp; <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/array_search">array_search</a><span class="src-sym">(</span><span class="src-str">&quot;:action&quot;</span><span class="src-sym">,</span></li>
<li><a name="a498"></a>                                                           <span class="src-var">$route_path</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a499"></a>                                             <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a500"></a>&nbsp;</li>
<li><a name="a501"></a>                    <span class="src-comm">//  Get action from URL if that field exists</span></li>
<li><a name="a502"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a> = <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">[</span><span class="src-sym">@</span><a href="http://www.php.net/array_search">array_search</a><span class="src-sym">(</span><span class="src-str">&quot;:action&quot;</span><span class="src-sym">, </span><span class="src-var">$route_path</span><span class="src-sym">)</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a503"></a>                <span class="src-sym">}</span></li>
<li><a name="a504"></a>                <span class="src-comm">//error_log('action='.$this-&gt;action);</span></li>
<li><a name="a505"></a>                <span class="src-comm">//  FIXME: RoR uses :name as a keyword parameter, id</span></li>
<li><a name="a506"></a>                <span class="src-comm">//  is not treated as a special case.</span></li>
<li><a name="a507"></a>                <span class="src-comm">//  Do we want to do the same?</span></li>
<li><a name="a508"></a>                <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-str">&quot;:id&quot;</span><span class="src-sym">,</span><span class="src-var">$route_path</span><span class="src-sym">)</span></li>
<li><a name="a509"></a>                   &amp;&amp; <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-sym">@</span><a href="http://www.php.net/array_search">array_search</a><span class="src-sym">(</span><span class="src-str">&quot;:id&quot;</span><span class="src-sym">, </span><span class="src-var">$route_path</span><span class="src-sym">)</span><span class="src-sym">,</span></li>
<li><a name="a510"></a>                                       <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a511"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$id">id</a> = <a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">[</span><span class="src-sym">@</span><a href="http://www.php.net/array_search">array_search</a><span class="src-sym">(</span><span class="src-str">&quot;:id&quot;</span><span class="src-sym">, </span><span class="src-var">$route_path</span><span class="src-sym">)</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a512"></a>                    <span class="src-comm">//  Parameters for the action routine.</span></li>
<li><a name="a513"></a>                    <span class="src-comm">//  FIXME: make more general than just id</span></li>
<li><a name="a514"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$id">id</a> != <span class="src-str">&quot;&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a515"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action_params">action_params</a><span class="src-sym">[</span><span class="src-str">'id'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$id">id</a><span class="src-sym">;</span></li>
<li><a name="a516"></a>                    <span class="src-sym">}</span></li>
<li><a name="a517"></a>                    <span class="src-comm">//  For historical reasons, continue to pass id</span></li>
<li><a name="a518"></a>                    <span class="src-comm">//  in $_REQUEST</span></li>
<li><a name="a519"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$id">id</a> != <span class="src-str">&quot;&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a520"></a>                        <span class="src-var">$_REQUEST</span><span class="src-sym">[</span><span class="src-str">'id'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$id">id</a><span class="src-sym">;</span></li>
<li><a name="a521"></a>                    <span class="src-sym">}</span></li>
<li><a name="a522"></a>                <span class="src-sym">}</span></li>
<li><a name="a523"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a> .= <span class="src-str">&quot;/&quot; </span>. <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-sym">;</span></li>
<li><a name="a524"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_file">controller_file</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controllers_path">controllers_path</a> . <span class="src-str">&quot;/&quot; </span>.  <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a> . <span class="src-str">&quot;_controller.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a525"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_class">controller_class</a> = <span class="src-id"><a href="../PHPonTrax/Inflector.html">Inflector</a></span><span class="src-sym">::</span><a href="../PHPonTrax/Inflector.html#methodcamelize">camelize</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-sym">) </span>. <span class="src-str">&quot;Controller&quot;</span><span class="src-sym">;</span></li>
<li><a name="a526"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helper_file">helper_file</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_path">helpers_path</a> . <span class="src-str">&quot;/&quot; </span>.  <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a> . <span class="src-str">&quot;_helper.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a527"></a>            <span class="src-sym">}</span></li>
<li><a name="a528"></a>        <span class="src-sym">}</span></li>
<li><a name="a529"></a>&nbsp;</li>
<li><a name="a530"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_file">controller_file</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a531"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$loaded">loaded</a> = <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a532"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a533"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a534"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$loaded">loaded</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a535"></a>            <span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a536"></a>        <span class="src-sym">}</span></li>
<li><a name="a537"></a>    <span class="src-sym">}</span></li>
<li><a name="a538"></a>&nbsp;</li>
<li><a name="a539"></a>    <span class="src-doc">/**</span></li>
<li><a name="a540"></a><span class="src-doc">     *  Parse URL, extract controller and action and execute them</span></li>
<li><a name="a541"></a><span class="src-doc">     *</span></li>
<li><a name="a542"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $action</span></li>
<li><a name="a543"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $action_params</span></li>
<li><a name="a544"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $application_controller_file</span></li>
<li><a name="a545"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $application_helper_file</span></li>
<li><a name="a546"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller</span></li>
<li><a name="a547"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_class</span></li>
<li><a name="a548"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_file</span></li>
<li><a name="a549"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_object</span></li>
<li><a name="a550"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> determine_layout()</span></li>
<li><a name="a551"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> execute_after_filters()</span></li>
<li><a name="a552"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helpers</span></li>
<li><a name="a553"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helper_file</span></li>
<li><a name="a554"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helpers_base_path</span></li>
<li><a name="a555"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $keep_flash</span></li>
<li><a name="a556"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $loaded</span></li>
<li><a name="a557"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> recognize_route()</span></li>
<li><a name="a558"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> raise()</span></li>
<li><a name="a559"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> ScaffoldController</span></li>
<li><a name="a560"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> Session::unset_var()</span></li>
<li><a name="a561"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $view_file</span></li>
<li><a name="a562"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $views_file_extention</span></li>
<li><a name="a563"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $views_path</span></li>
<li><a name="a564"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">boolean </span><span class="src-doc">true</span></li>
<li><a name="a565"></a><span class="src-doc">     */</span></li>
<li><a name="a566"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodprocess_route">process_route</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a567"></a>   </li>
<li><a name="a568"></a>        <span class="src-comm"># First try to load the routes and setup the paths to everything</span></li>
<li><a name="a569"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$loaded">loaded</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a570"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrecognize_route">recognize_route</a><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a571"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-str">&quot;Failed to load any defined routes&quot;</span><span class="src-sym">,</span></li>
<li><a name="a572"></a>                 <span class="src-str">&quot;Controller &quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a>.<span class="src-str">&quot; not found&quot;</span><span class="src-sym">,</span></li>
<li><a name="a573"></a>                 <span class="src-str">&quot;404&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a574"></a>            <span class="src-sym">}</span></li>
<li><a name="a575"></a>        <span class="src-sym">}</span></li>
<li><a name="a576"></a>        <span class="src-comm">//error_log('process_route(): controller=&quot;'.$this-&gt;controller</span></li>
<li><a name="a577"></a>        <span class="src-comm">//          .'&quot;  action=&quot;'.$this-&gt;action.'&quot;  id=&quot;'.$this-&gt;id.'&quot;');</span></li>
<li><a name="a578"></a>&nbsp;</li>
<li><a name="a579"></a>        <span class="src-comm"># Include main application controller file</span></li>
<li><a name="a580"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_controller_file">application_controller_file</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a581"></a>            <span class="src-inc">include_once</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_controller_file">application_controller_file</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a582"></a>        <span class="src-sym">}</span></li>
<li><a name="a583"></a>&nbsp;</li>
<li><a name="a584"></a>        <span class="src-comm"># If controller is loaded then start processing           </span></li>
<li><a name="a585"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$loaded">loaded</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a586"></a>            </li>
<li><a name="a587"></a>            <span class="src-inc">include_once</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_file">controller_file</a><span class="src-sym">)</span><span class="src-sym">;            </span></li>
<li><a name="a588"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/class_exists">class_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_class">controller_class</a><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a589"></a>                </li>
<li><a name="a590"></a>                <span class="src-var">$class </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_class">controller_class</a><span class="src-sym">;</span></li>
<li><a name="a591"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a> = <span class="src-key">new </span><span class="src-var">$class</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a592"></a>                </li>
<li><a name="a593"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_object">is_object</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a594"></a>                   </li>
<li><a name="a595"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">controller </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-sym">;</span></li>
<li><a name="a596"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">action </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">;</span></li>
<li><a name="a597"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">controller_path </span>= <span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$added_path">added_path</a>/<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-str">"</span></span><span class="src-sym">;</span></li>
<li><a name="a598"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">views_path </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a><span class="src-sym">;</span></li>
<li><a name="a599"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">layouts_path </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$layouts_path">layouts_path</a><span class="src-sym">;</span></li>
<li><a name="a600"></a>                    <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'current_controller_path'</span><span class="src-sym">] </span>= <span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$added_path">added_path</a>/<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-str">"</span></span><span class="src-sym">;</span></li>
<li><a name="a601"></a>                    <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'current_controller_name'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-sym">;</span></li>
<li><a name="a602"></a>                    <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'current_action_name'</span><span class="src-sym">] </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">;</span></li>
<li><a name="a603"></a>                    <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'current_controller_object'</span><span class="src-sym">] </span>=<span class="src-sym">&amp; </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">;</span></li>
<li><a name="a604"></a>                    <span class="src-comm"># Which layout should we use?</span></li>
<li><a name="a605"></a>                    <span class="src-var">$layout_file </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">determine_layout</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a606"></a>                    <span class="src-comm">//error_log('using layout_file &quot;'.$layout_file.'&quot;');</span></li>
<li><a name="a607"></a>                    <span class="src-comm"># Check if there is any defined scaffolding to load</span></li>
<li><a name="a608"></a>                    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">scaffold</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a609"></a>                        <span class="src-var">$scaffold </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">scaffold</span><span class="src-sym">;</span></li>
<li><a name="a610"></a>                        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a></span>.<span class="src-str">&quot;/scaffold_controller.php&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a611"></a>                            <span class="src-inc">include_once</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a></span>.<span class="src-str">&quot;/scaffold_controller.php&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a612"></a>                            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a> = <span class="src-key">new </span><span class="src-id"><a href="../PHPonTrax/ScaffoldController.html">ScaffoldController</a></span><span class="src-sym">(</span><span class="src-var">$scaffold</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a613"></a>                            <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'current_controller_object'</span><span class="src-sym">] </span>=<span class="src-sym">&amp; </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">;</span></li>
<li><a name="a614"></a>                            <span class="src-var">$render_options</span><span class="src-sym">[</span><span class="src-str">'scaffold'</span><span class="src-sym">] </span>= <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a615"></a>                            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$layout_file</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a616"></a>                                <span class="src-comm"># the generic scaffold layout</span></li>
<li><a name="a617"></a>                                <span class="src-var">$layout_file </span>= <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a> </span>. <span class="src-str">&quot;/templates/scaffolds/layout.phtml&quot;</span><span class="src-sym">;</span></li>
<li><a name="a618"></a>                            <span class="src-sym">}</span></li>
<li><a name="a619"></a>                        <span class="src-sym">}</span></li>
<li><a name="a620"></a>                    <span class="src-sym">}</span></li>
<li><a name="a621"></a>                <span class="src-sym">}                </span></li>
<li><a name="a622"></a>            <span class="src-sym">}</span></li>
<li><a name="a623"></a>&nbsp;</li>
<li><a name="a624"></a>            <span class="src-comm"># Include main application helper file</span></li>
<li><a name="a625"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_helper_file">application_helper_file</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a626"></a>                <span class="src-inc">include_once</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$application_helper_file">application_helper_file</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a627"></a>            <span class="src-sym">}</span></li>
<li><a name="a628"></a>&nbsp;</li>
<li><a name="a629"></a>            <span class="src-comm"># Include helper file for this controller</span></li>
<li><a name="a630"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helper_file">helper_file</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a631"></a>                <span class="src-inc">include_once</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helper_file">helper_file</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a632"></a>            <span class="src-sym">}</span></li>
<li><a name="a633"></a>            </li>
<li><a name="a634"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_object">is_object</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a635"></a>&nbsp;</li>
<li><a name="a636"></a>                <span class="src-comm"># Include any extra helper files defined in this controller</span></li>
<li><a name="a637"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">helpers</span><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a638"></a>                    <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">helpers </span><span class="src-key">as </span><span class="src-var">$helper</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a639"></a>                        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strstr">strstr</a><span class="src-sym">(</span><span class="src-var">$helper</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a640"></a>                            <span class="src-var">$file </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strrchr">strrchr</a><span class="src-sym">(</span><span class="src-var">$helper</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a641"></a>                            <span class="src-var">$path </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$helper</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><a href="http://www.php.net/strripos">strripos</a><span class="src-sym">(</span><span class="src-var">$helper</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a642"></a>                            <span class="src-var">$helper_path_with_file </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_base_path">helpers_base_path</a>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$path</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$file</span>.<span class="src-str">&quot;_helper.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a643"></a>                        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a644"></a>                            <span class="src-var">$helper_path_with_file </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_base_path">helpers_base_path</a>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$helper</span>.<span class="src-str">&quot;_helper.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a645"></a>                        <span class="src-sym">}</span></li>
<li><a name="a646"></a>&nbsp;</li>
<li><a name="a647"></a>                        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$helper_path_with_file</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a648"></a>                            <span class="src-comm"># Include the helper file</span></li>
<li><a name="a649"></a>                            <span class="src-inc">include</span><span class="src-sym">(</span><span class="src-var">$helper_path_with_file</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a650"></a>                        <span class="src-sym">}</span></li>
<li><a name="a651"></a>                    <span class="src-sym">}</span></li>
<li><a name="a652"></a>                <span class="src-sym">}</span></li>
<li><a name="a653"></a>&nbsp;</li>
<li><a name="a654"></a>                <span class="src-comm"># Suppress output</span></li>
<li><a name="a655"></a>                <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a656"></a>                <span class="src-comm">//error_log('started capturing HTML');</span></li>
<li><a name="a657"></a>                </li>
<li><a name="a658"></a>                <span class="src-comm"># Call the controller method based on the URL</span></li>
<li><a name="a659"></a>                <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">execute_before_filters</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a660"></a>                   </li>
<li><a name="a661"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a662"></a>                        <span class="src-comm">//error_log('method '.$this-&gt;action.' exists, calling it');</span></li>
<li><a name="a663"></a>                        <span class="src-var">$action </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">;</span></li>
<li><a name="a664"></a>                        <span class="src-comm">//error_log('calling action routine '</span></li>
<li><a name="a665"></a>                        <span class="src-comm">//          . get_class($this-&gt;controller_object)</span></li>
<li><a name="a666"></a>                        <span class="src-comm">//          .'::'.$action.'() with params '</span></li>
<li><a name="a667"></a>                        <span class="src-comm">//          .var_export($this-&gt;action_params,true));</span></li>
<li><a name="a668"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-var">$action</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action_params">action_params</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a669"></a>                    <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a> . <span class="src-str">&quot;/&quot; </span>. <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a> . <span class="src-str">&quot;.&quot; </span>. <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a670"></a>                        <span class="src-comm">//error_log('views file &quot;'.$this-&gt;action.'&quot;');</span></li>
<li><a name="a671"></a>                        <span class="src-var">$action </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">;</span></li>
<li><a name="a672"></a>                    <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">, </span><span class="src-str">&quot;index&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a673"></a>                        <span class="src-comm">//error_log('calling action routine '</span></li>
<li><a name="a674"></a>                        <span class="src-comm">//          . get_class($this-&gt;controller_object)</span></li>
<li><a name="a675"></a>                        <span class="src-comm">//          .'::index() with params '</span></li>
<li><a name="a676"></a>                        <span class="src-comm">//          .var_export($this-&gt;action_params,true));</span></li>
<li><a name="a677"></a>                        <span class="src-var">$action </span>= <span class="src-str">&quot;index&quot;</span><span class="src-sym">;</span></li>
<li><a name="a678"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">index</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action_params">action_params</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a679"></a>                    <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a680"></a>                        <span class="src-comm">//error_log('no action');</span></li>
<li><a name="a681"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-str">&quot;No action responded to &quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action">action</a><span class="src-sym">, </span><span class="src-str">&quot;Unknown action&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;404&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a682"></a>                    <span class="src-sym">}</span></li>
<li><a name="a683"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">execute_after_filters</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a684"></a>                    </li>
<li><a name="a685"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">action_called </span>= <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a686"></a>                    </li>
<li><a name="a687"></a>                    <span class="src-comm"># Find out if there was a redirect to some other page</span></li>
<li><a name="a688"></a>                    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">redirect_to</span><span class="src-sym">)</span></li>
<li><a name="a689"></a>                        &amp;&amp; <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">redirect_to </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a690"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodredirect_to">redirect_to</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">redirect_to</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a691"></a>                        <span class="src-comm"># execution will end here redirecting to new page</span></li>
<li><a name="a692"></a>                    <span class="src-sym">} </span></li>
<li><a name="a693"></a>                    </li>
<li><a name="a694"></a>                    <span class="src-comm"># If render_text was defined as a string render it                    </span></li>
<li><a name="a695"></a>                    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_text</span><span class="src-sym">)</span></li>
<li><a name="a696"></a>                       &amp;&amp; <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_text </span>!= <span class="src-str">&quot;&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a697"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_text">render_text</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_text</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a698"></a>                        <span class="src-comm"># execution will end here rendering only the text no layout</span></li>
<li><a name="a699"></a>                    <span class="src-sym">} </span></li>
<li><a name="a700"></a>                                    </li>
<li><a name="a701"></a>                    <span class="src-comm"># If defined string render_action use that instead</span></li>
<li><a name="a702"></a>                    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_action</span><span class="src-sym">)</span></li>
<li><a name="a703"></a>                       &amp;&amp; <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_action </span>!= <span class="src-str">''</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a704"></a>                        <span class="src-var">$action </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_action</span><span class="src-sym">;</span></li>
<li><a name="a705"></a>                    <span class="src-sym">}  </span></li>
<li><a name="a706"></a>                    </li>
<li><a name="a707"></a>                    <span class="src-comm"># Render the action / view                      </span></li>
<li><a name="a708"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_action</span><span class="src-sym">(</span><span class="src-var">$action</span><span class="src-sym">,</span></li>
<li><a name="a709"></a>                          isset<span class="src-sym">(</span><span class="src-var">$render_options</span><span class="src-sym">) </span>? <span class="src-var">$render_options </span>: <span class="src-id">null </span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a710"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">No</span> <span class="src-id">view</span> <span class="src-id">file</span> <span class="src-id">found</span> <span class="src-var">$action</span> (<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$view_file">view_file</a>).</span><span class="src-str">&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;Unknown view&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;404&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a711"></a>                    <span class="src-sym">}</span></li>
<li><a name="a712"></a>                    <span class="src-comm"># Grab all the html from the view to put into the layout</span></li>
<li><a name="a713"></a>                    <span class="src-var">$content_for_layout </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a714"></a>                    <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a715"></a>                    <span class="src-comm">//error_log(&quot;captured &quot;.strlen($content_for_layout).&quot; bytes\n&quot;);</span></li>
<li><a name="a716"></a>                    <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_layout</span><span class="src-sym">)</span></li>
<li><a name="a717"></a>                       &amp;&amp; <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_layout </span>!== <span class="src-id">false</span><span class="src-sym">)</span></li>
<li><a name="a718"></a>                       &amp;&amp; <span class="src-var">$layout_file</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a719"></a>                        <span class="src-var">$locals</span><span class="src-sym">[</span><span class="src-str">'content_for_layout'</span><span class="src-sym">] </span>= <span class="src-var">$content_for_layout</span><span class="src-sym">;</span></li>
<li><a name="a720"></a>                        <span class="src-comm"># render the layout</span></li>
<li><a name="a721"></a>                        <span class="src-comm">//error_log(&quot;rendering layout: $layout_file&quot;);</span></li>
<li><a name="a722"></a>                        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller_object">controller_object</a><span class="src-sym">-&gt;</span><span class="src-id">render_file</span><span class="src-sym">(</span><span class="src-var">$layout_file</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a723"></a>                            <span class="src-comm"># No layout template so just echo out whatever is in $content_for_layout</span></li>
<li><a name="a724"></a>                            echo <span class="src-str">&quot;HERE&quot;</span><span class="src-sym">;</span></li>
<li><a name="a725"></a>                            echo <span class="src-var">$content_for_layout</span><span class="src-sym">;        </span></li>
<li><a name="a726"></a>                        <span class="src-sym">}</span></li>
<li><a name="a727"></a>                    <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a728"></a>                        <span class="src-comm"># Can't find any layout so throw an exception</span></li>
<li><a name="a729"></a>                        <span class="src-comm"># $this-&gt;raise(&quot;No layout file found.&quot;, &quot;Unknown layout&quot;, &quot;404&quot;); </span></li>
<li><a name="a730"></a>                        <span class="src-comm"># No layout template so just echo out whatever is in $content_for_layout</span></li>
<li><a name="a731"></a>                        echo <span class="src-var">$content_for_layout</span><span class="src-sym">;</span></li>
<li><a name="a732"></a>                    <span class="src-sym">}</span></li>
<li><a name="a733"></a>                <span class="src-sym">}</span></li>
<li><a name="a734"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a735"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-str">&quot;Failed to instantiate controller object \&quot;&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a>.<span class="src-str">&quot;\&quot;.&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;ActionController Error&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;500&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a736"></a>            <span class="src-sym">}</span></li>
<li><a name="a737"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a738"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-str">&quot;No controller found.&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;Unknown controller&quot;</span><span class="src-sym">, </span><span class="src-str">&quot;404&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a739"></a>        <span class="src-sym">}</span></li>
<li><a name="a740"></a>&nbsp;</li>
<li><a name="a741"></a>        <span class="src-comm">// error_log('keep flash='.var_export($this-&gt;keep_flash,true));</span></li>
<li><a name="a742"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$keep_flash">keep_flash</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a743"></a>            <span class="src-comm"># Nuke the flash</span></li>
<li><a name="a744"></a>            <span class="src-id"><a href="../PHPonTrax/Session.html">Session</a></span><span class="src-sym">::</span><a href="../PHPonTrax/Session.html#methodunset_var">unset_var</a><span class="src-sym">(</span><span class="src-str">'flash'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a745"></a>        <span class="src-sym">}</span></li>
<li><a name="a746"></a>&nbsp;</li>
<li><a name="a747"></a>        <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a748"></a>    <span class="src-sym">} </span><span class="src-comm">// function process_route()</span></li>
<li><a name="a749"></a>&nbsp;</li>
<li><a name="a749"></a>    </li>
<li><a name="a750"></a>    <span class="src-doc">/**</span></li>
<li><a name="a751"></a><span class="src-doc">     *  Extend the search path for components</span></li>
<li><a name="a752"></a><span class="src-doc">     *</span></li>
<li><a name="a753"></a><span class="src-doc">     *  On entry, $url_path is set according to the browser's URL and</span></li>
<li><a name="a754"></a><span class="src-doc">     *  $controllers_path has been set according to the configuration</span></li>
<li><a name="a755"></a><span class="src-doc">     *  in </span><span class="src-doc-inlinetag">{@link environment.php config/environment.php}</span><span class="src-doc"> .  Examine</span></li>
<li><a name="a756"></a><span class="src-doc">     *  the $controllers_path directory for files or directories that</span></li>
<li><a name="a757"></a><span class="src-doc">     *  match any component of the URL.  If one is found, add that</span></li>
<li><a name="a758"></a><span class="src-doc">     *  component to all paths.  Replace the contents of $url_path</span></li>
<li><a name="a759"></a><span class="src-doc">     *  with the list of URL components that did NOT match any files</span></li>
<li><a name="a760"></a><span class="src-doc">     *  or directories.</span></li>
<li><a name="a761"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $added_path</span></li>
<li><a name="a762"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controllers_path</span></li>
<li><a name="a763"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $helpers_path</span></li>
<li><a name="a764"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $layouts_path</span></li>
<li><a name="a765"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $views_path</span></li>
<li><a name="a766"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $url_path</span></li>
<li><a name="a767"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> &lt;b&gt;FIXME:&lt;/b&gt; Creating a file or directory in</span></li>
<li><a name="a768"></a><span class="src-doc">     *         app/controllers with the same name as a controller, action or</span></li>
<li><a name="a769"></a><span class="src-doc">     *         other URL element will hijack the browser!</span></li>
<li><a name="a770"></a><span class="src-doc">     */</span></li>
<li><a name="a771"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodset_paths">set_paths</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a772"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a773"></a>            <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a> <span class="src-key">as </span><span class="src-var">$path</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a774"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controllers_path">controllers_path</a> . <span class="src-str">&quot;</span><span class="src-str">/<span class="src-var">$path</span></span><span class="src-str">&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a775"></a>                    <span class="src-var">$extra_path</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$path</span><span class="src-sym">;</span></li>
<li><a name="a776"></a>                <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a777"></a>                    <span class="src-var">$new_path</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$path</span><span class="src-sym">;</span></li>
<li><a name="a778"></a>                <span class="src-sym">}</span></li>
<li><a name="a779"></a>            <span class="src-sym">}</span></li>
<li><a name="a780"></a>            <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$extra_path</span><span class="src-sym">) </span>&amp;&amp; <a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$extra_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a781"></a>                <span class="src-var">$extra_path </span>= <a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">&quot;/&quot;</span><span class="src-sym">, </span><span class="src-var">$extra_path</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a782"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$added_path">added_path</a> = <span class="src-var">$extra_path</span><span class="src-sym">;</span></li>
<li><a name="a783"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controllers_path">controllers_path</a> .= <span class="src-str">&quot;</span><span class="src-str">/<span class="src-var">$extra_path</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a784"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers_path">helpers_path</a> .= <span class="src-str">&quot;</span><span class="src-str">/<span class="src-var">$extra_path</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a785"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a> .= <span class="src-str">&quot;</span><span class="src-str">/<span class="src-var">$extra_path</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a786"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$layouts_path">layouts_path</a> .= <span class="src-str">&quot;</span><span class="src-str">/<span class="src-var">$extra_path</span></span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a787"></a>            <span class="src-sym">}</span></li>
<li><a name="a788"></a>            <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$new_path</span><span class="src-sym">)</span></li>
<li><a name="a789"></a>               &amp;&amp; <a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$new_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a790"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$url_path">url_path</a> = <span class="src-var">$new_path</span><span class="src-sym">;</span></li>
<li><a name="a791"></a>            <span class="src-sym">}</span></li>
<li><a name="a792"></a>        <span class="src-sym">}</span></li>
<li><a name="a793"></a>    <span class="src-sym">}</span></li>
<li><a name="a794"></a>&nbsp;</li>
<li><a name="a795"></a>    <span class="src-doc">/**</span></li>
<li><a name="a796"></a><span class="src-doc">     *  Execute the before filters</span></li>
<li><a name="a797"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $before_filters</span></li>
<li><a name="a798"></a><span class="src-doc">     */</span></li>
<li><a name="a799"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodexecute_before_filters">execute_before_filters</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a800"></a>        <span class="src-var">$return </span>= <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a801"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{ </span></li>
<li><a name="a802"></a>            <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a> <span class="src-key">as </span><span class="src-var">$filter_function</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a803"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-var">$filter_function</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a804"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">false </span>=== <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">$filter_function</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a805"></a>                        <span class="src-comm">//error_log(&quot;execute_before_filters(): returning false&quot;);</span></li>
<li><a name="a806"></a>                        <span class="src-var">$return </span>= <span class="src-id">false</span><span class="src-sym">;    </span></li>
<li><a name="a807"></a>                    <span class="src-sym">}</span></li>
<li><a name="a808"></a>                <span class="src-sym">}</span></li>
<li><a name="a809"></a>            <span class="src-sym">}</span></li>
<li><a name="a810"></a>        <span class="src-sym">}</span></li>
<li><a name="a811"></a>        <span class="src-key">return </span><span class="src-var">$return</span><span class="src-sym">;</span></li>
<li><a name="a812"></a>    <span class="src-sym">}</span></li>
<li><a name="a813"></a>&nbsp;</li>
<li><a name="a814"></a>    <span class="src-doc">/**</span></li>
<li><a name="a815"></a><span class="src-doc">     *  Append a before filter to the filter chain</span></li>
<li><a name="a816"></a><span class="src-doc">     *</span></li>
<li><a name="a817"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$filter_function_name </span><span class="src-doc"> String with the name of</span></li>
<li><a name="a818"></a><span class="src-doc">     *   one filter function, or array of strings with the names of</span></li>
<li><a name="a819"></a><span class="src-doc">     *   several filter functions.</span></li>
<li><a name="a820"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $before_filters</span></li>
<li><a name="a821"></a><span class="src-doc">     */</span></li>
<li><a name="a822"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodadd_before_filter">add_before_filter</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a823"></a>        <span class="src-comm">//error_log(&quot;adding before filter: $filter_function_name&quot;);</span></li>
<li><a name="a824"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">) </span>&amp;&amp; <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a825"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a826"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$filter_function_name</span><span class="src-sym">;</span></li>
<li><a name="a827"></a>            <span class="src-sym">}                        </span></li>
<li><a name="a828"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a829"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a830"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a> = <a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a><span class="src-sym">, </span><span class="src-var">$filter_function_name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a831"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a832"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$before_filters">before_filters</a> = <span class="src-var">$filter_function_name</span><span class="src-sym">;</span></li>
<li><a name="a833"></a>            <span class="src-sym">}</span></li>
<li><a name="a834"></a>        <span class="src-sym">}</span></li>
<li><a name="a835"></a>    <span class="src-sym">}</span></li>
<li><a name="a836"></a>&nbsp;</li>
<li><a name="a837"></a>    <span class="src-doc">/**</span></li>
<li><a name="a838"></a><span class="src-doc">     *  Execute the after filters</span></li>
<li><a name="a839"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $after_filters</span></li>
<li><a name="a840"></a><span class="src-doc">     */</span></li>
<li><a name="a841"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodexecute_after_filters">execute_after_filters</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a842"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a843"></a>            <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a> <span class="src-key">as </span><span class="src-var">$filter_function</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a844"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-var">$filter_function</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a845"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">$filter_function</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a846"></a>                <span class="src-sym">}</span></li>
<li><a name="a847"></a>            <span class="src-sym">}</span></li>
<li><a name="a848"></a>        <span class="src-sym">}</span></li>
<li><a name="a849"></a>    <span class="src-sym">}</span></li>
<li><a name="a850"></a>&nbsp;</li>
<li><a name="a851"></a>&nbsp;</li>
<li><a name="a852"></a>    <span class="src-doc">/**</span></li>
<li><a name="a853"></a><span class="src-doc">     *  Append an after filter to the filter chain</span></li>
<li><a name="a854"></a><span class="src-doc">     *</span></li>
<li><a name="a855"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$filter_function_name </span><span class="src-doc"> String with the name of</span></li>
<li><a name="a856"></a><span class="src-doc">     *   one filter function, or array of strings with the names of</span></li>
<li><a name="a857"></a><span class="src-doc">     *   several filter functions.</span></li>
<li><a name="a858"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $after_filters</span></li>
<li><a name="a859"></a><span class="src-doc">     */</span></li>
<li><a name="a860"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodadd_after_filter">add_after_filter</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a861"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">) </span>&amp;&amp; <span class="src-sym">!</span><span class="src-key">empty</span><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a862"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a863"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$filter_function_name</span><span class="src-sym">;</span></li>
<li><a name="a864"></a>            <span class="src-sym">}</span></li>
<li><a name="a865"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$filter_function_name</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a866"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a><span class="src-sym">) </span>&gt; <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a867"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a> = <a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a><span class="src-sym">, </span><span class="src-var">$filter_function_name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a868"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a869"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$after_filters">after_filters</a> = <span class="src-var">$filter_function_name</span><span class="src-sym">;</span></li>
<li><a name="a870"></a>            <span class="src-sym">}</span></li>
<li><a name="a871"></a>        <span class="src-sym">}</span></li>
<li><a name="a872"></a>    <span class="src-sym">}</span></li>
<li><a name="a873"></a>&nbsp;</li>
<li><a name="a874"></a>    <span class="src-doc">/**</span></li>
<li><a name="a875"></a><span class="src-doc">     *  Add a helper to the list of helpers used by a controller</span></li>
<li><a name="a876"></a><span class="src-doc">     *  object</span></li>
<li><a name="a877"></a><span class="src-doc">     *</span></li>
<li><a name="a878"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">$helper_name </span><span class="src-doc">string Name of a helper to add to the list</span></li>
<li><a name="a879"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc">  $helpers</span></li>
<li><a name="a880"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc">  $controller_object</span></li>
<li><a name="a881"></a><span class="src-doc">     */</span></li>
<li><a name="a882"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodadd_helper">add_helper</a><span class="src-sym">(</span><span class="src-var">$helper_name</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a883"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/in_array">in_array</a><span class="src-sym">(</span><span class="src-var">$helper_name</span><span class="src-sym">, </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers">helpers</a><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a884"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$helpers">helpers</a><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$helper_name</span><span class="src-sym">;</span></li>
<li><a name="a885"></a>        <span class="src-sym">}</span></li>
<li><a name="a886"></a>    <span class="src-sym">}</span></li>
<li><a name="a887"></a>&nbsp;</li>
<li><a name="a888"></a>    <span class="src-doc">/**</span></li>
<li><a name="a889"></a><span class="src-doc">     *</span></li>
<li><a name="a890"></a><span class="src-doc">     * Renders the content that will be returned to the browser as the response body.</span></li>
<li><a name="a891"></a><span class="src-doc">     *</span></li>
<li><a name="a892"></a><span class="src-doc">     */</span></li>
<li><a name="a893"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender">render</a><span class="src-sym">(</span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$locals </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$return_as_string </span>= <span class="src-id">false</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a894"></a>        </li>
<li><a name="a895"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> &amp;&amp; <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action_called">action_called</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a896"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;    </span></li>
<li><a name="a897"></a>        <span class="src-sym">}</span></li>
<li><a name="a898"></a>        </li>
<li><a name="a899"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$return_as_string</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a900"></a>            <span class="src-comm"># start to buffer output</span></li>
<li><a name="a901"></a>            <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;      </span></li>
<li><a name="a902"></a>        <span class="src-sym">}</span></li>
<li><a name="a903"></a>     </li>
<li><a name="a904"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_string">is_string</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">)) </span><span class="src-sym">{         </span></li>
<li><a name="a905"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;       </span></li>
<li><a name="a906"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a907"></a>            <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'locals'</span><span class="src-sym">] </span>= <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'locals'</span><span class="src-sym">] </span>? <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'locals'</span><span class="src-sym">] </span>: <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a908"></a>            <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'use_full_path'</span><span class="src-sym">] </span>= <span class="src-sym">!</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'use_full_path'</span><span class="src-sym">] </span>? <span class="src-id">true </span>: <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'use_full_path'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a909"></a>                  </li>
<li><a name="a910"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'text'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a911"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_text">render_text</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'text'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;        </span></li>
<li><a name="a912"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a913"></a>                <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'action'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a914"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_action">render_action</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'action'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">)</span><span class="src-sym">;        </span></li>
<li><a name="a915"></a>                <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'file'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a916"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'file'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'use_full_path'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'locals'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;    </span></li>
<li><a name="a917"></a>                <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'partial'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a918"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_partial">render_partial</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'partial'</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">)</span><span class="src-sym">;        </span></li>
<li><a name="a919"></a>                <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'nothing'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a920"></a>                    <span class="src-comm"># Safari doesn't pass the headers of the return if the response is zero length</span></li>
<li><a name="a921"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_text">render_text</a><span class="src-sym">(</span><span class="src-str">&quot; &quot;</span><span class="src-sym">)</span><span class="src-sym">; </span></li>
<li><a name="a922"></a>                <span class="src-sym">}    </span></li>
<li><a name="a923"></a>            <span class="src-sym">}</span></li>
<li><a name="a924"></a>        <span class="src-sym">} </span></li>
<li><a name="a925"></a>        </li>
<li><a name="a926"></a>        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> = <span class="src-id">true</span><span class="src-sym">;</span></li>
<li><a name="a927"></a>&nbsp;</li>
<li><a name="a928"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$return_as_string</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a929"></a>            <span class="src-var">$result </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a930"></a>            <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a931"></a>            <span class="src-key">return </span><span class="src-var">$result</span><span class="src-sym">;</span></li>
<li><a name="a932"></a>        <span class="src-sym">}         </span></li>
<li><a name="a933"></a>    <span class="src-sym">}</span></li>
<li><a name="a934"></a>    </li>
<li><a name="a935"></a>    <span class="src-doc">/**</span></li>
<li><a name="a936"></a><span class="src-doc">     *</span></li>
<li><a name="a937"></a><span class="src-doc">     * Rendering of text is usually used for tests or for rendering prepared content.</span></li>
<li><a name="a938"></a><span class="src-doc">     * By default, text rendering is not done within the active layout.</span></li>
<li><a name="a939"></a><span class="src-doc">     * </span></li>
<li><a name="a940"></a><span class="src-doc">     *   # Renders the clear text &quot;hello world&quot;</span></li>
<li><a name="a941"></a><span class="src-doc">     *   render(array(&quot;text&quot; =&gt; &quot;hello world!&quot;))</span></li>
<li><a name="a942"></a><span class="src-doc">     * </span></li>
<li><a name="a943"></a><span class="src-doc">     *   # Renders the clear text &quot;Explosion!&quot;</span></li>
<li><a name="a944"></a><span class="src-doc">     *   render(array(&quot;text&quot; =&gt; &quot;Explosion!&quot;))</span></li>
<li><a name="a945"></a><span class="src-doc">     * </span></li>
<li><a name="a946"></a><span class="src-doc">     *   # Renders the clear text &quot;Hi there!&quot; within the current active layout (if one exists)</span></li>
<li><a name="a947"></a><span class="src-doc">     *   render(array(&quot;text&quot; =&gt; &quot;Explosion!&quot;, &quot;layout&quot; =&gt; true))</span></li>
<li><a name="a948"></a><span class="src-doc">     * </span></li>
<li><a name="a949"></a><span class="src-doc">     *   # Renders the clear text &quot;Hi there!&quot; within the layout</span></li>
<li><a name="a950"></a><span class="src-doc">     *   # placed in &quot;app/views/layouts/special.phtml&quot;</span></li>
<li><a name="a951"></a><span class="src-doc">     *   render(array(&quot;text&quot; =&gt; &quot;Explosion!&quot;, &quot;layout&quot; =&gt; &quot;special&quot;))</span></li>
<li><a name="a952"></a><span class="src-doc">     * </span></li>
<li><a name="a953"></a><span class="src-doc">     */</span></li>
<li><a name="a954"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender_text">render_text</a><span class="src-sym">(</span><span class="src-var">$text</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{       </span></li>
<li><a name="a955"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'layout'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a956"></a>            <span class="src-var">$locals</span><span class="src-sym">[</span><span class="src-str">'content_for_layout'</span><span class="src-sym">] </span>= <span class="src-var">$text</span><span class="src-sym">;         </span></li>
<li><a name="a957"></a>            <span class="src-var">$layout </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methoddetermine_layout">determine_layout</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a958"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;  </span></li>
<li><a name="a959"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a960"></a>            echo <span class="src-var">$text</span><span class="src-sym">;    </span></li>
<li><a name="a961"></a>        <span class="src-sym">}</span></li>
<li><a name="a962"></a>        <span class="src-key">exit</span><span class="src-sym">;      </span></li>
<li><a name="a963"></a>    <span class="src-sym">}</span></li>
<li><a name="a964"></a>&nbsp;</li>
<li><a name="a965"></a>    <span class="src-doc">/**</span></li>
<li><a name="a966"></a><span class="src-doc">     *</span></li>
<li><a name="a967"></a><span class="src-doc">     * Action rendering is the most common form and the type used automatically by</span></li>
<li><a name="a968"></a><span class="src-doc">     * Action Controller when nothing else is specified. By default, actions are</span></li>
<li><a name="a969"></a><span class="src-doc">     * rendered within the current layout (if one exists).</span></li>
<li><a name="a970"></a><span class="src-doc">     * </span></li>
<li><a name="a971"></a><span class="src-doc">     *   # Renders the template for the action &quot;goal&quot; within the current controller</span></li>
<li><a name="a972"></a><span class="src-doc">     *   render(array(&quot;action&quot; =&gt; &quot;goal&quot;))</span></li>
<li><a name="a973"></a><span class="src-doc">     * </span></li>
<li><a name="a974"></a><span class="src-doc">     *   # Renders the template for the action &quot;short_goal&quot; within the current controller,</span></li>
<li><a name="a975"></a><span class="src-doc">     *   # but without the current active layout</span></li>
<li><a name="a976"></a><span class="src-doc">     *   render(array(&quot;action&quot; =&gt; &quot;short_goal&quot;, &quot;layout&quot; =&gt; false))</span></li>
<li><a name="a977"></a><span class="src-doc">     * </span></li>
<li><a name="a978"></a><span class="src-doc">     *   # Renders the template for the action &quot;long_goal&quot; within the current controller,</span></li>
<li><a name="a979"></a><span class="src-doc">     *   # but with a custom layout</span></li>
<li><a name="a980"></a><span class="src-doc">     *   render(array(&quot;action&quot; =&gt; &quot;long_goal&quot;, &quot;layout&quot; =&gt; &quot;spectacular&quot;))</span></li>
<li><a name="a981"></a><span class="src-doc">     * </span></li>
<li><a name="a982"></a><span class="src-doc">     */    </span></li>
<li><a name="a983"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender_action">render_action</a><span class="src-sym">(</span><span class="src-var">$action</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a984"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a985"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;    </span></li>
<li><a name="a986"></a>        <span class="src-sym">}</span></li>
<li><a name="a987"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'layout'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a988"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout </span>= <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'layout'</span><span class="src-sym">]</span><span class="src-sym">;    </span></li>
<li><a name="a989"></a>        <span class="src-sym">} </span></li>
<li><a name="a990"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'scaffold'</span><span class="src-sym">]</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a991"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$view_file">view_file</a> = <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a></span>.<span class="src-str">&quot;/templates/scaffolds/&quot;</span>.<span class="src-var">$action</span>.<span class="src-str">&quot;.phtml&quot;</span><span class="src-sym">;    </span></li>
<li><a name="a992"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{    </span></li>
<li><a name="a993"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$view_file">view_file</a> = <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a> . <span class="src-str">&quot;/&quot; </span>. <span class="src-var">$action </span>. <span class="src-str">&quot;.&quot; </span>. <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a994"></a>        <span class="src-sym">}</span></li>
<li><a name="a995"></a>        <span class="src-comm">//error_log(get_class($this).&quot; - render_action() view_file: $this-&gt;view_file&quot;);</span></li>
<li><a name="a996"></a>        <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$view_file">view_file</a><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a997"></a>    <span class="src-sym">}</span></li>
<li><a name="a998"></a>    </li>
<li><a name="a999"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1000"></a><span class="src-doc">     *</span></li>
<li><a name="a1001"></a><span class="src-doc">     * Renders according to the same rules as render, but returns the result in a string</span></li>
<li><a name="a1002"></a><span class="src-doc">     * instead of sending it as the response body to the browser.</span></li>
<li><a name="a1003"></a><span class="src-doc">     *    </span></li>
<li><a name="a1004"></a><span class="src-doc">     */</span></li>
<li><a name="a1005"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender_to_string">render_to_string</a><span class="src-sym">(</span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-var">$locals </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1006"></a>        <span class="src-key">return </span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender">render</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;    </span></li>
<li><a name="a1007"></a>    <span class="src-sym">}</span></li>
<li><a name="a1008"></a>&nbsp;</li>
<li><a name="a1009"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1010"></a><span class="src-doc">     *</span></li>
<li><a name="a1011"></a><span class="src-doc">     * File rendering works just like action rendering except that it takes a filesystem path.</span></li>
<li><a name="a1012"></a><span class="src-doc">     * By default, the path is assumed to be absolute, and the current layout is not applied.</span></li>
<li><a name="a1013"></a><span class="src-doc">     * </span></li>
<li><a name="a1014"></a><span class="src-doc">     *   # Renders the template located at the absolute filesystem path</span></li>
<li><a name="a1015"></a><span class="src-doc">     *   render(array(&quot;file&quot; =&gt; &quot;/path/to/some/template.phtml&quot;))</span></li>
<li><a name="a1016"></a><span class="src-doc">     *   render(array(&quot;file&quot; =&gt; &quot;c:/path/to/some/template.phtml&quot;))</span></li>
<li><a name="a1017"></a><span class="src-doc">     * </span></li>
<li><a name="a1018"></a><span class="src-doc">     *   # Renders a template within the current layout</span></li>
<li><a name="a1019"></a><span class="src-doc">     *   render(array(&quot;file&quot; =&gt; &quot;/path/to/some/template.rhtml&quot;, &quot;layout&quot; =&gt; true))</span></li>
<li><a name="a1020"></a><span class="src-doc">     *   render(array(&quot;file&quot; =&gt; &quot;c:/path/to/some/template.rhtml&quot;, &quot;layout&quot; =&gt; true))</span></li>
<li><a name="a1021"></a><span class="src-doc">     * </span></li>
<li><a name="a1022"></a><span class="src-doc">     *   # Renders a template relative to app/views</span></li>
<li><a name="a1023"></a><span class="src-doc">     *   render(array(&quot;file&quot; =&gt; &quot;some/template&quot;, &quot;use_full_path&quot; =&gt; true))</span></li>
<li><a name="a1024"></a><span class="src-doc">     */</span></li>
<li><a name="a1025"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$use_full_path </span>= <span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1026"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> &amp;&amp; <span class="src-sym">!</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$action_called">action_called</a><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1027"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;    </span></li>
<li><a name="a1028"></a>        <span class="src-sym">}        </span></li>
<li><a name="a1029"></a>        </li>
<li><a name="a1030"></a>        <span class="src-comm"># Renders a template relative to app/views</span></li>
<li><a name="a1031"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$use_full_path</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1032"></a>            <span class="src-var">$path </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$path</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1033"></a>        <span class="src-sym">} </span></li>
<li><a name="a1034"></a>&nbsp;</li>
<li><a name="a1035"></a>        <span class="src-comm">//error_log(&quot;render_file() path:$path&quot;);</span></li>
<li><a name="a1036"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1037"></a>&nbsp;</li>
<li><a name="a1038"></a>            <span class="src-comm"># Pull all the class vars out and turn them from $this-&gt;var to $var</span></li>
<li><a name="a1039"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_object">is_object</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1040"></a>                <span class="src-var">$controller_locals </span>= <a href="http://www.php.net/get_object_vars">get_object_vars</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1041"></a>            <span class="src-sym">}</span></li>
<li><a name="a1042"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$controller_locals</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1043"></a>                <span class="src-var">$locals </span>= <a href="http://www.php.net/array_merge">array_merge</a><span class="src-sym">(</span><span class="src-var">$controller_locals</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;    </span></li>
<li><a name="a1044"></a>            <span class="src-sym">}                   </span></li>
<li><a name="a1045"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$locals</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1046"></a>                <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$locals </span><span class="src-key">as </span><span class="src-var">$tmp_key </span>=&gt; <span class="src-var">$tmp_value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1047"></a>                    $<span class="src-sym">{</span><span class="src-var">$tmp_key</span><span class="src-sym">} </span>= <span class="src-var">$tmp_value</span><span class="src-sym">;                </span></li>
<li><a name="a1048"></a>                <span class="src-sym">}    </span></li>
<li><a name="a1049"></a>                unset<span class="src-sym">(</span><span class="src-var">$tmp_key</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1050"></a>                unset<span class="src-sym">(</span><span class="src-var">$tmp_value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1051"></a>            <span class="src-sym">}        </span></li>
<li><a name="a1052"></a>            <span class="src-inc">include</span><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1053"></a>            <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> = <span class="src-id">true</span><span class="src-sym">;  </span></li>
<li><a name="a1054"></a>            <span class="src-key">return </span><span class="src-id">true</span><span class="src-sym">;      </span></li>
<li><a name="a1055"></a>        <span class="src-sym">}     </span></li>
<li><a name="a1056"></a>        <span class="src-key">return </span><span class="src-id">false</span><span class="src-sym">;      </span></li>
<li><a name="a1057"></a>    <span class="src-sym">}</span></li>
<li><a name="a1058"></a>&nbsp;</li>
<li><a name="a1059"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1060"></a><span class="src-doc">     *  Rendering partials</span></li>
<li><a name="a1061"></a><span class="src-doc">     * </span></li>
<li><a name="a1062"></a><span class="src-doc">     *  &lt;p&gt;Partial rendering is most commonly used together with Ajax</span></li>
<li><a name="a1063"></a><span class="src-doc">     *  calls that only update one or a few elements on a page without</span></li>
<li><a name="a1064"></a><span class="src-doc">     *  reloading. Rendering of partials from the controller makes it</span></li>
<li><a name="a1065"></a><span class="src-doc">     *  possible to use the same partial template in both the</span></li>
<li><a name="a1066"></a><span class="src-doc">     *  full-page rendering (by calling it from within the template)</span></li>
<li><a name="a1067"></a><span class="src-doc">     *  and when sub-page updates happen (from the controller action</span></li>
<li><a name="a1068"></a><span class="src-doc">     *  responding to Ajax calls). By default, the current layout is</span></li>
<li><a name="a1069"></a><span class="src-doc">     *  not used.&lt;/p&gt;</span></li>
<li><a name="a1070"></a><span class="src-doc">     *</span></li>
<li><a name="a1071"></a><span class="src-doc">     *  &lt;ul&gt;</span></li>
<li><a name="a1072"></a><span class="src-doc">     *    &lt;li&gt;&lt;samp&gt;render_partial(&quot;win&quot;);&lt;/samp&gt;&lt;br&gt;</span></li>
<li><a name="a1073"></a><span class="src-doc">     *      Renders the partial</span></li>
<li><a name="a1074"></a><span class="src-doc">     *      located at app/views/controller/_win.phtml&lt;/li&gt;</span></li>
<li><a name="a1075"></a><span class="src-doc">     *</span></li>
<li><a name="a1076"></a><span class="src-doc">     *    &lt;li&gt;&lt;samp&gt;render_partial(&quot;win&quot;,</span></li>
<li><a name="a1077"></a><span class="src-doc">     *       array(&quot;locals&quot; =&gt; array(&quot;name&quot; =&gt; &quot;david&quot;)));&lt;/samp&gt;&lt;br&gt;</span></li>
<li><a name="a1078"></a><span class="src-doc">     *      Renders the same partial but also makes a local variable</span></li>
<li><a name="a1079"></a><span class="src-doc">     *      available to it&lt;/li&gt;</span></li>
<li><a name="a1080"></a><span class="src-doc">     *     </span></li>
<li><a name="a1081"></a><span class="src-doc">     *    &lt;li&gt;&lt;samp&gt;render_partial(&quot;win&quot;,</span></li>
<li><a name="a1082"></a><span class="src-doc">     *      array(&quot;collection&quot; =&gt; array(...)));&lt;/samp&gt;&lt;br&gt;</span></li>
<li><a name="a1083"></a><span class="src-doc">     *      Renders a collection of the same partial by making each</span></li>
<li><a name="a1084"></a><span class="src-doc">     *      element of the collection available through the local variable</span></li>
<li><a name="a1085"></a><span class="src-doc">     *      &quot;win&quot; as it builds the complete response &lt;/li&gt;</span></li>
<li><a name="a1086"></a><span class="src-doc">     *</span></li>
<li><a name="a1087"></a><span class="src-doc">     *    &lt;li&gt;&lt;samp&gt;render_partial(&quot;win&quot;, array(&quot;collection&quot; =&gt; $wins,</span></li>
<li><a name="a1088"></a><span class="src-doc">     *      &quot;spacer_template&quot; =&gt; &quot;win_divider&quot;));&lt;/samp&gt;&lt;br&gt;</span></li>
<li><a name="a1089"></a><span class="src-doc">     *      Renders the same collection of partials, but also renders</span></li>
<li><a name="a1090"></a><span class="src-doc">     *      the win_divider partial in between each win partial.&lt;/li&gt;</span></li>
<li><a name="a1091"></a><span class="src-doc">     *  &lt;/ul&gt;</span></li>
<li><a name="a1092"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$path </span><span class="src-doc">Path to file containing partial view</span></li>
<li><a name="a1093"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string[] </span><span class="src-doc-var">$options </span><span class="src-doc">Options array</span></li>
<li><a name="a1094"></a><span class="src-doc">     */</span></li>
<li><a name="a1095"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodrender_partial">render_partial</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-var">$options </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1096"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strstr">strstr</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1097"></a>            <span class="src-var">$file </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strrchr">strrchr</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1098"></a>            <span class="src-var">$path </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><a href="http://www.php.net/strripos">strripos</a><span class="src-sym">(</span><span class="src-var">$path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a1099"></a>            <span class="src-var">$file_with_path </span>= <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a></span>.<span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'views'</span><span class="src-sym">]</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$path</span>.<span class="src-str">&quot;/_&quot;</span>.<span class="src-var">$file</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1100"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1101"></a>            <span class="src-var">$file </span>= <span class="src-var">$path</span><span class="src-sym">;</span></li>
<li><a name="a1102"></a>            <span class="src-var">$file_with_path </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a>.<span class="src-str">&quot;/_&quot;</span>.<span class="src-var">$file</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1103"></a>        <span class="src-sym">}</span></li>
<li><a name="a1104"></a>&nbsp;</li>
<li><a name="a1105"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$file_with_path</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1106"></a>            </li>
<li><a name="a1107"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">&quot;spacer_template&quot;</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1108"></a>                <span class="src-var">$spacer_path </span>= <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'spacer_template'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a1109"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strstr">strstr</a><span class="src-sym">(</span><span class="src-var">$spacer_path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1110"></a>                    <span class="src-var">$spacer_file </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strrchr">strrchr</a><span class="src-sym">(</span><span class="src-var">$spacer_path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1111"></a>                    <span class="src-var">$spacer_path </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$spacer_path</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><a href="http://www.php.net/strripos">strripos</a><span class="src-sym">(</span><span class="src-var">$spacer_path</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a1112"></a>                    <span class="src-var">$spacer_file_with_file </span>= <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a></span>.<span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'views'</span><span class="src-sym">]</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$spacer_path</span>.<span class="src-str">&quot;/_&quot;</span>.<span class="src-var">$spacer_file</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1113"></a>                <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1114"></a>                    <span class="src-var">$spacer_file </span>= <span class="src-var">$spacer_path</span><span class="src-sym">;</span></li>
<li><a name="a1115"></a>                    <span class="src-var">$spacer_file_with_file </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_path">views_path</a>.<span class="src-str">&quot;/_&quot;</span>.<span class="src-var">$spacer_file</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1116"></a>                <span class="src-sym">}  </span></li>
<li><a name="a1117"></a>                <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$spacer_file_with_file</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1118"></a>                    <span class="src-var">$add_spacer </span>= <span class="src-id">true</span><span class="src-sym">;    </span></li>
<li><a name="a1119"></a>                <span class="src-sym">}</span></li>
<li><a name="a1120"></a>            <span class="src-sym">}          </span></li>
<li><a name="a1121"></a>&nbsp;</li>
<li><a name="a1122"></a>            <span class="src-var">$locals </span>= <a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">&quot;locals&quot;</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">) </span>? <span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'locals'</span><span class="src-sym">] </span>: <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1123"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/array_key_exists">array_key_exists</a><span class="src-sym">(</span><span class="src-str">&quot;collection&quot;</span><span class="src-sym">, </span><span class="src-var">$options</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1124"></a>                <span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'collection'</span><span class="src-sym">] </span><span class="src-key">as </span><span class="src-var">$tmp_value</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1125"></a>                    $<span class="src-sym">{</span><span class="src-var">$file</span>.<span class="src-str">&quot;_counter&quot;</span><span class="src-sym">}</span>++<span class="src-sym">;</span></li>
<li><a name="a1126"></a>                    <span class="src-var">$locals</span><span class="src-sym">[</span><span class="src-var">$file</span><span class="src-sym">] </span>= <span class="src-var">$tmp_value</span><span class="src-sym">;</span></li>
<li><a name="a1127"></a>                    <span class="src-var">$locals</span><span class="src-sym">[</span><span class="src-var">$file</span>.<span class="src-str">&quot;_counter&quot;</span><span class="src-sym">] </span>= $<span class="src-sym">{</span><span class="src-var">$file</span>.<span class="src-str">&quot;_counter&quot;</span><span class="src-sym">}</span><span class="src-sym">;</span></li>
<li><a name="a1128"></a>                    unset<span class="src-sym">(</span><span class="src-var">$tmp_value</span><span class="src-sym">)</span><span class="src-sym">; </span></li>
<li><a name="a1129"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a1130"></a>                    <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$file_with_path</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;   </span></li>
<li><a name="a1131"></a>                    <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$add_spacer </span>&amp;&amp; <span class="src-sym">(</span>$<span class="src-sym">{</span><span class="src-var">$file</span>.<span class="src-str">&quot;_counter&quot;</span><span class="src-sym">} </span>&lt; <a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">[</span><span class="src-str">'collection'</span><span class="src-sym">]</span><span class="src-sym">))) </span><span class="src-sym">{ </span></li>
<li><a name="a1132"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> = <span class="src-id">false</span><span class="src-sym">;</span></li>
<li><a name="a1133"></a>                        <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$spacer_file_with_file</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;      </span></li>
<li><a name="a1134"></a>                    <span class="src-sym">}         </span></li>
<li><a name="a1135"></a>                <span class="src-sym">} </span></li>
<li><a name="a1136"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$render_performed">render_performed</a> = <span class="src-id">true</span><span class="src-sym">;   </span></li>
<li><a name="a1137"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{              </span></li>
<li><a name="a1138"></a>                <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#methodrender_file">render_file</a><span class="src-sym">(</span><span class="src-var">$file_with_path</span><span class="src-sym">, </span><span class="src-id">false</span><span class="src-sym">, </span><span class="src-var">$locals</span><span class="src-sym">)</span><span class="src-sym">;        </span></li>
<li><a name="a1139"></a>            <span class="src-sym">}          </span></li>
<li><a name="a1140"></a>        <span class="src-sym">}</span></li>
<li><a name="a1141"></a>    <span class="src-sym">}</span></li>
<li><a name="a1142"></a>&nbsp;</li>
<li><a name="a1143"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1144"></a><span class="src-doc">     *  Select a layout file based on the controller object</span></li>
<li><a name="a1145"></a><span class="src-doc">     *</span></li>
<li><a name="a1146"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $controller_object</span></li>
<li><a name="a1147"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $layouts_base_path</span></li>
<li><a name="a1148"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> $layouts_path</span></li>
<li><a name="a1149"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span><span class="src-doc">Layout file or null if none</span></li>
<li><a name="a1150"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> &lt;b&gt;FIXME:&lt;/b&gt; Should this method be private?</span></li>
<li><a name="a1151"></a><span class="src-doc">     */</span></li>
<li><a name="a1152"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methoddetermine_layout">determine_layout</a><span class="src-sym">(</span><span class="src-var">$full_path </span>= <span class="src-id">true</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1153"></a>&nbsp;</li>
<li><a name="a1154"></a>        <span class="src-comm">//  If the controller defines $layout and sets it</span></li>
<li><a name="a1155"></a>        <span class="src-comm">//  to NULL, that indicates it doesn't want a layout</span></li>
<li><a name="a1156"></a>        <span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout</span><span class="src-sym">) </span>&amp;&amp; <a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1157"></a>            <span class="src-comm">//error_log('controller-&gt;layout absent');</span></li>
<li><a name="a1158"></a>            <span class="src-key">return </span><span class="src-id">null</span><span class="src-sym">;</span></li>
<li><a name="a1159"></a>        <span class="src-sym">}</span></li>
<li><a name="a1160"></a>        <span class="src-comm"># $layout will be the layout defined in the current controller</span></li>
<li><a name="a1161"></a>        <span class="src-comm"># or try to use the controller name for the layout</span></li>
<li><a name="a1162"></a>        <span class="src-var">$layout </span>= <span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout</span><span class="src-sym">)</span></li>
<li><a name="a1163"></a>                   &amp;&amp; <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout </span>!= <span class="src-str">''</span><span class="src-sym">)</span></li>
<li><a name="a1164"></a>            ? <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout </span>: <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$controller">controller</a><span class="src-sym">;</span></li>
<li><a name="a1165"></a>        </li>
<li><a name="a1166"></a>        <span class="src-comm"># Check if a method has been defined to determine the layout at runtime</span></li>
<li><a name="a1167"></a>        <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/method_exists">method_exists</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">, </span><span class="src-var">$layout</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1168"></a>            <span class="src-var">$layout </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">$layout</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1169"></a>        <span class="src-sym">}</span></li>
<li><a name="a1170"></a>&nbsp;</li>
<li><a name="a1171"></a>        <span class="src-comm"># Default settings</span></li>
<li><a name="a1172"></a>        <span class="src-var">$layouts_base_path </span>= <span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a> </span>. <span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'layouts'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a1173"></a>        <span class="src-var">$default_layout_file </span>= <span class="src-var">$layouts_base_path </span>. <span class="src-str">&quot;/application.&quot; </span>. <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1174"></a>        </li>
<li><a name="a1175"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$full_path </span>&amp;&amp; <span class="src-var">$layout</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1176"></a>            <span class="src-key">return </span><span class="src-var">$layout</span><span class="src-sym">;       </span></li>
<li><a name="a1177"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1178"></a>            <span class="src-comm"># Is this layout for from a different controller</span></li>
<li><a name="a1179"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strstr">strstr</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1180"></a>                <span class="src-var">$file </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strrchr">strrchr</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1181"></a>                <span class="src-var">$path </span>= <a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><a href="http://www.php.net/strripos">strripos</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">, </span><span class="src-str">&quot;/&quot;</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a1182"></a>                <span class="src-var">$layout </span>= <span class="src-var">$layouts_base_path</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$path</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$file</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1183"></a>            <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">( </span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout</span><span class="src-sym">) </span>&amp;&amp; <span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout </span>!= <span class="src-str">''</span><span class="src-sym">) ) </span><span class="src-sym">{</span></li>
<li><a name="a1184"></a>                <span class="src-comm"># Is there a layout for the current controller</span></li>
<li><a name="a1185"></a>                <span class="src-var">$layout </span>= <span class="src-var">$layouts_base_path</span>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">layout</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;                    </span></li>
<li><a name="a1186"></a>            <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1187"></a>                <span class="src-comm"># Is there a layout for the current controller</span></li>
<li><a name="a1188"></a>                <span class="src-var">$layout </span>= <span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$layouts_path">layouts_path</a>.<span class="src-str">&quot;/&quot;</span>.<span class="src-var">$layout</span>.<span class="src-str">&quot;.&quot;</span>.<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPonTrax/ActionController.html#var$views_file_extention">views_file_extention</a><span class="src-sym">;</span></li>
<li><a name="a1189"></a>            <span class="src-sym">}</span></li>
<li><a name="a1190"></a>&nbsp;</li>
<li><a name="a1191"></a>            <span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$layout</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1192"></a>                <span class="src-var">$layout_file </span>= <span class="src-var">$layout</span><span class="src-sym">;</span></li>
<li><a name="a1193"></a>            <span class="src-sym">}</span></li>
<li><a name="a1194"></a>        <span class="src-sym">}</span></li>
<li><a name="a1195"></a>        </li>
<li><a name="a1196"></a>        <span class="src-comm"># No defined layout found so just use the default layout</span></li>
<li><a name="a1197"></a>        <span class="src-comm"># app/views/layouts/application.phtml </span></li>
<li><a name="a1198"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$layout_file</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1199"></a>            <span class="src-var">$layout_file </span>= <span class="src-var">$default_layout_file</span><span class="src-sym">;</span></li>
<li><a name="a1200"></a>        <span class="src-sym">}</span></li>
<li><a name="a1201"></a>        <span class="src-key">return </span><span class="src-var">$layout_file</span><span class="src-sym">;</span></li>
<li><a name="a1202"></a>    <span class="src-sym">}</span></li>
<li><a name="a1203"></a>&nbsp;</li>
<li><a name="a1204"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1205"></a><span class="src-doc">     *  Redirect the browser to a specified target</span></li>
<li><a name="a1206"></a><span class="src-doc">     *</span></li>
<li><a name="a1207"></a><span class="src-doc">     *  Redirect the browser to the target specified in $options. This</span></li>
<li><a name="a1208"></a><span class="src-doc">     *  parameter can take one of three forms:</span></li>
<li><a name="a1209"></a><span class="src-doc">     *  &lt;ul&gt;</span></li>
<li><a name="a1210"></a><span class="src-doc">     *    &lt;li&gt;Array: The URL will be generated by calling</span></li>
<li><a name="a1211"></a><span class="src-doc">     *      </span><span class="src-doc-inlinetag">{@link url_for()}</span><span class="src-doc"> with the options.&lt;/li&gt;</span></li>
<li><a name="a1212"></a><span class="src-doc">     *    &lt;li&gt;String starting with a protocol:// (like http://): Is</span></li>
<li><a name="a1213"></a><span class="src-doc">     *      passed straight through as the target for redirection.&lt;/li&gt;</span></li>
<li><a name="a1214"></a><span class="src-doc">     *    &lt;li&gt;String not containing a protocol: The current protocol</span></li>
<li><a name="a1215"></a><span class="src-doc">     *      and host is prepended to the string.&lt;/li&gt;</span></li>
<li><a name="a1216"></a><span class="src-doc">     *    &lt;li&gt;back: Back to the page that issued the request. Useful</span></li>
<li><a name="a1217"></a><span class="src-doc">     *      for forms that are triggered from multiple</span></li>
<li><a name="a1218"></a><span class="src-doc">     *      places. Short-hand for redirect_to(request.env[&quot;HTTP_REFERER&quot;])</span></li>
<li><a name="a1219"></a><span class="src-doc">     *   &lt;/ul&gt;</span></li>
<li><a name="a1220"></a><span class="src-doc">     *</span></li>
<li><a name="a1221"></a><span class="src-doc">     *  Examples:</span></li>
<li><a name="a1222"></a><span class="src-doc">     *  &lt;ul&gt;</span></li>
<li><a name="a1223"></a><span class="src-doc">     *    &lt;li&gt;redirect_to(array(&quot;:action&quot; =&gt; &quot;show&quot;, &quot;:id&quot; =&gt; 5))&lt;/li&gt;</span></li>
<li><a name="a1224"></a><span class="src-doc">     *    &lt;li&gt;redirect_to(&quot;http://www.rubyonrails.org&quot;)&lt;/li&gt;</span></li>
<li><a name="a1225"></a><span class="src-doc">     *    &lt;li&gt;redirect_to(&quot;/images/screenshot.jpg&quot;)&lt;/li&gt;</span></li>
<li><a name="a1226"></a><span class="src-doc">     *    &lt;li&gt;redirect_to(&quot;back&quot;)&lt;/li&gt;</span></li>
<li><a name="a1227"></a><span class="src-doc">     *  &lt;/ul&gt;</span></li>
<li><a name="a1228"></a><span class="src-doc">     *</span></li>
<li><a name="a1229"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$options </span><span class="src-doc">array or string url</span></li>
<li><a name="a1230"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> &lt;b&gt;FIXME:&lt;/b&gt; Make header configurable</span></li>
<li><a name="a1231"></a><span class="src-doc">     */    </span></li>
<li><a name="a1232"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodredirect_to">redirect_to</a><span class="src-sym">(</span><span class="src-var">$options </span>= <span class="src-id">null</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1233"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$options </span>== <span class="src-str">&quot;back&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1234"></a>            <span class="src-var">$url </span>= <span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">&quot;HTTP_REFERER&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a1235"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1236"></a>            <span class="src-var">$url </span>= <a href="../PHPonTrax/_vendor_trax_action_view_helpers_url_helper_php.html#functionurl_for">url_for</a><span class="src-sym">(</span><span class="src-var">$options</span><span class="src-sym">)</span><span class="src-sym">;     </span></li>
<li><a name="a1237"></a>        <span class="src-sym">}</span></li>
<li><a name="a1238"></a>        echo <span class="src-str">&quot;&lt;html&gt;&lt;head&gt;&lt;META HTTP-EQUIV=\&quot;REFRESH\&quot; CONTENT=\&quot;0; URL=&quot;</span>.<span class="src-var">$url</span>.<span class="src-str">&quot;\&quot;&gt;&lt;/head&gt;&lt;/html&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1239"></a>        <span class="src-comm">#header(&quot;Location: &quot;.$url);   </span></li>
<li><a name="a1240"></a>        <span class="src-key">exit</span><span class="src-sym">;            </span></li>
<li><a name="a1241"></a>    <span class="src-sym">}</span></li>
<li><a name="a1242"></a>&nbsp;</li>
<li><a name="a1243"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1244"></a><span class="src-doc">     *  Raise an ActionControllerError exception</span></li>
<li><a name="a1245"></a><span class="src-doc">     *</span></li>
<li><a name="a1246"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$error_message </span><span class="src-doc">Error message</span></li>
<li><a name="a1247"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$error_heading </span><span class="src-doc">Error heading</span></li>
<li><a name="a1248"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$error_code </span><span class="src-doc">   Error code</span></li>
<li><a name="a1249"></a><span class="src-doc">     *  </span><span class="src-doc-coretag">@throws</span><span class="src-doc"> ActionControllerError</span></li>
<li><a name="a1250"></a><span class="src-doc">     */</span></li>
<li><a name="a1251"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodraise">raise</a><span class="src-sym">(</span><span class="src-var">$error_message</span><span class="src-sym">, </span><span class="src-var">$error_heading</span><span class="src-sym">, </span><span class="src-var">$error_code </span>= <span class="src-str">&quot;404&quot;</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1252"></a>        throw <span class="src-key">new </span><span class="src-id"><a href="../PHPonTrax/ActionControllerError.html">ActionControllerError</a></span><span class="src-sym">(</span><span class="src-str">&quot;Error Message: &quot;</span>.<span class="src-var">$error_message</span><span class="src-sym">, </span><span class="src-var">$error_heading</span><span class="src-sym">, </span><span class="src-var">$error_code</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1253"></a>    <span class="src-sym">}</span></li>
<li><a name="a1254"></a>&nbsp;</li>
<li><a name="a1255"></a>    <span class="src-doc">/**</span></li>
<li><a name="a1256"></a><span class="src-doc">     *  Generate an HTML page describing an error</span></li>
<li><a name="a1257"></a><span class="src-doc">     */</span></li>
<li><a name="a1258"></a>    <span class="src-key">function </span><a href="../PHPonTrax/ActionController.html#methodprocess_with_exception">process_with_exception</a><span class="src-sym">(</span><span class="src-sym">&amp;</span><span class="src-var">$exception</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1259"></a>        <span class="src-var">$error_code </span>= <span class="src-var">$exception</span><span class="src-sym">-&gt;</span><span class="src-id">error_code</span><span class="src-sym">;</span></li>
<li><a name="a1260"></a>        <span class="src-var">$error_heading </span>= <span class="src-var">$exception</span><span class="src-sym">-&gt;</span><span class="src-id">error_heading</span><span class="src-sym">;</span></li>
<li><a name="a1261"></a>        <span class="src-var">$error_message </span>= <span class="src-var">$exception</span><span class="src-sym">-&gt;</span><span class="src-id">error_message</span><span class="src-sym">;</span></li>
<li><a name="a1262"></a>        <span class="src-var">$trace </span>= <span class="src-var">$exception</span><span class="src-sym">-&gt;</span><span class="src-id">getTraceAsString</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1263"></a>        <a href="http://www.php.net/header">header</a><span class="src-sym">(</span><span class="src-str">'HTTP/1.0 {$error_code} {$error_heading}'</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1264"></a>        <a href="http://www.php.net/header">header</a><span class="src-sym">(</span><span class="src-str">'status: {$error_code} {$error_heading}'</span><span class="src-sym">)</span><span class="src-sym">; </span></li>
<li><a name="a1265"></a>        <span class="src-comm"># check for user's layout for errors</span></li>
<li><a name="a1266"></a>        <span class="src-key">if</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineDEBUG">DEBUG</a> </span>&amp;&amp; <a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a></span>.<span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'layouts'</span><span class="src-sym">]</span>.<span class="src-str">&quot;/trax_error.&quot;</span>.<span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_VIEWS_EXTENTION">TRAX_VIEWS_EXTENTION</a></span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1267"></a>            <span class="src-inc">include</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_ROOT">TRAX_ROOT</a></span>.<span class="src-var">$GLOBALS</span><span class="src-sym">[</span><span class="src-str">'TRAX_INCLUDES'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'layouts'</span><span class="src-sym">]</span>.<span class="src-str">&quot;/trax_error.&quot;</span>.<span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_VIEWS_EXTENTION">TRAX_VIEWS_EXTENTION</a></span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1268"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineDEBUG">DEBUG</a> </span>&amp;&amp; <a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a></span>.<span class="src-str">&quot;/templates/error.phtml&quot;</span><span class="src-sym">)) </span><span class="src-sym">{</span></li>
<li><a name="a1269"></a>            <span class="src-comm"># use default layout for errors</span></li>
<li><a name="a1270"></a>            <span class="src-inc">include</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineTRAX_LIB_ROOT">TRAX_LIB_ROOT</a></span>.<span class="src-str">&quot;/templates/error.phtml&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a1271"></a>        <span class="src-sym">} </span><span class="src-key">elseif</span><span class="src-sym">(</span><span class="src-id"><a href="../PHPonTrax/_data_config_environment_php.html#defineDEBUG">DEBUG</a></span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1272"></a>            echo <span class="src-str">&quot;&lt;font face=\&quot;verdana, arial, helvetica, sans-serif\&quot;&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1273"></a>            echo <span class="src-str">&quot;</span><span class="src-str">&lt;<span class="src-id">h1</span>&gt;<span class="src-var">$error_heading</span>&lt;/<span class="src-id">h1</span>&gt;\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1274"></a>            echo <span class="src-str">&quot;</span><span class="src-str">&lt;<span class="src-id">p</span>&gt;<span class="src-var">$error_message</span>&lt;/<span class="src-id">p</span>&gt;\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1275"></a>            <span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$trace</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a1276"></a>                echo <span class="src-str">&quot;&lt;pre style=\&quot;background-color: #eee;padding:10px;font-size: 11px;\&quot;&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1277"></a>                echo <span class="src-str">&quot;</span><span class="src-str">&lt;<span class="src-id">code</span>&gt;<span class="src-var">$trace</span>&lt;/<span class="src-id">code</span>&gt;&lt;/<span class="src-id">pre</span>&gt;\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1278"></a>            <span class="src-sym">}</span></li>
<li><a name="a1279"></a>            echo <span class="src-str">&quot;&lt;/font&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1280"></a>        <span class="src-sym">} </span><span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1281"></a>            echo <span class="src-str">&quot;&lt;font face=\&quot;verdana, arial, helvetica, sans-serif\&quot;&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1282"></a>            echo <span class="src-str">&quot;&lt;h2&gt;Application Error&lt;/h2&gt;Trax application failed to start properly&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1283"></a>            echo <span class="src-str">&quot;&lt;/font&gt;\n&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1284"></a>        <span class="src-sym">}</span></li>
<li><a name="a1285"></a>    <span class="src-sym">}</span></li>
<li><a name="a1286"></a>&nbsp;</li>
<li><a name="a1287"></a><span class="src-sym">}</span></li>
<li><a name="a1288"></a>&nbsp;</li>
<li><a name="a1289"></a><span class="src-comm">// -- set Emacs parameters --</span></li>
<li><a name="a1290"></a><span class="src-comm">// Local variables:</span></li>
<li><a name="a1291"></a><span class="src-comm">// tab-width: 4</span></li>
<li><a name="a1292"></a><span class="src-comm">// c-basic-offset: 4</span></li>
<li><a name="a1293"></a><span class="src-comm">// c-hanging-comment-ender-p: nil</span></li>
<li><a name="a1294"></a><span class="src-comm">// indent-tabs-mode: nil</span></li>
<li><a name="a1295"></a><span class="src-comm">// End:</span></li>
<li><a name="a1296"></a><span class="src-php">?&gt;</span></li>
</ol></pre></div>
</div>
        <div class="credit">
		    <hr />
		    Documentation generated on Thu, 04 May 2006 19:47:01 -0600 by <a href="http://www.phpdoc.org">phpDocumentor 1.3.0RC4</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>
Return current item: PHP on Trax