You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
That means that the list of posts described in our example would require only three files to work in symfony, as shown in Listings 2-11, 2-12, and 2-13.
338
338
@@ -419,7 +419,7 @@ Figure 2-3 shows a sample code organization for a weblog project, in a project/a
419
419
420
420
Figure 2-3 - Example of code organization
421
421
422
-

422
+

This process justifies the structure of the filter classes. They all extend the `sfFilter` class, and contain one `execute()` method, expecting a `$filterChain` object as parameter. Somewhere in this method, the filter passes to the next filter in the chain by calling `$filterChain->execute()`. See Listing 6-28 for an example. So basically, filters are divided into two parts:
Copy file name to clipboardExpand all lines: gentle-introduction/en/07-Inside-the-View-Layer.markdown
+4-4
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ The template shown in Listing 7-1 is not a valid XHTML document. The `DOCTYPE` d
130
130
131
131
Figure 7-1 - Decorating a template with a layout
132
132
133
-

133
+

134
134
135
135
Listing 7-5 shows the default page layout, located in the application `templates/` directory.
136
136
@@ -226,7 +226,7 @@ A partial is a reusable chunk of template code. For instance, in a publication a
226
226
227
227
Figure 7-2 - Reusing partials in templates
228
228
229
-

229
+

230
230
231
231
Just like templates, partials are files located in the `templates/` directory, and they contain HTML code with embedded PHP. A partial file name always starts with an underscore (`_`), and that helps to distinguish partials from templates, since they are located in the same `templates/` folders.
232
232
@@ -318,7 +318,7 @@ For this example, shown in Listings 7-11 and 7-12, the component will be kept in
318
318
319
319
Figure 7-3 - Using components in templates
320
320
321
-

321
+

322
322
323
323
Listing 7-11 - The Components Class, in `modules/news/actions/components.class.php`
324
324
@@ -384,7 +384,7 @@ Imagine a layout with one zone for the template and two slots: one for the sideb
384
384
385
385
Figure 7-4 - Layout slots defined in a template
386
386
387
-

387
+

388
388
389
389
Seeing some code will clarify things further. To include a slot, use the `include_slot()` helper. The `has_slot()` helper returns `true` if the slot has been defined before, providing a fallback mechanism as a bonus. For instance, define a placeholder for a `'sidebar'` slot in the layout and its default content as shown in Listing 7-14.
Copy file name to clipboardExpand all lines: gentle-introduction/en/09-Links-and-the-Routing-System.markdown
+2-2
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ This URL conveys information about the application's architecture and database.
26
26
27
27
Figure 9-1 - URLs appear in many places, such as in search results
28
28
29
-

29
+

30
30
31
31
* If one URL has to be changed (for instance, if a script name or one of its parameters is modified), every link to this URL must be changed as well. It means that modifications in the controller structure are heavyweight and expensive, which is not ideal in agile development.
32
32
@@ -52,7 +52,7 @@ The benefits are immense:
52
52
53
53
Figure 9-2 - URLs can convey additional information about a page, like the publication date
54
54
55
-

55
+

56
56
57
57
* URLs written in paper documents are easier to type and remember. If your company website appears as `http://www.example.com/controller/web/index.jsp?id=ERD4` on your business card, it will probably not receive many visits.
58
58
* The URL can become a command-line tool of its own, to perform actions or retrieve information in an intuitive way. Applications offering such a possibility are faster to use for power users.
Copy file name to clipboardExpand all lines: gentle-introduction/en/12-Caching.markdown
+5-5
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ Actions displaying static information (not depending on database or session-depe
36
36
37
37
Figure 12-1 - Caching an action
38
38
39
-

39
+

40
40
41
41
For instance, consider a `user/list` action that returns the list of all users of a website. Unless a user is modified, added, or removed (and this matter will be discussed later in the "Removing Items from the Cache" section), this list always displays the same information, so it is a good candidate for caching.
42
42
@@ -96,7 +96,7 @@ Chapter 7 explained how to reuse code fragments across several templates, using
96
96
97
97
Figure 12-2 - Caching a partial or component
98
98
99
-

99
+

100
100
101
101
For instance, Listing 12-4 shows how to edit the `cache.yml` file to enable the cache on a `_my_partial.php` partial located in the `user` module. Note that the `with_layout` setting doesn't make sense in this case.
102
102
@@ -141,7 +141,7 @@ Action caching applies to only a subset of actions. For the other actions--those
141
141
142
142
Figure 12-3 - Caching a template fragment
143
143
144
-

144
+

145
145
146
146
For instance, you may have a list of users that shows a link of the last-accessed user, and this information is dynamic. The `cache()` helper defines the parts of a template that are to be put in the cache. See Listing 12-5 for details on the syntax.
147
147
@@ -485,7 +485,7 @@ The last number on the right side of the debug toolbar is the duration of the re
485
485
486
486
Figure 12-4 - Web debug toolbar for pages using caching
487
487
488
-

488
+

489
489
490
490
The debug toolbar also shows the number of database queries executed during the processing of the request, and the detail of the durations per category (click the total duration to display the detail). Monitoring this data, in conjunction with the total duration, will help you do fine measures of the performance improvements brought by the cache.
491
491
@@ -501,7 +501,7 @@ When the web debug toolbar is enabled, the cached elements are identified in a p
501
501
502
502
Figure 12-5 - Identification for cached elements in a page
503
503
504
-

504
+

0 commit comments