Mimis Blog

Dieser Blog wird nicht mehr gepflegt - hier geht's zum neuen Blog:

http://mimi.kaktusteam.de


This Blog is no longer updated - new Blog available at

http://mimi.kaktusteam.de

25.01.2011
17:04

Extbase CookBook #12 - Using Extbase plugins as page content via TypoScript

If you want to use an Extbase plugin in TypoScript you can use the following snippets to configure what is now called "Bootstrap" to be called from TypoScript.

 

First of all, make sure that you still have your ext_localconf.php set up correctly. This means that all controller/action pairs that you want to use within TypoScript have to be set up in there:

 

 

  1. // relevant content of ext_localconf.php
  2.  
  3. if (!defined ('TYPO3_MODE')) die ('Access denied.');
  4.  
  5. Tx_Extbase_Utility_Extension::configurePlugin(
  6. $_EXTKEY,
  7. 'Pi1',
  8. 'Album' => 'show, new, create, edit, update, delete, addItems',
  9. 'Gallery' => 'list, index, show, new, create, edit, update, delete',
  10. 'Item' => 'index, show, new, create, edit, update, delete',
  11. 'ItemList' => 'list'
  12. ),
  13. // non-cached actions go here:
  14. 'Album' => 'show, new, create, edit, update, delete, addItems',
  15. 'Gallery' => 'list, index, show, new, create, edit, update, delete',
  16. 'Item' => 'index, show, new, create, edit, update, delete',
  17. 'ItemList' => 'list'
  18. )
  19. );

 

 

The next step is to write a TypoScript template and include the Controllers and Actions there. I'm doing this as follows: First set up "widgets" that include Controllers and Actions concerning one widget, then include this widget whereever you want inside your TS-Template. There is a little trick on defining those widgets: Whatever you want to show in one widget should have the corresponding Controllers and Actions there. But keep in mind, that all parameters you pass to the page are equally processed by all widgets. So if you want to have a menu in one widget and have a gallery in another widget, make sure, that you do not add the Gallery's Controllers and Actions to the menu widget as otherwise you will have a Gallery in your menu widget as soon as you pass the corresponding parameters via GET / POST.

 

 

  1. ## First set up widgets
  2. plugin.tx_yag.widgets {
  3.  
  4. adminMenuWidget = USER
  5. adminMenuWidget {
  6. userFunc = tx_extbase_core_bootstrap->run
  7. pluginName = Pi1
  8. extensionName = Yag
  9. controller = AdminMenu
  10. action = index
  11. switchableControllerActions {
  12. AdminMenu {
  13. 1 = index
  14. }
  15. }
  16. settings =< plugin.tx_yag.settings
  17. persistence =< plugin.tx_yag.persistence
  18. view =< plugin.tx_yag.view
  19. }
  20.  
  21.  
  22. galleryWidget = USER
  23. galleryWidget {
  24. userFunc = tx_extbase_core_bootstrap->run
  25. pluginName = Pi1
  26. extensionName = Yag
  27. controller = Gallery
  28. action = list
  29. switchableControllerActions {
  30. Gallery {
  31. 1 = list
  32. 2 = index
  33. 3 = new
  34. 4 = create
  35. 5 = edit
  36. 6 = update
  37. 7 = delete
  38. }
  39.  
  40. ItemList {
  41. 1 = list
  42. 2 = submitFilter
  43. 3 = resetFilter
  44. }
  45.  
  46. ItemAdminList {
  47. 1 = list,
  48. 2 = submitFilter
  49. 3 = resetFilter
  50. }
  51.  
  52. Album {
  53. 1 = show
  54. 2 = delete
  55. 3 = new
  56. 4 = create
  57. 5 = addItems
  58. }
  59. }
  60.  
  61.  
  62.  
  63. navigationWidget = USER
  64. navigationWidget {
  65. userFunc = tx_extbase_core_bootstrap->run
  66. pluginName = Pi1
  67. extensionName = Yag
  68. controller = Navigation
  69. action = show
  70. switchableControllerActions {
  71. Navigation {
  72. 1 = show
  73. }
  74. }
  75. settings =< plugin.tx_yag.settings
  76. persistence =< plugin.tx_yag.persistence
  77. view =< plugin.tx_yag.view
  78. }
  79.  
  80. }
  81.  
  82.  
  83.  
  84. ## Then use them for your page content
  85. yourPage = PAGE
  86. yourPage {
  87.  
  88. typeNum = 0
  89. 10 = COA
  90. 10 {
  91.  
  92. 10 = HTML
  93. 10.value = <table><tr><td>
  94.  
  95. 20 < plugin.tx_yag.widgets.adminMenuWidget
  96.  
  97. 30 = HTML
  98. 30.value = </td><td><table><tr><td>
  99.  
  100. 32 < plugin.tx_yag.widgets.navigationWidget
  101.  
  102. 33 = HTML
  103. 33.value = </td></tr><tr><td>
  104.  
  105. 40 < plugin.tx_yag.widgets.galleryWidget
  106.  
  107. 50 = HTML
  108. 50.value = </td></tr></table></td></tr></table>
  109.  
  110. }
  111.  
  112. }

 

 

Note that the three widgets - although being part of the same plugin - react on different parameters, as there are different controller / action pairs configured within each widget.

 

The last step is to register this template within your ext_tables.php with the following line of code. Make sure to name your template "setup.txt" and only use the path of the directory within the method:

 

 

  1. // put this line into your ext_tables.php file:
  2. t3lib_extMgm::addStaticFile($_EXTKEY, '<path_to_your_typoscript_file>', '<name_of_your_template>');
  •  
  • 1 Kommentare
  •  
Gravatar: MadcMadc
29.05.2011
18:31
With this post,...

... you really made my day! After wasting hours into trying to make extbase work proper with eID, all problems seam to be solved using page types and your instrucktion.

best,
/m

Mein Kommentar

Ich möchte über jeden weiteren Kommentar in diesem Post benachrichtigt werden.

Zurück

< < Januar 2011 > >
S M T W T F S
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

Letzte Beiträge

Teamertreffen Hindelang
17.05.2011 00:54
Bärenbrunner Hof - Klettern in der Pfalz
25.03.2011 23:40
Blumenkitsch...
21.03.2011 12:11
YAG Gallery is now available in TER
14.03.2011 13:23

Kategorien

  • [-](J)DAV(32)
  • [-]Bergsteigen(35)
  • [-]Computer & Informatik(76)
    • PHP(4)
    • [-]Typo3(64)
  • [-]Fotografie(64)
  • Kaktusteam(3)
  • [-]Laufen(4)
  • Musik & Filme(3)
  • [-]Radfahren(0)
  • [-]Reisen(11)
  • Sonstiges...(5)
  • Studium...(6)

Letzte Kommentare

Danke
20.07.2012 14:13
pid property
30.05.2012 22:11
webdeveloper
19.04.2012 12:32
is zwar lange her, aber gelesen wird der Beitrag ja...
19.12.2011 14:06

Archiv

Kopieren Sie diesen Link in Ihren RSS Reader

RSS 0.91Posts
RSS 2.0Posts