186 | | In more details, we describe what happens with the |
| 186 | A template which extends another can redefine the content of the //named blocks// defined in the extended template. This redefinition may or may not refer to the original content of the block in the extended template (`${ super() }`). |
| 187 | |
| 188 | We first give an overview of the three templates and how their content will be combined in the generated output. |
| 189 | |
| 190 | |
| 191 | |
| 192 | |-------------------------------------------------------------------------- |
| 193 | || __jtheme.html__ || \ |
| 194 | || __jlayout.html__ \\ //# extends jtheme.html// || \ |
| 195 | || __jsearch.html__ \\ //# extends jlayout.html// || |
| 196 | |-------------------------------------------------------------------------- |
| 197 | {{{#!td style="vertical-align:top" |
| 198 | {{{#!html |
| 199 | <div style="border: 1px dotted #dde; width: 21em"> |
| 200 | <html> |
| 201 | <div style="background: #ccf; width: 20em; text-align: left; margin: .5em"> |
| 202 | <head><br/> |
| 203 | <div class="head" style="background: #aaf; width: 17em; margin: 1em"> |
| 204 | <em># block head</em> <br/> |
| 205 | <em># endblock head</em> |
| 206 | </div> |
| 207 | </head> |
| 208 | </div> |
| 209 | |
| 210 | <div style="background: #cfc; width: 20em; margin: .5em"> |
| 211 | <body> |
| 212 | <div class="body" style="background: #beb; width: 17em; margin: 1em"> |
| 213 | <em># block body</em> <br/> |
| 214 | … banner + metanav + mainnav + contextnav + warnings + notices … |
| 215 | <div class="content" style="background: #9e9; width: 15em; margin: 1em"> |
| 216 | <em># block content</em> <br/> |
| 217 | <em># endblock content</em> |
| 218 | </div> |
| 219 | … footer … <br/> |
| 220 | <em># endblock body</em> |
| 221 | </div> |
| 222 | </body> |
| 223 | </div> |
| 224 | </html> |
| 225 | </div> |
| 226 | }}} |
| 227 | \\ |
| 228 | (//head// and //content// blocks \\ |
| 229 | have no default content) |
| 230 | }}} |
| 231 | {{{#!td style="vertical-align:top" |
| 232 | {{{#!html |
| 233 | <div style="border: 1px dotted #dde; width: 21em"> |
| 234 | <html> |
| 235 | <div style="background: #ccf; width: 20em; text-align: left; margin: .5em"> |
| 236 | <head><br/> |
| 237 | <div class="head" style="background: #aaf; width: 17em; margin: 1em"> |
| 238 | <em># block head</em> <br/> |
| 239 | <title> |
| 240 | <div class="title" style="background: #99e; width: 10em; margin: 0 1em"> |
| 241 | <em># block title</em> <br/> |
| 242 | - Trac <br/> |
| 243 | <em># endblock title</em> |
| 244 | </div> |
| 245 | </title> <br/> |
| 246 | … meta + link + script … <br/> |
| 247 | <em># endblock head</em> |
| 248 | </div> |
| 249 | </head> |
| 250 | </div> |
| 251 | |
| 252 | <div style="background: #cfc; width: 20em; margin: .5em"> |
| 253 | <body> |
| 254 | <div class="content" style="background: #9e9; width: 17em; margin: 1em"> |
| 255 | <em># block content</em> <br/> |
| 256 | … alternate formats … <br/> |
| 257 | <em># endblock content</em> |
| 258 | </div> |
| 259 | </body> |
| 260 | </div> |
| 261 | </html> |
| 262 | </div> |
| 263 | }}} |
| 264 | \\ |
| 265 | (//head// and //content// blocks \\ |
| 266 | have default content) |
| 267 | }}} |
| 268 | {{{#!td style="vertical-align:top" |
| 269 | {{{#!html |
| 270 | <div style="border: 1px dotted #dde; width: 21em"> |
| 271 | <html> |
| 272 | <div style="background: #ccf; width: 20em; text-align: left; margin: .5em"> |
| 273 | <head><br/> |
| 274 | <title> <br/> |
| 275 | <div class="title" style="background: #b9e; width: 10em; margin: 0 1em; padding: .4em"> |
| 276 | <em># block title</em> <br/> |
| 277 | Search <br/> |
| 278 | <span style="background: #99e">${ super() }</span> <br/> |
| 279 | <em># endblock title</em> |
| 280 | </div> |
| 281 | </title> <br/> |
| 282 | <div class="head" style="background: #caf; width: 17em; margin: 1em; padding: .4em"> |
| 283 | <em># block head</em> <br/> |
| 284 | <span style="background: #aaf">${ super() }</span> <br/> |
| 285 | … meta … <br/> |
| 286 | <em># endblock head</em> |
| 287 | </div> |
| 288 | </head> |
| 289 | </div> |
| 290 | |
| 291 | <div style="background: #cfc; width: 20em; margin: .5em"> |
| 292 | <body> |
| 293 | <div class="content" style="background: #be9; width: 17em; margin: 1em; padding: .4em"> |
| 294 | <em># block content</em> <br/> |
| 295 | <div class="content"> <br/> |
| 296 | … Search Results … <br/> |
| 297 | </div> <br/> |
| 298 | <span style="background: #9e9">${ super() }</span> <br/> |
| 299 | <em># endblock content</em> |
| 300 | </div> |
| 301 | </body> |
| 302 | </div> |
| 303 | </html> |
| 304 | </div> |
| 305 | }}} |
| 306 | }}} |
| 307 | |-------------------------------------------------------------------------- |
| 308 | {{{#!td colspan=3 style="vertical-align:top" |
| 309 | generated output: |
| 310 | {{{#!html |
| 311 | <div style="border: 1px dotted #dde; width: 21em; margin: 0 auto"> |
| 312 | <html> |
| 313 | <div style="background: #ccf; width: 20em; text-align: left; margin: .5em"> |
| 314 | <head><br/> |
| 315 | <div class="head" style="background: #caf; width: 17em; margin: 1em; padding: .4em"> |
| 316 | <div style="background: #aaf"> |
| 317 | <title> <br/> |
| 318 | <div class="title" style="background: #b9e; width: 10em; margin: 0 1em; padding: .4em"> |
| 319 | Search <br/> |
| 320 | <span style="background: #99e">- Trac</span> <br/> |
| 321 | </div> |
| 322 | </title> <br/> |
| 323 | … meta + link + script … |
| 324 | </div> |
| 325 | … meta … <br/> |
| 326 | </div> |
| 327 | </head> |
| 328 | </div> |
| 329 | |
| 330 | <div style="background: #cfc; width: 20em; margin: .5em"> |
| 331 | <body> |
| 332 | <div class="body" style="background: #beb; width: 17em; margin: 1em"> |
| 333 | … banner + metanav + mainnav + contextnav + warnings + notices … |
| 334 | <div class="content" style="background: #be9; width: 12em; margin: 1em; padding: .4em"> |
| 335 | <div class="content"> <br/> |
| 336 | … Search Results … <br/> |
| 337 | </div> <br/> |
| 338 | <span style="background: #9e9">… alternate formats …</span> <br/> |
| 339 | </div> |
| 340 | … footer … <br/> |
| 341 | </div> |
| 342 | </body> |
| 343 | </div> |
| 344 | </html> |
| 345 | </div> |
| 346 | }}} |
| 347 | }}} |
| 348 | |
| 349 | |
| 350 | Let's have a closer look at the content of each template, starting with the |
| 351 | most specific template, in our example the |