Extbase Extensions - Snippets und Glossar: Unterschied zwischen den Versionen
| Zeile 10: | Zeile 10: | ||
http://typo3.org/documentation/snippets/ | http://typo3.org/documentation/snippets/ | ||
== Diverse == | == Diverse == | ||
| + | === Actions anlegen === | ||
| + | Im Controller: | ||
| + | <pre> | ||
| + | /** | ||
| + | * action list | ||
| + | * | ||
| + | * @return void | ||
| + | */ | ||
| + | public function listAction() { | ||
| + | $myextname = $this->myextRepository->findAll(); | ||
| + | $this->view->assign('myextname', $myextname); | ||
| + | } | ||
| + | </pre> | ||
| + | |||
=== addFlashMessage === | === addFlashMessage === | ||
| + | Im Controller | ||
$this->addFlashMessage('<strong>HTML-Messageplement</strong>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); | $this->addFlashMessage('<strong>HTML-Messageplement</strong>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); | ||
| + | |||
== Default Sortierung in Extbase == | == Default Sortierung in Extbase == | ||
Quelle: http://t3n.de/magazin/zehn-tipps-tricks-extbase-fluid-227639/2/ (11/2014) | Quelle: http://t3n.de/magazin/zehn-tipps-tricks-extbase-fluid-227639/2/ (11/2014) | ||
Version vom 9. Dezember 2014, 13:02 Uhr
Glossar
Extbase - ist ein MVC Framework für die Extension entwicklung in TYPO3
FLOW3 - ist ein PHP-Framework, welches TYPO3 Version 5 verwenden wird.
Fluid - Template Engine ähnlich wie Smarty ab Version 5
Snippets Links
http://typo3.org/documentation/snippets/
Diverse
Actions anlegen
Im Controller:
/**
* action list
*
* @return void
*/
public function listAction() {
$myextname = $this->myextRepository->findAll();
$this->view->assign('myextname', $myextname);
}
addFlashMessage
Im Controller
$this->addFlashMessage('HTML-Messageplement', , \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
Default Sortierung in Extbase
Quelle: http://t3n.de/magazin/zehn-tipps-tricks-extbase-fluid-227639/2/ (11/2014)
Default-Sortierung im Repository
Nicht unbedingt unbekannt, aber weitestgehend ungenutzt ist ein Feature, welches in Extbase 1.3 hinzugekommen ist: Im Repository besteht die Möglichkeit, das Ergebnis nach bestimmten Feldern aufsteigend oder absteigend zu sortieren. Dies wird beispielsweise mittels „
$query->setOrderings(array('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING));
erledigt.
Um dies nicht für jede einzelne Repository-Funktion einstellen zu müssen, gibt es die Eigenschaft defaultOrderings:
Im Repository
protected $defaultOrderings = array ('name' => Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING);