Skip to content

Commit

Permalink
ID#308: updated documentation of loop template to search for data to …
Browse files Browse the repository at this point in the history
…display within parent object (same as conditional template) to streamline API and allow better usage of loop templates within conditional templates.
  • Loading branch information
ChristianAchatz committed Aug 30, 2016
1 parent d7af2d4 commit 3c556d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
23 changes: 7 additions & 16 deletions DOCS/pres/content/c_de_161_3.X_erweiterte_template_funktionen.html
Expand Up @@ -1093,15 +1093,15 @@ <h3 id="Chapter-5-Iterative-Ausgabe"><a href="#Chapter-5-Iterative-Ausgabe">5. I
Zur Ausgabe der Liste ist folgender Controller-Code nötig:
</p>
<gen:highlight type="php">
$template = $this->getTemplate('list');
$template->setData(
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web-Shop'],
['url' => '/about', 'title' => 'Über uns'],
['url' => '/contact', 'title' => 'Kontakt-Formular']
]
);
$template = $this->getTemplate('list');
$template->transformOnPlace();
</gen:highlight>
<p>
Expand All @@ -1119,15 +1119,16 @@ <h3 id="Chapter-5-Iterative-Ausgabe"><a href="#Chapter-5-Iterative-Ausgabe">5. I
Im Controller kann das als ganz normaler Platzhalter injiziert werden:
</p>
<gen:highlight type="php">
$template = $this->getTemplate('list');
$template->setData(
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web-Shop'],
['url' => '/about', 'title' => 'Über uns'],
['url' => '/contact', 'title' => 'Kontakt-Formular']
]
);

$template = $this->getTemplate('list');
$template->setPlaceHolder('css-class', 'foo');

$template->transformOnPlace();
Expand All @@ -1139,18 +1140,8 @@ <h3 id="Chapter-5-Iterative-Ausgabe"><a href="#Chapter-5-Iterative-Ausgabe">5. I
hierzu entnehmen Sie bitte <a href="#Chapter-3-Erweiterung-der-Syntax">Kapitel 3</a>.
</p>
<div class="hint">
Injizieren Sie im Controller per
<gen:highlight type="php">
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web-Shop'],
['url' => '/about', 'title' => 'Über uns'],
['url' => '/contact', 'title' => 'Kontakt-Formular']
]
);
</gen:highlight>
Inhalt in das Eltern-Dokument, so kann dieser mit folgender Templating-Syntax zur Ausgabe der Liste genutzt werden:
Stehen die Inhalte zur Ausgabe in einem Eltern-Dokument zur Verfügung - z.B. einem Modul-Knoten, der das aktuelle
Template umschließt - so kann der Tag mit folgender Templating-Syntax zur Ausgabe der Liste genutzt werden:
<gen:highlight type="apf-xml">
<ul>
<loop:template
Expand Down
Expand Up @@ -1061,15 +1061,16 @@ <h3 id="Chapter-5-Recurring-data-display"><a href="#Chapter-5-Recurring-data-dis
Displaying the list, the following controller code can be used:
</p>
<gen:highlight type="php">
$template = $this->getTemplate('list');
$template->setData(
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web shop'],
['url' => '/about', 'title' => 'About us'],
['url' => '/contact', 'title' => 'Contact form']
]
);

$template = $this->getTemplate('list');
$template->transformOnPlace();
</gen:highlight>
<p>
Expand All @@ -1087,15 +1088,16 @@ <h3 id="Chapter-5-Recurring-data-display"><a href="#Chapter-5-Recurring-data-dis
Within your controller simply inject the CSS class as place holder into the template:
</p>
<gen:highlight type="php">
$template = $this->getTemplate('list');
$template->setData(
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web shop'],
['url' => '/about', 'title' => 'About us'],
['url' => '/contact', 'title' => 'Contact form']
]
);

$template = $this->getTemplate('list');
$template->setPlaceHolder('css-class', 'foo');

$template->transformOnPlace();
Expand All @@ -1107,19 +1109,8 @@ <h3 id="Chapter-5-Recurring-data-display"><a href="#Chapter-5-Recurring-data-dis
<a href="#Chapter-3-Extending-the-syntax">chapter 3</a>.
</p>
<div class="hint">
In case you inject the content into the parent document of the loop template to display within your controller as
described in the subsequent code box
<gen:highlight type="php">
$this->setData(
'items',
[
['url' => '/shop', 'title' => 'Web shop'],
['url' => '/about', 'title' => 'About us'],
['url' => '/contact', 'title' => 'Contact form']
]
);
</gen:highlight>
you may want to use the extended templating syntax to display the desired list:
In case the content to be displayed is available within a parent document - e.g. a module node encapsulating the
current template - you may want to use the extended templating syntax to display the desired list:
<gen:highlight type="apf-xml">
<ul>
<loop:template
Expand Down

0 comments on commit 3c556d9

Please sign in to comment.