X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FMoreCatalystBasics.pod;h=3ec9249593b78d5914f09e6f4a9303df80454bc3;hp=1c6f48f13e92a841cac8fd993513564d443ae01a;hb=8a0214b4275e310f64f74c2a250a20c01efd4c66;hpb=518f3851fec88053502a9d18e163841fbe031c75 diff --git a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod index 1c6f48f..3ec9249 100644 --- a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod @@ -151,7 +151,7 @@ C (or any other format supported by L and L). If you are using a versions of Catalyst::Devel prior to 1.06, you can convert to the newer format by -simply creating the C file manually and deleting +simply creating the C file manually and deleting C. The default contents of C should only consist of one line: C. @@ -348,18 +348,20 @@ L =back -Both are similar, but C merely creates the C +Both helpers are similar. C creates the C file and leaves the creation of any hierarchical template organization entirely up to you. (It also creates a C file for testing; -test cases will be discussed in Part 8.) On the other hand, the -C helper creates a modular and hierarchical view layout with +test cases will be discussed in Part 8.) C, on the other hand, +creates a modular and hierarchical view layout with separate Template Toolkit (TT) files for common header and footer information, configuration values, a CSS stylesheet, and more. -While TTSite is useful to bootstrap a project, most in the Catalyst -community recommend that it's easier to learn both Catalyst and -Template Toolkit if you use the more basic TT approach. Consequently, -this tutorial will use "plain old TT." +While C was useful to bootstrap a project, its use is now +deprecated and to be considered historical. For most Catalyst +applications it adds redundant functionality and structure; many in the +Catalyst community recommend that it's easier to learn both Catalyst and +Template Toolkit if you use the more basic C approach. +Consequently, this tutorial will use "plain old TT." Enter the following command to enable the C style of view rendering for this tutorial: @@ -391,7 +393,7 @@ And update it to match: TEMPLATE_EXTENSION => '.tt2', # Set the location for TT files INCLUDE_PATH => [ - MyApp->path_to( 'root/src' ), + MyApp->path_to( 'root', 'src' ), ], ); @@ -400,7 +402,9 @@ quote. This changes the default extension for Template Toolkit from '.tt' to '.tt2' and changes the base directory for your template files from -C to C. +C to C. These changes from the default are done mostly +to facilitate the application we're developing in this tutorial; as with +most things Perl, there's more than one way to do it... =head2 Create a TT Template Page @@ -565,6 +569,8 @@ required if you do a single SQL statement on the command line). Use ".q" to exit from SQLite from the SQLite interactive mode and return to your OS command prompt. +For using other databases, such as PostgreSQL or MySQL, see +L. =head1 DATABASE ACCESS WITH C @@ -643,7 +649,6 @@ C<[$c-Emodel('DB::Books')-Eall]> and delete the next 2 lines): $c->stash->{template} = 'books/list.tt2'; } - B: You may see the C<$c-Emodel('DB::Book')> un-commented above written as C<$c-Emodel('DB')-Eresultset('Book')>. The two are equivalent. Either way, C<$c-Emodel> returns a @@ -806,7 +811,7 @@ Edit C and change it to match the following: TEMPLATE_EXTENSION => '.tt2', # Set the location for TT files INCLUDE_PATH => [ - MyApp->path_to( 'root/src' ), + MyApp->path_to( 'root', 'src' ), ], # Set to 1 for detailed timer stats in your HTML as comments TIMER => 0, @@ -858,7 +863,7 @@ For the tutorial, open C and input the following: - + @@ -996,7 +1001,7 @@ L as its base class (L is only being used by the helper to load the schema once and then create the static files for us) and C only contains a call to the -C method. You will also find that C +C method. You will also find that C contains a C subdirectory, with one file inside this directory for each of the tables in our simple database (C, C, and C). These three files were created @@ -1125,11 +1130,13 @@ Make sure that the application loads correctly and that you see the three dynamically created model class (one for each of the table-specific schema classes we created). -Then hit the URL L and be sure that -the book list is displayed. +Then hit the URL L and be sure that +the book list is displayed via the relationships established above. You +can leave the development server running for the next step if you wish. -You can leave the development server running for the next step if you -wish. +B You will not see the authors yet because the view does not yet +use the new relations. Read on to the next section where we update the +template to do that. =head1 UPDATING THE VIEW @@ -1171,15 +1178,23 @@ enabled, you should also now see five more C