Development

Changeset 7360

You must first sign up to be able to contribute.

Changeset 7360

Show
Ignore:
Timestamp:
02/06/08 09:21:41 (10 months ago)
Author:
fabien
Message:

doc: updated URLs for symfony 1.1 tutorials

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.1/tutorial/my-first-project.txt

    r6976 r7360  
    1313 
    1414To go fast, we will use the symfony sandbox (you can also download the 
    15 [final source code](http://www.symfony-project.com/downloads/my_first_project.tgz)). 
     15[final source code](http://www.symfony-project.org/downloads/my_first_project.tgz)). 
    1616It is an empty symfony project where all the required libraries are already included, 
    1717and where the basic configuration is already done. The great advantage of the sandbox 
     
    1919immediately. 
    2020 
    21 Get it here: [sf_sandbox.tgz](http://www.symfony-project.com/get/sf_sandbox.tgz), 
     21Get it here: [sf_sandbox.tgz](http://www.symfony-project.org/get/sf_sandbox.tgz), 
    2222and unpack it in your root web directory. Refer to the included `README` file for more 
    2323information. The resulting file structure should look like: 
     
    5454You can also install symfony in a custom folder and setup your web server with 
    5555a Virtual Host or an Alias. The symfony book contains detailed chapters about 
    56 [symfony installation](http://www.symfony-project.com/book/1.1/03-Running-Symfony) 
    57 and the [symfony directory structure](http://www.symfony-project.com/book/1.1/02-Exploring-Symfony-s-Code). 
     56[symfony installation](http://www.symfony-project.org/book/1_1/03-Running-Symfony) 
     57and the [symfony directory structure](http://www.symfony-project.org/book/1_1/02-Exploring-Symfony-s-Code). 
    5858 
    5959Initialize the data model 
     
    8383meaning and tabulations are forbidden, so remember to use spaces for indentation. 
    8484You will find more about YAML and the symfony configuration in the 
    85 [configuration chapter](http://www.symfony-project.com/book/1.1/05-Configuring-Symfony). 
     85[configuration chapter](http://www.symfony-project.org/book/1_1/05-Configuring-Symfony). 
    8686 
    8787This schema describes the structure of two the tables needed for the blog. 
     
    9999By default, symfony uses the Propel library for this purpose. Theses classes are 
    100100part of the **model** of our application 
    101 (find more in the [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
     101(find more in the [model chapter](http://www.symfony-project.org/book/1_1/08-Inside-the-Model-Layer)). 
    102102 
    103103Now, we need to convert the schema to SQL statements to initialize the database tables. 
     
    117117Change the DSN argument to match your settings (username, password, host, and database name) 
    118118and then create the database with the command line or a web interface (as described in 
    119 the [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
     119the [model chapter](http://www.symfony-project.org/book/1_1/08-Inside-the-Model-Layer)). 
    120120 
    121121Now type in the command line: 
     
    134134The `propel:insert-sql` command removes existing tables before adding the ones 
    135135of your `lib.model.schema.sql`, and there is no table to remove at that time. 
     136 
     137As we want to be able to create and edit the blog posts and comments, we also need to 
     138generate some forms based on our model schema: 
     139 
     140    $ php symfony propel:build-form 
     141 
     142This task generates classes in the `sf_sandbox/lib/form/` directory. 
     143These classes are used to manage our model objects as forms. 
    136144 
    137145Create the application 
     
    165173![post CRUD](/images/tutorials/first_crud.gif) 
    166174 
    167 Find more about [generators](http://www.symfony-project.com/book/1.1/14-Generators) 
     175Find more about [generators](http://www.symfony-project.org/book/1_1/14-Generators) 
    168176and the explanation of symfony projects 
    169 [structure](http://www.symfony-project.com/book/1.1/04-The-Basics-of-Page-Creation) 
     177[structure](http://www.symfony-project.org/book/1_1/04-The-Basics-of-Page-Creation) 
    170178(project, application, module). 
    171179 
     
    186194>     http://localhost/sf_sandbox/web/index.php/ 
    187195 
    188 Find more about [environments](http://www.symfony-project.com/book/1.1/05-Configuring-Symfony#Environments). 
     196Find more about [environments](http://www.symfony-project.org/book/1_1/05-Configuring-Symfony#Environments). 
    189197 
    190198Modify the layout 
     
    273281comment for your this post. 
    274282 
    275 Find more about [views and templates](http://www.symfony-project.com/book/1.1/07-Inside-the-View-Layer). 
     283Find more about [views and templates](http://www.symfony-project.org/book/1_1/07-Inside-the-View-Layer). 
    276284 
    277285Pass data from the action to the template 
     
    332340This is getting good. 
    333341 
    334 Find more about the [naming conventions](http://www.symfony-project.com/book/1.1/07-Inside-the-View-Layer) 
     342Find more about the [naming conventions](http://www.symfony-project.org/book/1_1/07-Inside-the-View-Layer) 
    335343linking an action to a template. 
    336344 
     
    410418You wanted a blog? You have a blog. 
    411419 
    412 Find more about [actions](http://www.symfony-project.com/book/1.1/06-Inside-the-Controller-Layer). 
     420Find more about [actions](http://www.symfony-project.org/book/1_1/06-Inside-the-Controller-Layer). 
    413421 
    414422Form Validation 
     
    483491![Form validation](/images/tutorials/first_form_validation.gif) 
    484492 
    485 Find more about [form validation](http://www.symfony-project.com/book/1.1/10-Forms). 
     493Find more about [form validation](http://www.symfony-project.org/book/1_1/10-Forms). 
    486494 
    487495Change the URL aspect 
     
    563571![Routed URLs](/images/tutorials/first_routing.gif) 
    564572 
    565 Find more about [smart URLs](http://www.symfony-project.com/book/1.1/09-Links-and-the-Routing-System). 
     573Find more about [smart URLs](http://www.symfony-project.org/book/1_1/09-Links-and-the-Routing-System). 
    566574 
    567575Cleanup in the frontend 
     
    602610    $ php symfony propel:init-admin backend comment Comment 
    603611 
    604 This time, we use the [admin generator](http://www.symfony-project.com/book/1.1/14-Generators). 
     612This time, we use the [admin generator](http://www.symfony-project.org/book/1_1/14-Generators). 
    605613It offers much more features and customization than the basic CRUD generator. 
    606614 
     
    751759![login form](/images/tutorials/first_login.gif) 
    752760 
    753 Find more about [security](http://www.symfony-project.com/book/1.1/06-Inside-the-Controller-Layer#Action%20Security). 
     761Find more about [security](http://www.symfony-project.org/book/1_1/06-Inside-the-Controller-Layer#Action%20Security). 
    754762 
    755763Conclusion 
  • doc/branches/1.1/tutorial/symfony-ajax.txt

    r5696 r7360  
    55-------- 
    66 
    7 Symfony has Ajax helpers that make programming an elaborate interface a piece of cake. This tutorial will show you step-by-step how to create an Ajax-powered symfony application in minutes. 
     7Symfony has Ajax helpers that make programming an elaborate interface a piece of cake. This tutorial will show you 
     8step-by-step how to create an Ajax-powered symfony application in minutes. 
    89 
    910Introduction 
    1011------------ 
    1112 
    12 Real lazy folks that can't stand reading long documentation are advised to watch the [online screencast](http://downloads.symfony-project.com/demo/cart/cart.mov) that demonstrates exactly what is written below. 
    13  
    14 Adding items to a shopping cart in common e-commerce applications isn't very close to the actual "add to cart" metaphor, since it requires clicking an "add to cart" button, watch a new page (the shopping cart), and then go back to the shop or checkout with buttons. 
    15  
    16 Ajax allows to get closer to the cart metaphor, by enabling drag-and-drop interactions and giving immediate visual feedback, without leaving the shop. 
    17  
    18 The target application of this tutorial will be a symfony ported version of the shopping cart demo published by [script.aculo.us](http://script.aculo.us/demos/shop) in [Rails](http://www.rubyonrails.com). It uses the [prototype](http://prototype.conio.net/) JavaScript framework (bundled with symfony) and some [script.aculo.us](http://script.aculo.us/) JavaScript that is the core of the JavaScript helpers. 
     13Real lazy folks that can't stand reading long documentation are advised to watch the [online 
     14screencast](http://www.symfony-project.org/screencast/cart) that demonstrates exactly what is written below. 
     15 
     16Adding items to a shopping cart in common e-commerce applications isn't very close to the actual "add to cart" metaphor, 
     17since it requires clicking an "add to cart" button, watch a new page (the shopping cart), and then go back to the shop or 
     18checkout with buttons. 
     19 
     20Ajax allows to get closer to the cart metaphor, by enabling drag-and-drop interactions and giving immediate visual 
     21feedback, without leaving the shop. 
     22 
     23The target application of this tutorial will be a symfony ported version of the shopping cart demo published by 
     24[script.aculo.us](http://script.aculo.us/demos/shop) in [Rails](http://www.rubyonrails.com). It uses the 
     25[prototype](http://prototype.conio.net/) JavaScript framework (bundled with symfony) and some 
     26[script.aculo.us](http://script.aculo.us/) JavaScript that is the core of the JavaScript helpers. 
    1927 
    2028Application Setup 
     
    3038    $ symfony init-module app cart 
    3139 
    32 Setup your web server to be able to access this new application (whether using a virtual host or an alias, as described in the [web server setup](http://www.symfony-project.com/cookbook/1_0/web_server) chapter of the documentation). For this example, let's assume that this module is accessible via a localhost: 
     40Setup your web server to be able to access this new application (whether using a virtual host or an alias, as described in 
     41the [web server setup](http://www.symfony-project.org/cookbook/1_1/web_server) chapter of the documentation). For this 
     42example, let's assume that this module is accessible via a localhost: 
    3343 
    3444    http://localhost/cart/ 
     
    3646Congratulations, it says. 
    3747 
    38 Your app must have access to the symfony JavaScript libraries. If your app doesn't work, check you can access these libraries within your browser (test `http://localhost/sf/prototype/js/prototype.js` for example). If not, you have 3 different ways to fix this problem: 
     48Your app must have access to the symfony JavaScript libraries. If your app doesn't work, check you can access these 
     49libraries within your browser (test `http://localhost/sf/prototype/js/prototype.js` for example). If not, you have 3 
     50different ways to fix this problem: 
    3951 
    4052* configure Apache with the following `Alias`: 
     
    5668------------- 
    5769 
    58 First, you need to create a list of items to be purchased. To keep the project simple, the element list is accessed via a simple `getProducts()` method of the `cart` actions class. The shopping cart is a simple parameter of the `sfUser` object, set with the Attribute [parameter holder](http://www.symfony-project.com/content/book/page/parameter_holder.html). Modify the `sfdemo/apps/app/modules/cart/actions/actions.class.php` to: 
     70First, you need to create a list of items to be purchased. To keep the project simple, the element list is accessed via a 
     71simple `getProducts()` method of the `cart` actions class. The shopping cart is a simple parameter of the `sfUser` object, 
     72set with the Attribute [parameter holder](http://www.symfony-project.org/book/1_1/02-Exploring-Symfony-s-Code#Parameter%20Holders). Modify 
     73the `sfdemo/apps/app/modules/cart/actions/actions.class.php` to: 
    5974 
    6075    [php] 
     
    7388    } 
    7489 
    75 The main page of the `cart` module will contain a list of items, and a zone to drag items to. This zone is the shopping cart. So open the template `sfdemo/apps/app/modules/cart/templates/indexSuccess.php` and write in: 
     90The main page of the `cart` module will contain a list of items, and a zone to drag items to. This zone is the shopping 
     91cart. So open the template `sfdemo/apps/app/modules/cart/templates/indexSuccess.php` and write in: 
    7692 
    7793    [php] 
     
    98114    </div> 
    99115 
    100 You can see that products are shown as images. Use the images available in [this archive](http://www.symfony-project.com/downloads/demo/cart/products.tgz), and put them in the `sfdemo/web/images/` directory. In addition, part of the styling was done for you, so it is recommended that you upload [this stylesheet](http://www.symfony-project.com/downloads/demo/cart/cart.css) to the `sfdemo/web/css/` directory and add a `view.yml` in the `sfdemo/apps/app/modules/cart/config/` directory with the following content: 
     116You can see that products are shown as images. Use the images available in [this 
     117archive](http://www.symfony-project.org/downloads/demo/cart/products.tgz), and put them in the `sfdemo/web/images/` 
     118directory. In addition, part of the styling was done for you, so it is recommended that you upload [this 
     119stylesheet](http://www.symfony-project.org/downloads/demo/cart/cart.css) to the `sfdemo/web/css/` directory and add a 
     120`view.yml` in the `sfdemo/apps/app/modules/cart/config/` directory with the following content: 
    101121 
    102122    all: 
     
    110130----------------- 
    111131 
    112 The cart content will change as you drag items to it. This means that the content of the cart in the template must be in an independent file. Use the `include_partial()` helper for that. The items in the shopping cart will be stored in divs with `float:left` style, so a clearing div is necessary after the container. So change the end of the `indexSuccess.php` template to: 
     132The cart content will change as you drag items to it. This means that the content of the cart in the template must be in 
     133an independent file. Use the `include_partial()` helper for that. The items in the shopping cart will be stored in divs 
     134with `float:left` style, so a clearing div is necessary after the container. So change the end of the `indexSuccess.php` 
     135template to: 
    113136 
    114137    [php] 
     
    124147    </div> 
    125148 
    126 The `include_partial()` helper will include a `_cart.php` file, and look for this file in the `sfdemo/apps/app/modules/cart/templates/` directory. Create it with the following content: 
     149The `include_partial()` helper will include a `_cart.php` file, and look for this file in the 
     150`sfdemo/apps/app/modules/cart/templates/` directory. Create it with the following content: 
    127151 
    128152    [php] 
     
    144168    <?php endif; ?>  
    145169 
    146 If the cart contains items, they appear as images, as many times as they are added; the quantity is be displayed after each series. 
     170If the cart contains items, they appear as images, as many times as they are added; the quantity is be displayed after 
     171each series. 
    147172 
    148173Now watch again the shopping cart at: 
     
    171196    <?php endforeach; ?> 
    172197 
    173 This adds a 'draggable' behavior to each of the images of the list of products. The `revert` option will make images go back to their origin position when released (unless received by a receiving element). 
    174  
    175 Now, define the cart as a receiving element. You just need to define which part of the template will have to be updated when the event occurs, which action will be called for its content, and which type of draggable elements can be dragged into it. Use the `drop_receiving_elements` JavaScript helper for that: 
     198This adds a 'draggable' behavior to each of the images of the list of products. The `revert` option will make images go 
     199back to their origin position when released (unless received by a receiving element). 
     200 
     201Now, define the cart as a receiving element. You just need to define which part of the template will have to be updated 
     202when the event occurs, which action will be called for its content, and which type of draggable elements can be dragged 
     203into it. Use the `drop_receiving_elements` JavaScript helper for that: 
    176204 
    177205    [php] 
     
    182210    )) ?> 
    183211 
    184 Now try again, and move the products to the cart: it works. When a draggable item is dragged to the receiving element, an XMLHTTPRequest is sent to the `add` action, and the result is displayed in the `items` div. The thing is, the `add` action of the `cart` module is not defined yet... 
     212Now try again, and move the products to the cart: it works. When a draggable item is dragged to the receiving element, an 
     213XMLHTTPRequest is sent to the `add` action, and the result is displayed in the `items` div. The thing is, the `add` action 
     214of the `cart` module is not defined yet... 
    185215 
    186216Define the Updating Action 
     
    210240This action looks for the parameter sent by the JavaScript (the id of the dragged item) and adds it to the cart. 
    211241 
    212 The result of the `add` action will be the `addSuccess.php` template. It is a simple inclusion of the `_cart.php` partial, but this time it is necessary to pass the products as a parameter : 
     242The result of the `add` action will be the `addSuccess.php` template. It is a simple inclusion of the `_cart.php` partial, 
     243but this time it is necessary to pass the products as a parameter : 
    213244 
    214245    [php] 
    215246    <?php include_partial('cart', array('products' => $products)) ?> 
    216247 
    217 This template must not use the global layout, so edit the `view.yml` in the `sfdemo/apps/app/modules/cart/config/` directory, and write in: 
     248This template must not use the global layout, so edit the `view.yml` in the `sfdemo/apps/app/modules/cart/config/` 
     249directory, and write in: 
    218250 
    219251    addSuccess: 
     
    229261------------------ 
    230262 
    231 You could stop now, but this shopping cart has a big default: while the cart is updated, the interface doesn't change and the user might be disoriented. This is a general issue of asynchronous requests: an indicator zone has to be added to show that the request is being processed. In addition, nothing tells the user when the dragged item is considered accepted by the cart, so the `hover` style of the `cart` div also has to be defined. 
     263You could stop now, but this shopping cart has a big default: while the cart is updated, the interface doesn't change and 
     264the user might be disoriented. This is a general issue of asynchronous requests: an indicator zone has to be added to show 
     265that the request is being processed. In addition, nothing tells the user when the dragged item is considered accepted by 
     266the cart, so the `hover` style of the `cart` div also has to be defined. 
    232267 
    233268To do that, edit the `indexSuccess.php` template and write in: 
     
    240275    </div> 
    241276 
    242 Save the 'indicator.gif' [image file](http://www.symfony-project.com/downloads/demo/cart/indicator.gif) to your `sfdemo/web/images/` directory. 
    243  
    244 Now, modify the `drop_receiving_element()` JavaScript helper call in the same template to show this new indicator while requests are processed and declare the hover style: 
     277Save the 'indicator.gif' [image file](http://www.symfony-project.org/downloads/demo/cart/indicator.gif) to your 
     278`sfdemo/web/images/` directory. 
     279 
     280Now, modify the `drop_receiving_element()` JavaScript helper call in the same template to show this new indicator while 
     281requests are processed and declare the hover style: 
    245282 
    246283    [php] 
     
    258295---------- 
    259296 
    260 The complete source of the demo can be [downloaded](http://www.symfony-project.com/downloads/demo/cart/project.tgz) and is available [online](http://www.symfony-project.com/demo/cart.html). You will notice a few minor differences with the code described in this tutorial (including a trash box), but the core behaviors are the same. 
    261  
    262 Until the full documentation of the JavaScript helpers is released, you can find more information about them in the [script.aculo.us documentation](http://wiki.script.aculo.us/scriptaculous/list?category=Controls). 
     297The complete source of the demo can be [downloaded](http://www.symfony-project.org/downloads/demo/cart/project.tgz) and is 
     298available [online](http://www.symfony-project.org/demo/cart.html). You will notice a few minor differences with the code 
     299described in this tutorial (including a trash box), but the core behaviors are the same. 
     300 
     301Until the full documentation of the JavaScript helpers is released, you can find more information about them in the 
     302[script.aculo.us documentation](http://wiki.script.aculo.us/scriptaculous/list?category=Controls).