Location: PHPKode > projects > PHP on Trax > johnpipi-trax-f599562/trax/doc/PHPonTrax/tutorial_simpleapp.pkg.html
<html>
<head>
<title>Build A Simple Trax Application</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 />
		<b>Tutorials/Manuals:</b><br />
					<strong>Package-level:</strong>
							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_PHPonTrax.pkg.html">PHP On Trax</a>
<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_rails_examples.pkg.html">Examples From The Rails Book</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_simpleapp.pkg.html">Build A Simple Trax Application</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_database.pkg.html">Create A Database and User</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_advbuild.pkg.html">Advanced Application Build Topics</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_naming.pkg.html">The Trax Naming Convention</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_troubleshoot.pkg.html">Troubleshooting</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_reference.pkg.html">Reference</a>
</ul>

</li></ul>


										<strong>Class-level:</strong>
							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecordHelper.cls.html">ActiveRecordHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormTagHelper.cls.html">FormTagHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Helpers.cls.html">Helpers</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_UrlHelper.cls.html">UrlHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormHelper.cls.html">FormHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_InputFilter.cls.html">InputFilter</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionMailer.cls.html">ActionMailer</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ApplicationController.cls.html">ApplicationController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionController.cls.html">ActionController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecord.cls.html">ActiveRecord</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_DateHelper.cls.html">DateHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Router.cls.html">Router</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormOptionsHelper.cls.html">FormOptionsHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_TraxGenerator.cls.html">TraxGenerator</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Session.cls.html">Session</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Inflector.cls.html">Inflector</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecordError.cls.html">ActiveRecordError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionControllerError.cls.html">ActionControllerError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ScaffoldController.cls.html">ScaffoldController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Dispatcher.cls.html">Dispatcher</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_TraxError.cls.html">TraxError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ApplicationMailer.cls.html">ApplicationMailer</a>
</ul>


							                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../PHPonTrax/_vendor_trax_action_controller_php.html">		action_controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_mailer_php.html">		action_mailer.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_php.html">		action_view.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_active_record_php.html">		active_record.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_active_record_helper_php.html">		active_record_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_add_phtml.html">		add.phtml
		</a><br>
			<a href="../PHPonTrax/_data_app_controllers_application_php.html">		application.php
		</a><br>
			<a href="../PHPonTrax/_data_app_views_layouts_application_phtml.html">		application.phtml
		</a><br>
			<a href="../PHPonTrax/_data_app_helpers_application_helper_php.html">		application_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_app_application_mailer_php.html">		application_mailer.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_asset_tag_helper_php.html">		asset_tag_helper.php
		</a><br>
			<a href="../PHPonTrax/_test_layouts_catalog_phtml.html">		catalog.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_controller_php.html">		controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_controller_php.html">		controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html">		date_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_development_php.html">		development.php
		</a><br>
			<a href="../PHPonTrax/_data_public_dispatch_php.html">		dispatch.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_dispatcher_php.html">		dispatcher.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_edit_phtml.html">		edit.phtml
		</a><br>
			<a href="../PHPonTrax/_data_config_environment_php.html">		environment.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_error_phtml.html">		error.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_helper_php.html">		form_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_options_helper_php.html">		form_options_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_form_scaffolding_phtml.html">		form_scaffolding.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_tag_helper_php.html">		form_tag_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_script_generate_php.html">		generate.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_helper_php.html">		helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_php.html">		helpers.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_index_phtml.html">		index.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_inflector_php.html">		inflector.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_input_filter_php.html">		input_filter.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_javascript_helper_php.html">		javascript_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_layout_phtml.html">		layout.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_layout_phtml.html">		layout.phtml
		</a><br>
			<a href="../PHPonTrax/_makepkg_php.html">		makepkg.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_model_php.html">		model.php
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_production_php.html">		production.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_router_php.html">		router.php
		</a><br>
			<a href="../PHPonTrax/_data_config_routes_php.html">		routes.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_scaffold_controller_php.html">		scaffold_controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_session_php.html">		session.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_show_phtml.html">		show.phtml
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_test_php.html">		test.php
		</a><br>
			<a href="../PHPonTrax/_trax_php.html">		trax.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_trax_exceptions_php.html">		trax_exceptions.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_trax_generator_php.html">		trax_generator.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_url_helper_php.html">		url_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_view_phtml.html">		view.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_add_phtml.html">		view_add.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_edit_phtml.html">		view_edit.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_index_phtml.html">		view_index.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_show_phtml.html">		view_show.phtml
		</a><br>
	  </div><br />

      
            <b>Classes:</b><br />
        <div class="package">
		    		<a href="../PHPonTrax/.html"></a><br />
	    		<a href="../PHPonTrax/ActionController.html">ActionController</a><br />
	    		<a href="../PHPonTrax/ActionControllerError.html">ActionControllerError</a><br />
	    		<a href="../PHPonTrax/ActionMailer.html">ActionMailer</a><br />
	    		<a href="../PHPonTrax/ActiveRecord.html">ActiveRecord</a><br />
	    		<a href="../PHPonTrax/ActiveRecordError.html">ActiveRecordError</a><br />
	    		<a href="../PHPonTrax/ActiveRecordHelper.html">ActiveRecordHelper</a><br />
	    		<a href="../PHPonTrax/ApplicationController.html">ApplicationController</a><br />
	    		<a href="../PHPonTrax/ApplicationMailer.html">ApplicationMailer</a><br />
	    		<a href="../PHPonTrax/AssetTagHelper.html">AssetTagHelper</a><br />
	    		<a href="../PHPonTrax/DateHelper.html">DateHelper</a><br />
	    		<a href="../PHPonTrax/Dispatcher.html">Dispatcher</a><br />
	    		<a href="../PHPonTrax/FormHelper.html">FormHelper</a><br />
	    		<a href="../PHPonTrax/FormOptionsHelper.html">FormOptionsHelper</a><br />
	    		<a href="../PHPonTrax/FormTagHelper.html">FormTagHelper</a><br />
	    		<a href="../PHPonTrax/Helpers.html">Helpers</a><br />
	    		<a href="../PHPonTrax/Inflector.html">Inflector</a><br />
	    		<a href="../PHPonTrax/InputFilter.html">InputFilter</a><br />
	    		<a href="../PHPonTrax/JavaScriptHelper.html">JavaScriptHelper</a><br />
	    		<a href="../PHPonTrax/Router.html">Router</a><br />
	    		<a href="../PHPonTrax/ScaffoldController.html">ScaffoldController</a><br />
	    		<a href="../PHPonTrax/Session.html">Session</a><br />
	    		<a href="../PHPonTrax/TraxError.html">TraxError</a><br />
	    		<a href="../PHPonTrax/TraxGenerator.html">TraxGenerator</a><br />
	    		<a href="../PHPonTrax/UrlHelper.html">UrlHelper</a><br />
	  </div>

                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"../PHPonTrax/tutorial_rails_examples.pkg.html">Prev</a></td>
<td width="80%" align="center" valign="bottom"></td>
<td width="10%" align="right" valign="bottom"><a href=
"../PHPonTrax/tutorial_database.pkg.html">Next</a></td>
</tr>
</table>
<span><a name="simpleapp"></a><h2 class="title">Build A Simple Trax Application</h2><p>Let's learn about Trax by using it to build a simple
   application. We assume you have installed Trax on your system as
   described <a href="../PHPonTrax/tutorial_PHPonTrax.pkg.html#welcome.welcome-how">above</a>.
We'll also assume that we are building our web site in the Apache
  <a href="http://httpd.apache.org/docs/2.0/mod/core.html#documentroot">DocumentRoot</a>
  directory which is set to <code>/var/www/html</code>, and
  that the computer we are building on can be accessed from a browser as
  <code>localhost</code> .</p>

 <a name="simpleapp.simpleapp_workarea"></a><h3 class="title">Create The Trax Work Area</h3><p>The first step is to create a Trax work area for the site.
   This work area will hold files describing the site.  For security
   reasons, we don't want those files accessible from the Internet,
   so we avoid putting them under <code>/var/www/html</code>.
   We use the <span class="cmd-title">trax</span> command and give it a location to
   build the work area.  We choose the
   <code>/var/www/trax</code> directory because it is not
   accessible from the Internet.
   <pre class="example">$ <strong>trax /var/www/trax</strong>
/var/www/trax// created
/var/www/trax/lib/ created
/var/www/trax/vendor/ created
/var/www/trax/script/ created
/var/www/trax/script/generate.php created
/var/www/trax/README created
/var/www/trax/db/ created
/var/www/trax/components/ created
/var/www/trax/public/ created
/var/www/trax/public/stylesheets/ created
/var/www/trax/public/images/ created
/var/www/trax/public/robots.txt created
/var/www/trax/public/dispatch.php created
/var/www/trax/public/.htaccess created
/var/www/trax/public/index.html created
/var/www/trax/public/javascripts/ created
/var/www/trax/public/javascripts/controls.js created
/var/www/trax/public/javascripts/dragdrop.js created
/var/www/trax/public/javascripts/effects.js created
/var/www/trax/public/javascripts/prototype.js created
/var/www/trax/app/ created
/var/www/trax/app/views/ created
/var/www/trax/app/views/layouts/ created
/var/www/trax/app/views/layouts/application.phtml created
/var/www/trax/app/helpers/ created
/var/www/trax/app/helpers/application_helper.php created
/var/www/trax/app/models/ created
/var/www/trax/app/controllers/ created
/var/www/trax/app/controllers/application.php created
/var/www/trax/app/application_mailer.php created
/var/www/trax/test/ created
/var/www/trax/config/ created
/var/www/trax/config/routes.php created
/var/www/trax/config/environment.php created
/var/www/trax/config/environments/ created
/var/www/trax/config/environments/production.php created
/var/www/trax/config/environments/test.php created
/var/www/trax/config/environments/development.php created
/var/www/trax/config/database.ini created
/var/www/trax/log/ created
/var/www/trax/log/test.log created
/var/www/trax/log/production.log created
/var/www/trax/log/server.log created
/var/www/trax/log/development.log created
/var/www/trax/doc/ created
/var/www/trax/doc/README_FOR_APP created</pre>
   <span class="cmd-title">trax</span> creates a number of directories and
   installs files in some of them.  <span class="cmd-title">trax</span> tells you
   what it is doing.</p>

  <p>One of the directories <span class="cmd-title">trax</span> created is
   <code>/var/www/trax/public</code> .  Let's look inside:
   <pre class="example">$ <strong>ls -Al /var/www/trax/public</strong>
total 28
-rw-rw-r--  1 haas haas  217 Mar 26 19:55 dispatch.php
-rw-rw-r--  1 haas haas 1039 Mar 26 19:55 .htaccess
drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 images
-rw-rw-r--  1 haas haas 2829 Mar 26 19:55 index.html
drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 javascripts
-rw-rw-r--  1 haas haas  106 Mar 26 19:55 robots.txt
drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 stylesheets</pre>
   These files are meant to be visible to the Internet, unlike the
   other files in the Trax work area.  We need to move them to where
   Apache can serve them:
   <pre class="example">$ <strong>mv /var/www/trax/public/* /var/www/trax/public/.htaccess /var/www/html</strong></pre>
   Now a browser should be able to visit the
   <code>index.html</code> file.  We verify this by browsing
   <code>http://localhost</code> where we see
   <strong>Congratulations, you've put PHP on Trax!</strong>
   (if you don't see this, refer to <a href="../PHPonTrax/tutorial_troubleshoot.pkg.html">Troubleshooting</a>).</p>

  <p>The <code>index.html</code> file has done its work by
   showing us that Apache accesses our directory.  It does not play
   any part in normal Trax operation, so we delete it:
   <pre class="example">$ <strong>rm /var/www/html/index.html</strong></pre>
   and again browse to <code>http://localhost</code>.  This time
   we see <strong>Controller not found</strong> (if you don't
   see this, refer to <a href="../PHPonTrax/tutorial_troubleshoot.pkg.html">Troubleshooting</a>).</p>

  <p>This completes the basic installation of Trax.</p><hr /></span>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="../PHPonTrax/tutorial_rails_examples.pkg.html">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"../PHPonTrax/tutorial_PHPonTrax.pkg.html">Up</a></td>
<td width="33%" align="right" valign="top"><a href=
"../PHPonTrax/tutorial_database.pkg.html">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">Examples From The Rails Book</td>
<td width="34%" align="center" valign="top">PHP On Trax</td>
<td width="33%" align="right" valign="top">Create A Database and User</td>
</tr>
</table>
        <div class="credit">
		    <hr />
		    Documentation generated on Thu, 04 May 2006 19:46:54 -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