Skip to content
This repository
Browse code

Using new template controls in docs

  • Loading branch information...
commit 45b2cbfddd0edb50e414af035de7fd271df2d518 1 parent 868d369
Ingo Schommer authored June 26, 2012
4  docs/en/howto/extend-cms-interface.md
Source Rendered
@@ -130,9 +130,9 @@ and replace it with the following:
130 130
 
131 131
 	:::ss
132 132
 	<ul>
133  
-		<% control BookmarkedPages %>
  133
+		<% loop BookmarkedPages %>
134 134
 		<li><a href="admin/page/edit/show/$ID">Edit "$Title"</a></li>
135  
-		<% end_control %>
  135
+		<% end_loop %>
136 136
 	</ul>
137 137
 
138 138
 ## Summary
16  docs/en/howto/grouping-dataobjectsets.md
Source Rendered
@@ -74,14 +74,14 @@ In this case, the `getTitleFirstLetter()` method defined earlier is used to brea
74 74
 	:::ss
75 75
 	<%-- Modules list grouped by TitleFirstLetter --%>
76 76
 	<h2>Modules</h2>
77  
-	<% control GroupedModules.GroupedBy(TitleFirstLetter) %>
  77
+	<% loop GroupedModules.GroupedBy(TitleFirstLetter) %>
78 78
 		<h3>$TitleFirstLetter</h3>
79 79
 		<ul>
80  
-			<% control Children %>
  80
+			<% loop Children %>
81 81
 				<li>$Title</li>
82  
-			<% end_control %>
  82
+			<% end_loop %>
83 83
 		</ul>
84  
-	<% end_control %>
  84
+	<% end_loop %>
85 85
 
86 86
 ## Grouping Sets By Month
87 87
 
@@ -133,14 +133,14 @@ The final step is the render this into the template using the [api:GroupedList->
133 133
 	:::ss
134 134
 	// Modules list grouped by the Month Posted
135 135
 	<h2>Modules</h2>
136  
-	<% control GroupedModulesByDate.GroupedBy(MonthCreated) %>
  136
+	<% loop GroupedModulesByDate.GroupedBy(MonthCreated) %>
137 137
 		<h3>$MonthCreated</h3>
138 138
 		<ul>
139  
-			<% control Children %>
  139
+			<% loop Children %>
140 140
 				<li>$Title ($Created.Nice)</li>
141  
-			<% end_control %>
  141
+			<% end_loop %>
142 142
 		</ul>
143  
-	<% end_control %>
  143
+	<% end_loop %>
144 144
 
145 145
 ## Related
146 146
 
8  docs/en/howto/pagination.md
Source Rendered
@@ -32,9 +32,9 @@ The first step is to simply list the objects in the template:
32 32
 
33 33
 	:::ss
34 34
 	<ul>
35  
-		<% control PaginatedPages %>
  35
+		<% loop PaginatedPages %>
36 36
 			<li><a href="$Link">$Title</a></li>
37  
-		<% end_control %>
  37
+		<% end_loop %>
38 38
 	</ul>
39 39
 
40 40
 By default this will display 10 pages at a time. The next step is to add pagination
@@ -45,7 +45,7 @@ controls below this so the user can switch between pages:
45 45
 		<% if PaginatedPages.NotFirstPage %>
46 46
 			<a class="prev" href="$PaginatedPages.PrevLink">Prev</a>
47 47
 		<% end_if %>
48  
-		<% control PaginatedPages.Pages %>
  48
+		<% loop PaginatedPages.Pages %>
49 49
 			<% if CurrentBool %>
50 50
 				$PageNum
51 51
 			<% else %>
@@ -55,7 +55,7 @@ controls below this so the user can switch between pages:
55 55
 					...
56 56
 				<% end_if %>
57 57
 			<% end_if %>
58  
-			<% end_control %>
  58
+			<% end_loop %>
59 59
 		<% if PaginatedPages.NotLastPage %>
60 60
 			<a class="next" href="$PaginatedPages.NextLink">Next</a>
61 61
 		<% end_if %>
2  docs/en/misc/coding-conventions.md
Source Rendered
@@ -420,7 +420,7 @@ Put code into the classes in the following order (where applicable).
420 420
  *  Commonly used methods like `getCMSFields()`
421 421
  *  Accessor methods (`getMyField()` and `setMyField()`)
422 422
  *  Controller action methods
423  
- *  Template data-access methods (methods that will be called by a `$MethodName` or `<% control MethodName %>` construct in a template somewhere)
  423
+ *  Template data-access methods (methods that will be called by a `$MethodName` or `<% loop MethodName %>` construct in a template somewhere)
424 424
  *  Object methods
425 425
 
426 426
 ### SQL Format
12  docs/en/reference/partial-caching.md
Source Rendered
@@ -23,7 +23,7 @@ The way you mark a section of the template as being cached is to wrap that secti
23 23
 
24 24
 
25 25
 Each cache block has a cache key - an unlimited number of comma separated variables (in the same form as `if` and
26  
-`control` tag variables) and quoted strings.
  26
+`loop`/`with` tag variables) and quoted strings.
27 27
 
28 28
 Every time the cache key returns a different result, the contents of the block are recalculated. If the cache key is the
29 29
 same as a previous render, the cached value stored last time is used.
@@ -207,7 +207,7 @@ could also write the last example as:
207 207
 
208 208
 ## The important rule
209 209
 
210  
-Currently cached blocks can not be contained within if or control blocks. The template engine will throw an error
  210
+Currently cached blocks can not be contained within if or loop blocks. The template engine will throw an error
211 211
 letting you know if you've done this. You can often get around this using aggregates.
212 212
 
213 213
 Failing example:
@@ -215,11 +215,11 @@ Failing example:
215 215
 	:::ss
216 216
 	<% cached LastEdited %>
217 217
 	
218  
-	  <% control Children %>
  218
+	  <% loop Children %>
219 219
 	    <% cached LastEdited %>
220 220
 	      $Name
221 221
 	    <% end_cached %>
222  
-	  <% end_control %>
  222
+	  <% end_loop %>
223 223
 	
224 224
 	<% end_cached %>
225 225
 
@@ -231,9 +231,9 @@ Can be re-written as:
231 231
 	<% cached LastEdited %>
232 232
 	
233 233
 	  <% cached Children.max(LastEdited) %>
234  
-	    <% control Children %>
  234
+	    <% loop Children %>
235 235
 	      $Name
236  
-	    <% end_control %>
  236
+	    <% end_loop %>
237 237
 	  <% end_cached %>
238 238
 	
239 239
 	<% end_cached %>
10  docs/en/reference/searchcontext.md
Source Rendered
@@ -141,9 +141,9 @@ Results.PaginationSummary(4) defines how many pages the search will show in the
141 141
 	:::ss
142 142
 	<% if Results %>
143 143
 		<ul>
144  
-			<% control Results %>
145  
-				<li>$Titulo, $Autor</li>
146  
-			<% end_control %>
  144
+			<% loop Results %>
  145
+				<li>$Title, $Autor</li>
  146
+			<% end_loop %>
147 147
 		</ul>
148 148
 	<% else %>
149 149
 		<p>Sorry, your search query did not return any results.</p>
@@ -157,7 +157,7 @@ Results.PaginationSummary(4) defines how many pages the search will show in the
157 157
 				<% end_if %>
158 158
 			
159 159
 				<span>
160  
-			    		<% control Results.PaginationSummary(4) %>
  160
+			    		<% loop Results.PaginationSummary(4) %>
161 161
 						<% if CurrentBool %>
162 162
 							$PageNum
163 163
 						<% else %>
@@ -167,7 +167,7 @@ Results.PaginationSummary(4) defines how many pages the search will show in the
167 167
 								&hellip;
168 168
 							<% end_if %>
169 169
 						<% end_if %>
170  
-					<% end_control %>
  170
+					<% end_loop %>
171 171
 				</span>
172 172
 			
173 173
 				<% if Results.NotLastPage %>
4  docs/en/reference/siteconfig.md
Source Rendered
@@ -15,9 +15,9 @@ You can access `[api:SiteConfig]` options from any SS template by using the func
15 15
 	
16 16
 	// or 
17 17
 	
18  
-	<% control SiteConfig %>
  18
+	<% loop SiteConfig %>
19 19
 	$Title $AnotherField
20  
-	<% end_control %>
  20
+	<% end_loop %>
21 21
 
22 22
 
23 23
 Or if you want to access variables in the PHP you can do
4  docs/en/topics/datamodel.md
Source Rendered
@@ -40,7 +40,7 @@ are `filter()` and `sort()`:
40 40
 	
41 41
 Those of you who know a bit about SQL might be thinking "it looks like you're querying all members, and then filtering
42 42
 to those with a first name of 'Sam'. Isn't this very slow?"  Is isn't, because the ORM doesn't actually execute the 
43  
-query until you iterate on the result with a `foreach()` or `<% control %>`.
  43
+query until you iterate on the result with a `foreach()` or `<% loop %>`.
44 44
 
45 45
 	:::php
46 46
 	// The SQL query isn't executed here...
@@ -403,7 +403,7 @@ but using the *obj()*-method or accessing through a template will cast the value
403 403
 	
404 404
 	  // $myPlayer->MembershipFee() returns a float (e.g. 123.45)
405 405
 	  // $myPlayer->obj('MembershipFee') returns a object of type Currency
406  
-	  // In a template: <% control MyPlayer %>MembershipFee.Nice<% end_control %> returns a casted string (e.g. "$123.45")
  406
+	  // In a template: <% loop MyPlayer %>MembershipFee.Nice<% end_loop %> returns a casted string (e.g. "$123.45")
407 407
 	  public function getMembershipFee() {
408 408
 	    return $this->Team()->BaseFee * $this->MembershipYears;
409 409
 	  }
2  docs/en/topics/email.md
Source Rendered
@@ -34,7 +34,7 @@ The default HTML template is located in `framework/templates/email/GenericEmail.
34 34
 ### Templates
35 35
 
36 36
 *  Create a SS-template file called, in this example we will use 'MyEmail.ss' inside `mysite/templates/email`.
37  
-*  Fill this out with the body text for your email. You can use any [SS-template syntax](/topics/templates) (e.g. `<% control %>`,
  37
+*  Fill this out with the body text for your email. You can use any [SS-template syntax](/topics/templates) (e.g. `<% loop %>`,
38 38
 `<% if %>`, $FirstName etc)
39 39
 *  Choose your template with **setTemplate()**
40 40
 *  Populate any custom data into the template before sending with **populateTemplate()**
4  docs/en/topics/forms.md
Source Rendered
@@ -223,7 +223,7 @@ basic customisation:
223 223
 	
224 224
 	   <% if Actions %>
225 225
 	      <div class="Actions">
226  
-	         <% control Actions %>$Field<% end_control %>
  226
+	         <% loop Actions %>$Field<% end_loop %>
227 227
 	      </div>
228 228
 	   <% end_if %>
229 229
 	</form>
@@ -234,7 +234,7 @@ for the type of field. Pass in the name of the field as the first parameter, as
234 234
 template.
235 235
 
236 236
 To find more methods, have a look at the `[api:Form]` class, as there is a lot of different methods of customising the form
237  
-templates, for example, you could use `<% control Fields %>` instead of specifying each field manually, as we've done
  237
+templates, for example, you could use `<% loop Fields %>` instead of specifying each field manually, as we've done
238 238
 above.
239 239
 
240 240
 ### Custom form field templates
4  docs/en/topics/javascript.md
Source Rendered
@@ -375,9 +375,9 @@ Template:
375 375
 
376 376
 	:::ss
377 377
 	<ul>
378  
-	<% control Results %>
  378
+	<% loop Results %>
379 379
 	  <li id="Result-$ID">$Title</li>
380  
-	<% end_control %>
  380
+	<% end_loop %>
381 381
 	</ul>
382 382
 
383 383
 
4  docs/en/topics/rich-text-editing.md
Source Rendered
@@ -121,10 +121,10 @@ of the CMS you have to take care of instanciation yourself:
121 121
 	:::ss
122 122
 	// File: mysite/templates/MyController.ss
123 123
 	$Form
124  
-	<% control EditorToolbar %>
  124
+	<% with EditorToolbar %>
125 125
 		$MediaForm
126 126
 		$LinkForm
127  
-	<% end_control %>
  127
+	<% end_with %>
128 128
 
129 129
 Note: The dialogs rely on CMS-access, e.g. for uploading and browsing files,
130 130
 so this is considered advanced usage of the field.
14  docs/en/topics/theme-development.md
Source Rendered
@@ -74,9 +74,9 @@ our theme in action. The code for mine is below.
74 74
 	  <div id="Navigation">
75 75
 	    <% if Menu(1) %>
76 76
 	    <ul>
77  
-	      <% control Menu(1) %>	  
  77
+	      <% loop Menu(1) %>	  
78 78
 	        <li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>
79  
-	      <% end_control %>
  79
+	      <% end_loop %>
80 80
 	    </ul>
81 81
 	   <% end_if %>
82 82
 	  </div>
@@ -183,9 +183,9 @@ Next is a division for the main navigation. This may contain something like:
183 183
 	<div id="Navigation">
184 184
 	  <% if Menu(1) %>
185 185
 	  <ul>
186  
-	    <% control Menu(1) %>	  
  186
+	    <% loop Menu(1) %>	  
187 187
 	      <li><a href="$Link" title="Go to the $Title page" class="$LinkingMode">$MenuTitle</a></li>
188  
-	    <% end_control %>
  188
+	    <% end_loop %>
189 189
 	 </ul>
190 190
 	 <% end_if %>
191 191
 	</div>
@@ -193,14 +193,14 @@ Next is a division for the main navigation. This may contain something like:
193 193
 
194 194
 This is the standard for creating the main Navigation. As you can see it outputs the Menu 1 in a unordered list.
195 195
 
196  
-Before stepping into a control (a foreach loop) it's good practise to check if it exists first. This is not only
  196
+Before stepping into a loop it's good practise to check if it exists first. This is not only
197 197
 important in manipulating SilverStripe templates, but in any programming language!
198 198
 
199 199
 	:::ss
200 200
 	<% if MyFunction %>
201  
-	  <% control MyFunction %>
  201
+	  <% loop MyFunction %>
202 202
 	    $Title
203  
-	  <% end_control %>
  203
+	  <% end_loop %>
204 204
 	<% end_if %>
205 205
 
206 206
 
4  docs/en/tutorials/3-forms.md
Source Rendered
@@ -388,12 +388,12 @@ The final step is to create the template to display our data. Change the 'Browse
388 388
 			$BrowserPollForm
389 389
 		<% else %>
390 390
 		<ul>
391  
-			<% control BrowserPollResults %>
  391
+			<% loop BrowserPollResults %>
392 392
 			<li>
393 393
 				<div class="browser">$Browser: $Percentage%</div>
394 394
 				<div class="bar" style="width:$Percentage%">&nbsp;</div>
395 395
 			</li>
396  
-			<% end_control %>
  396
+			<% end_loop %>
397 397
 		</ul>
398 398
 		<% end_if %>
399 399
 	</div>
8  docs/en/tutorials/4-site-search.md
Source Rendered
@@ -113,7 +113,7 @@ class.
113 113
 	         
114 114
 	    <% if Results %>
115 115
 	    <ul id="SearchResults">
116  
-	        <% control Results %>
  116
+	        <% loop Results %>
117 117
 	        <li>
118 118
 	            <a class="searchResultHeader" href="$Link">
119 119
 	                <% if MenuTitle %>
@@ -127,7 +127,7 @@ class.
127 127
 	            	title="Read more about &quot;{$Title}&quot;"
128 128
 	            	>Read more about &quot;{$Title}&quot;...</a>
129 129
 	        </li>
130  
-	        <% end_control %>
  130
+	        <% end_loop %>
131 131
 	    </ul>
132 132
 	    <% else %>
133 133
 	    <p>Sorry, your search query did not return any results.</p>
@@ -142,13 +142,13 @@ class.
142 142
 	        <a class="prev" href="$Results.PrevLink" title="View the previous page">Prev</a>
143 143
 	        <% end_if %>
144 144
 	        <span>
145  
-	            <% control Results.Pages %>
  145
+	            <% loop Results.Pages %>
146 146
 	                <% if CurrentBool %>
147 147
 	                $PageNum
148 148
 	                <% else %>
149 149
 	                <a href="$Link" title="View page number $PageNum">$PageNum</a>
150 150
 	                <% end_if %>
151  
-	            <% end_control %>
  151
+	            <% end_loop %>
152 152
 	        </span>
153 153
 	        <p>Page $Results.CurrentPage of $Results.TotalPages</p>
154 154
 	    </div>
44  docs/en/tutorials/5-dataobject-relationship-management.md
Source Rendered
@@ -505,44 +505,44 @@ Let's start with the *ProjectsHolder* page created before. For this template, we
505 505
 	            </tr>
506 506
 	        </thead>
507 507
 	        <tbody>
508  
-	            <% control Children %>
  508
+	            <% loop Children %>
509 509
 	                <tr>
510 510
 	                    <td>$Title</td>
511 511
 	                    <td>
512 512
 	                        <% if MyStudent %>
513  
-	                            <% control MyStudent %>
  513
+	                            <% loop MyStudent %>
514 514
 	                                $FirstName $Lastname
515  
-	                            <% end_control %>
  515
+	                            <% end_loop %>
516 516
 	                        <% else %>
517 517
 	                            No Student
518 518
 	                        <% end_if %>
519 519
 	                    </td>
520 520
 	                    <td>
521 521
 	                        <% if MyStudent %>
522  
-	                            <% control MyStudent %>
  522
+	                            <% loop MyStudent %>
523 523
 	                                <% if MyMentor %>
524  
-	                                    <% control MyMentor %>
  524
+	                                    <% loop MyMentor %>
525 525
 	                                        $FirstName $Lastname
526  
-	                                    <% end_control %>
  526
+	                                    <% end_loop %>
527 527
 	                                <% else %>
528 528
 	                                    No Mentor
529 529
 	                                <% end_if %>
530  
-	                            <% end_control %>
  530
+	                            <% end_loop %>
531 531
 	                        <% else %>
532 532
 	                            No Mentor
533 533
 	                        <% end_if %>
534 534
 	                    </td>
535 535
 	                    <td>
536 536
 	                        <% if Modules %>
537  
-	                            <% control Modules %>
  537
+	                            <% loop Modules %>
538 538
 	                                $Name &nbsp;
539  
-	                            <% end_control %>
  539
+	                            <% end_loop %>
540 540
 	                        <% else %>
541 541
 	                            No Modules
542 542
 	                        <% end_if %>
543 543
 	                    </td>
544 544
 	                </tr>
545  
-	            <% end_control %>
  545
+	            <% end_loop %>
546 546
 	        </tbody>
547 547
 	    </table>
548 548
 
@@ -579,7 +579,7 @@ We can now do the same for every *Project* page by creating its own template.
579 579
 		$Content
580 580
 
581 581
 		<% if MyStudent %>
582  
-	        <% control MyStudent %>
  582
+	        <% loop MyStudent %>
583 583
 	            <p>First Name: <strong>$FirstName</strong></p>
584 584
 	            <p>Lastname: <strong>$Lastname</strong></p>
585 585
 	            <p>Nationality: <strong>$Nationality</strong></p>
@@ -587,15 +587,15 @@ We can now do the same for every *Project* page by creating its own template.
587 587
 	            <h3>Mentor</h3>
588 588
 
589 589
 	            <% if MyMentor %>
590  
-	                <% control MyMentor %>
  590
+	                <% loop MyMentor %>
591 591
 	                    <p>First Name: <strong>$FirstName</strong></p>
592 592
 	                    <p>Lastname: <strong>$Lastname</strong></p>
593 593
 	                    <p>Nationality: <strong>$Nationality</strong></p>
594  
-	                <% end_control %>
  594
+	                <% end_loop %>
595 595
 	            <% else %>
596 596
 	                <p>This student doesn't have any mentor.</p>
597 597
 	            <% end_if %>
598  
-	        <% end_control %>
  598
+	        <% end_loop %>
599 599
 	    <% else %>
600 600
 	        <p>There is no any student working on this project.</p>
601 601
 	    <% end_if %>
@@ -604,9 +604,9 @@ We can now do the same for every *Project* page by creating its own template.
604 604
 
605 605
 	    <% if Modules %>
606 606
 	        <ul>
607  
-	            <% control Modules %>
  607
+	            <% loop Modules %>
608 608
 	                <li>$Name</li>
609  
-	            <% end_control %>
  609
+	            <% end_loop %>
610 610
 	        </ul>
611 611
 	    <% else %>
612 612
 	        <p>This project has not used any modules.</p>
@@ -655,13 +655,13 @@ We can now modify the *Project.ss* template.
655 655
 	
656 656
 		<h3>Mentor</h3>
657 657
 		
658  
-		<% control MyStudent %>
  658
+		<% loop MyStudent %>
659 659
 			<% if MyMentor %>
660 660
 				$MyMentor.PersonalInfo
661 661
 			<% else %>
662 662
 				<p>This student doesn't have any mentor.</p>
663 663
 			<% end_if %>
664  
-		<% end_control %>
  664
+		<% end_loop %>
665 665
 	<% else %>
666 666
 		<p>There is no any student working on this project.</p>
667 667
 	<% end_if %>
@@ -738,20 +738,20 @@ That's how we can use this function in the *Mentor* template.
738 738
 	                </tr>
739 739
 	            </thead>
740 740
 	            <tbody>
741  
-	                <% control Students %>
  741
+	                <% loop Students %>
742 742
 	                    <tr>
743 743
 	                        <td>$FirstName $Lastname</td>
744 744
 	                        <td>
745 745
 	                            <% if MyProject %>
746  
-	                                <% control MyProject %>
  746
+	                                <% loop MyProject %>
747 747
 	                                    $Title
748  
-	                                <% end_control %>
  748
+	                                <% end_loop %>
749 749
 	                            <% else %>
750 750
 	                                No Project
751 751
 	                            <% end_if %>
752 752
 	                        </td>
753 753
 	                    </tr>
754  
-	                <% end_control %>
  754
+	                <% end_loop %>
755 755
 	            </tbody>
756 756
 	        </table>
757 757
 	    <% else %>

0 notes on commit 45b2cbf

Please sign in to comment.
Something went wrong with that request. Please try again.