[ Index ]
 

Code source de PHPonTrax 2.6.6-svn

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/doc/tutorials/PHPonTrax/ -> simpleapp.pkg (source)

   1  {@toc}
   2  <refsect1 id="{@id simpleapp}">
   3   <title>Build A Simple Trax Application</title>
   4    <para>Let's learn about Trax by using it to build a simple
   5     application. We assume you have installed Trax on your system as
   6     described {@tutorial PHPonTrax.pkg#welcome.welcome-how above}.
   7  We'll also assume that we are building our web site in the Apache
   8    {@link http://httpd.apache.org/docs/2.0/mod/core.html#documentroot DocumentRoot}
   9    directory which is set to <literal>/var/www/html</literal>, and
  10    that the computer we are building on can be accessed from a browser as
  11    <literal>localhost</literal> .</para>
  12  
  13   <refsect2 id="{@id simpleapp_workarea}">
  14    <title>Create The Trax Work Area</title>
  15    <para>The first step is to create a Trax work area for the site.
  16     This work area will hold files describing the site.  For security
  17     reasons, we don't want those files accessible from the Internet,
  18     so we avoid putting them under <literal>/var/www/html</literal>.
  19     We use the <command>trax</command> command and give it a location to
  20     build the work area.  We choose the
  21     <literal>/var/www/trax</literal> directory because it is not
  22     accessible from the Internet.
  23     <example>
  24  $ <important>trax /var/www/trax</important>
  25  /var/www/trax// created
  26  /var/www/trax/lib/ created
  27  /var/www/trax/vendor/ created
  28  /var/www/trax/script/ created
  29  /var/www/trax/script/generate.php created
  30  /var/www/trax/README created
  31  /var/www/trax/db/ created
  32  /var/www/trax/components/ created
  33  /var/www/trax/public/ created
  34  /var/www/trax/public/stylesheets/ created
  35  /var/www/trax/public/images/ created
  36  /var/www/trax/public/robots.txt created
  37  /var/www/trax/public/dispatch.php created
  38  /var/www/trax/public/.htaccess created
  39  /var/www/trax/public/index.html created
  40  /var/www/trax/public/javascripts/ created
  41  /var/www/trax/public/javascripts/controls.js created
  42  /var/www/trax/public/javascripts/dragdrop.js created
  43  /var/www/trax/public/javascripts/effects.js created
  44  /var/www/trax/public/javascripts/prototype.js created
  45  /var/www/trax/app/ created
  46  /var/www/trax/app/views/ created
  47  /var/www/trax/app/views/layouts/ created
  48  /var/www/trax/app/views/layouts/application.phtml created
  49  /var/www/trax/app/helpers/ created
  50  /var/www/trax/app/helpers/application_helper.php created
  51  /var/www/trax/app/models/ created
  52  /var/www/trax/app/controllers/ created
  53  /var/www/trax/app/controllers/application.php created
  54  /var/www/trax/app/application_mailer.php created
  55  /var/www/trax/test/ created
  56  /var/www/trax/config/ created
  57  /var/www/trax/config/routes.php created
  58  /var/www/trax/config/environment.php created
  59  /var/www/trax/config/environments/ created
  60  /var/www/trax/config/environments/production.php created
  61  /var/www/trax/config/environments/test.php created
  62  /var/www/trax/config/environments/development.php created
  63  /var/www/trax/config/database.ini created
  64  /var/www/trax/log/ created
  65  /var/www/trax/log/test.log created
  66  /var/www/trax/log/production.log created
  67  /var/www/trax/log/server.log created
  68  /var/www/trax/log/development.log created
  69  /var/www/trax/doc/ created
  70  /var/www/trax/doc/README_FOR_APP created
  71     </example>
  72     <command>trax</command> creates a number of directories and
  73     installs files in some of them.  <command>trax</command> tells you
  74     what it is doing.</para>
  75  
  76    <para>One of the directories <command>trax</command> created is
  77     <literal>/var/www/trax/public</literal> .  Let's look inside:
  78     <example>
  79  $ <important>ls -Al /var/www/trax/public</important>
  80  total 28
  81  -rw-rw-r--  1 haas haas  217 Mar 26 19:55 dispatch.php
  82  -rw-rw-r--  1 haas haas 1039 Mar 26 19:55 .htaccess
  83  drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 images
  84  -rw-rw-r--  1 haas haas 2829 Mar 26 19:55 index.html
  85  drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 javascripts
  86  -rw-rw-r--  1 haas haas  106 Mar 26 19:55 robots.txt
  87  drwxrwxr-x  2 haas haas 4096 Mar 26 19:55 stylesheets
  88     </example>
  89     These files are meant to be visible to the Internet, unlike the
  90     other files in the Trax work area.  We need to move them to where
  91     Apache can serve them:
  92     <example>
  93  $ <important>mv /var/www/trax/public/* /var/www/trax/public/.htaccess /var/www/html</important>
  94     </example>
  95     Now a browser should be able to visit the
  96     <literal>index.html</literal> file.  We verify this by browsing
  97     <literal>http://localhost</literal> where we see
  98     <important>Congratulations, you've put PHP on Trax!</important>
  99     (if you don't see this, refer to {@tutorial troubleshoot.pkg}).</para>
 100  
 101    <para>The <literal>index.html</literal> file has done its work by
 102     showing us that Apache accesses our directory.  It does not play
 103     any part in normal Trax operation, so we delete it:
 104     <example>
 105  $ <important>rm /var/www/html/index.html</important>
 106     </example>
 107     and again browse to <literal>http://localhost</literal>.  This time
 108     we see <important>Controller not found</important> (if you don't
 109     see this, refer to {@tutorial troubleshoot.pkg}).</para>
 110  
 111    <para>This completes the basic installation of Trax.</para>
 112  
 113   </refsect2>
 114  
 115  <!--
 116  Local variables:
 117  mode: xml
 118  c-basic-offset: 1
 119  indent-tabs-mode: nil
 120  End:
 121  -->
 122  
 123  </refsect1>


Généré le : Sun Feb 25 20:04:38 2007 par Balluche grâce à PHPXref 0.7