23. … und pibase eher nicht.
<!-- ###TEMPLATE_LATEST### begin
! This is the template for the latest news, typically displayed on a frontpage
-->
<div class="news-latest-container">
! <h2>###LATEST_HEADER###</h2>
! <!-- ###CONTENT### begin
! ! This is the part of the template substituted with the list of news:
! -->
! ! <!-- ###NEWS### begin
! ! ! Template for a single item
! ! -->
! ! ! <div class="news-latest-item">
! ! ! ! <span class="news-latest-date"><!--###LINK_ITEM###-->###NEWS_DATE### ###NEWS_TIME###<!--
###LINK_ITEM###--></span>
! ! ! ! <h3><!--###LINK_ITEM###-->###NEWS_TITLE###<!--###LINK_ITEM###--></h3>
! ! ! ! <!--###LINK_ITEM###-->###NEWS_IMAGE###<!--###LINK_ITEM###-->
! ! ! ! ###NEWS_SUBHEADER###<hr class="clearer" />
! ! ! ! ###CATWRAP_B### ###TEXT_CAT_LATEST### ###NEWS_CATEGORY### ###NEWS_CATEGORY_IMAGE###
###CATWRAP_E###
<div class="news-latest-morelink"><!--###LINK_ITEM###-->###MORE###<!--###LINK_ITEM###--></div>
! ! ! </div>
! ! <!-- ###NEWS### end-->!!
! <!-- ###CONTENT### end -->
<div class="news-latest-gotoarchive"><!--###LINK_ARCHIVE###-->###GOTOARCHIVE###<!--###LINK_ARCHIVE###--></div>
</div>
<!-- ###TEMPLATE_LATEST### end -->
26. extbase macht vieles einfacher
die Entwicklung geht schneller
es ist weniger Code nötig
27. extbase macht vieles einfacher
die Entwicklung geht schneller
es ist weniger Code nötig
Unit-Tests sind einfacher
28. extbase macht vieles einfacher
die Entwicklung geht schneller
es ist weniger Code nötig
Unit-Tests sind einfacher
HTML-Templates können mehr
29. extbase macht vieles einfacher
die Entwicklung geht schneller
es ist weniger Code nötig
Unit-Tests sind einfacher
HTML-Templates können mehr
Einarbeitungszeit für neues Framework
32. OOP-Vokabular
auf einen Blick
public class Book {
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL;
public function __construct() {
$this->title = '(no title)';
}
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
33. OOP-Vokabular
auf einen Blick
Klasse
public class Book {
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL;
public function __construct() {
$this->title = '(no title)';
}
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
34. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL;
public function __construct() {
$this->title = '(no title)';
}
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
35. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL;
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
}
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
36. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
}
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
37. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
}
…
38. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
}
public function getAuthor() {
return $this->author;
} Getter
…
39. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
} Setter
public function getAuthor() {
return $this->author;
} Getter
…
40. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL;
}
public function setAuthor(Author $author) {
$this->author = $author;
} Setter Daten-
public function getAuthor() { kapselung
return $this->author;
} Getter
…
41. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = '';
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL; Type-Hinting
}
public function setAuthor(Author $author) {
$this->author = $author;
} Setter Daten-
public function getAuthor() { kapselung
return $this->author;
} Getter
…
42. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = ''; $book = new Book();
/** @var Author */
protected $author = NULL; Konstruktor
public function __construct() {
Methoden, Memberfunktionen
$this->title = '(no title)';
} Destruktor
public function __destruct() {
$this->author = NULL; Type-Hinting
}
public function setAuthor(Author $author) {
$this->author = $author;
} Setter Daten-
public function getAuthor() { kapselung
return $this->author;
} Getter
…
43. OOP-Vokabular
auf einen Blick
Klasse
public class Book { Feld, Membervariable
/** @var string */
protected $title = ''; $book = new Book();
/** @var Author */
protected $author = NULL; Konstruktor
Book-Instanz,
public function __construct() { Referenz auf
Methoden, Memberfunktionen
$this->title = '(no title)'; Objekt
} Destruktor
public function __destruct() {
$this->author = NULL; Type-Hinting
}
public function setAuthor(Author $author) {
$this->author = $author;
} Setter Daten-
public function getAuthor() { kapselung
return $this->author;
} Getter
…
46. Vererbung erlaubt
Code-Reuse
class Book {
…
public function getTitle() {
return $this->title();
}
public function setTitle($title) {
$this->title = $title;
}
}
Book
Paperback Hardcover
47. Vererbung erlaubt
Code-Reuse
class Book {
…
public function getTitle() {
return $this->title();
}
public function setTitle($title) {
$this->title = $title;
}
}
class Paperback extends Book {
Book }
…
Paperback Hardcover
48. Vererbung erlaubt
Code-Reuse
class Book {
…
public function getTitle() {
return $this->title();
}
public function setTitle($title) {
$this->title = $title;
}
}
class Paperback extends Book {
Book }
…
class Hardcover extends Book {
…
}
Paperback Hardcover
49. Vererbung erlaubt
Code-Reuse
class Book {
…
public function getTitle() {
return $this->title();
}
public function setTitle($title) {
$this->title = $title;
}
}
class Paperback extends Book {
Book }
…
class Hardcover extends Book {
…
}
Paperback Hardcover extends = „ist ein“
50. Polymorphismus
(Wer ein Buch bestellt, bekomme manchmal auch ein
Taschenbuch oder ein gebundenes Buch geliefert.)
51. Polymorphismus
(Wer ein Buch bestellt, bekomme manchmal auch ein
Taschenbuch oder ein gebundenes Buch geliefert.)
class Bookshelf {
…
public function addBook(Book $book) {
…
}
…
}
52. Polymorphismus
(Wer ein Buch bestellt, bekomme manchmal auch ein
Taschenbuch oder ein gebundenes Buch geliefert.)
class Bookshelf {
…
public function addBook(Book $book) {
…
}
…
} $ivar = new Bookshelf();
$domainDrivenDevelopment = new Book();
$ivar->addBook($domainDrivenDevelopment);
$harryPotterVolumeOne = new Paperback();
$ivar->addBook($harryPotterVolumeOne);
$lordOfTheRings = new Hardcover();
$ivar->addBook($lordOfTheRings);
55. Interfaces definieren die nötigen
Methoden
interface Readable {
Readable }
public function turnPage();
Book
56. Interfaces definieren die nötigen
Methoden
interface Readable {
Readable }
public function turnPage();
class Book implements Readable {
Book …
public function turnPage() {
$this->currentPageNumber += 2;
}
}
57. Interfaces definieren die nötigen
Methoden
interface Readable {
Readable }
public function turnPage();
implements = „kann auch“
class Book implements Readable {
Book …
public function turnPage() {
$this->currentPageNumber += 2;
}
}
126. ViewHelper erstellen
HTML-Template
oder Partial
{namespace bs=Tx_Bookshelf_ViewHelpers}
<bs:onClick src="{book.image}" />
class Tx_Bookshelf_ViewHelpers_OnClickViewHelper extends
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
! /**
! * @param string $src
! * @return string
! */
! public function render($src) {
…
}
127. ViewHelper mit Inhalt
{namespace bs=Tx_Bookshelf_ViewHelpers}
<bs:acronym>Der RTE in TYPO3 arbeitet
mit ExtJS.</bs:acronym>
HTML-Template
oder Partial
128. ViewHelper mit Inhalt
{namespace bs=Tx_Bookshelf_ViewHelpers}
<bs:acronym>Der RTE in TYPO3 arbeitet
mit ExtJS.</bs:acronym>
HTML-Template
oder Partial
class Tx_Bookshelf_ViewHelpers_AcronymViewHelper extends
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
! /**
! * @return string
! */
! public function render() {
$innerContent = $this->renderChildren();
…
}