of 46 /46
Einführung in Fluid Inspiring people to share Einführung in Fluid Templating made easy 10. Oktober 2009 - TYPO3camp München Patrick Lobacher 1 Sonntag, 11. Oktober 2009

TYPO3camp 2009 - Einführung in Fluid

Embed Size (px)

DESCRIPTION

Einführung in Fluid - der Templating Engine für TYPO3 4.3.

Text of TYPO3camp 2009 - Einführung in Fluid

  • Einfhrung in Fluid Templating made easy 10. Oktober 2009 - TYPO3camp Mnchen Patrick Lobacher Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 1
  • Was ist Fluid? Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 2
  • Was ist Fluid? Moderne und erweiterbare Templating-Engine fr Frontend und Backend (Entwickelt von Sebastian Kurfrst) Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 3
  • Templating-Engine Daten Template Templating-Engine Ausgabe Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 4
  • Templating-Bereiche in TYPO3 Seiten-Templates Frontend-Plugins Backend-Module Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 5
  • Templating-Bereiche in TYPO3 Seiten-Templates (Marker/Subpart) Frontend-Plugins (Fluid) Backend-Module (Fluid) Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 6
  • Warum eine neue Templating-Engine? Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 7
  • Template-Code in pi1 // Template ermitteln $this->templateCode = $this->cObj->leResource($conf['templateFile']); // Subpart auslesen $template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###'); // Marker fllen $markerArray['###MARKER1###'] = 'content for marker 1'; $markerArray['###MARKER2###'] = 'content for marker 2'; // Marker im Template ersetzen $content = $this->cObj->substituteMarkerArrayCached($template['total'],$markerArray); Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 8
  • Nachteile der Marker-Methode Layout und Code wird vermischt Designer und Programmierer knnen nicht unabhngig voneinander arbeiten schlecht erweiterbar (neue Marker) komplizierte API-Funktionen keine Kontrollstrukturen Nur Strings und Arrays -> keine Objekte mglich Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 9
  • Ziel von Fluid Einfache und elegante Template-Engine Untersttzung des Template-Autors (Autovervollstndigung in Eclipse, ...) Einfache Erweiterbarkeit Intuitive Verwendung Verschiedene Ausgabeformate sollen mglich sein vollstndige Objektorientierung Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 10
  • Mitmachen!! Extension: efempty Nur ein Model + Controller + View TYPO3 4.3 (alpha/beta) Extbase und Fluid Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 11
  • Extension: efempty 1 - Zuweisung (PHP) 2 - Template (HTML) Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 12
  • Fluid: Aufbau Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 13
  • Fluid Eigene ViewHelper Core-ViewHelper Basis-Syntax Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 14
  • Fluid: Basis Syntax Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 15
  • Variablen (Strings) Zuweisung $this->view->assign('helloworld1', 'Hello World 1!'); Template

    {helloworld1}

    Ausgabe

    Hello World 1!

    Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 16
  • Arrays (numerisch) Zuweisung $array = array('Hello', 'World', '2!'); $this->view->assign('helloworld2', $array); Template

    {helloworld2.0} {helloworld2.1} {helloworld2.2}

    Ausgabe

    Hello World 2!

    Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 17
  • Arrays (assoziativ) Zuweisung $array = array('rst' => 'Hello', 'middle' => 'World', 'last' => '3!'); $this->view->assign('helloworld3', $array); Template

    {helloworld3.rst} {helloworld3.middle} {helloworld3.last}

    Ausgabe

    Hello World 3!

    Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 18
  • Objekte Zuweisung $start = new Tx_Efempty_Domain_Model_Start; $start->setTitle("Hello World 4!"); $this->view->assign('helloworld4', $start); Template

    {helloworld4.title}

    Ausgabe

    Hello World 4!

    Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 19
  • Objekte Automatischer Zugriff auf alle Objekteigenschaften In Extbase (und FLOW3) wird die Eigenschaft ber den sogenannten GETTER ermittelt -> getTitle() Zugriff auf smtliche Objekte, die als Eigenschaften gespeichert sind

    {blog.post.comment}

    Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 20
  • Fluid: ViewHelper Inspiring people to Einfhrung in Fluid share Sonntag, 11. Oktober 2009 21
  • ViewHelper - Basis-Syntax INHALT INHALT