Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TheodoRogerCMSBundle

 TheodoRogerCMSBundle

Presentation of RogerCmsBundle we gave with Benjamin Grandfond at sfPot in Paris.

Marek Kalnik

June 11, 2012
Tweet

More Decks by Marek Kalnik

Other Decks in Programming

Transcript

  1. Benjamin Grandfond @benjaM1 http://github.com/benja-M-1 http://benjamingrandfond.fr • Project Manager @ Theodo

    • Symfony user since 2009 • Creator of Symfttpd [symfy] 2.0 • Creator of http://parisstreetpingpong.fr 3 3
  2. Marek Kalnik @marekkalnik http://github.com/marekkalnik http://marekkalnik.tumblr.com • Lead Developer @ Theodo

    • Release Manager for RogerCMS • Zend Certified PHP 5.3 Engineer • JavaScript junkie 4 4
  3. The idea 6 • we need a tool to let

    our clients modify those "about us" pages (or phone numbers) • we don't want them touch anything else • we want to keep our templates where we like them to be (in the project directory, as static files) 6
  4. The idea • we need a tool to let our

    clients modify those "about us" pages (or phone numbers) • we don't want them touch anything else • we want to keep our templates where we like them to be (in the project directory, as static files) 7 7
  5. The idea • we need a tool to let our

    clients modify those "about us" pages (or phone numbers) • we don't want them touch anything else • we want to keep our templates where we like them to be (in the project directory, as static files) 8 8
  6. The idea • we need a tool to let our

    clients modify those "about us" pages (or phone numbers) • we don't want them touch anything else • we want to keep our templates where we like them to be (in the project directory, as static files) 9 9
  7. The idea • we need a tool to let our

    clients modify those "about us" pages (or phone numbers) • we don't want them touch anything else • we want to keep our templates where we like them to be (in the project directory, as static files) So we want a CMS that can be easily integrated into a Symfony project. 10 10
  8. History Fabien Potencier to Fabrice Bernhard: "I really like how

    RadiantCMS is made, I think it would be great to make a Symfony2 CMS like that. Could you do that?" 12 12
  9. History • started summer 2011 right after Symfony 2.0 release

    • first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 15 15
  10. History • started summer 2011 right after Symfony 2.0 release

    • first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 16 16
  11. History • started summer 2011 right after Symfony 2.0 release

    • first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 17 17
  12. History • started summer 2011 right after Symfony 2.0 release

    • first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 18 18
  13. • started summer 2011 right after Symfony 2.0 release •

    first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 History 19 19
  14. History • started summer 2011 right after Symfony 2.0 release

    • first Symfony2 project @Theodo • used in several projects like www.smartangels.fr, www.epigraf.com.pl • made us contribute to Symfony ;) • publicly released on Github december 2011 20 20
  15. It’s twig 23 How does it work? {# layout ‘normal’

    #} <html> <head> <title>{% block title %}No title{% endblock %}</title> </head> <body> <div id="container"> {% block content %}{% endblock %} </div> <hr /> <div id="footer"> {% block footer %}{% endblock %} </div> </body> </html> 23
  16. 24 {# Your template #} {% extends "layout:name" %} <div

    class="foo"> {% block content %} bar content {% endblock %} </div> Using of layout from the CMS It’s twig How does it work? 24
  17. It’s developer friendly 25 public function pageAction() { // ...

    $page = $this->get('roger.content_repository')->getPageBySlug('contact'); $variables = array( 'form' => $form->createView(), ); return $this->get('roger.templating') ->renderResponse('page:'.$page->getName(), array('page' => $page) + $variables); } Injecting variables into a CMS page Using pages in controllers How does it work? 25
  18. page 28 • add content to Twig blocks • set

    up HTML metas • configure the page cache • publish / draft • link to other pages How does it work? 28
  19. snippet 29 • special Twig tag • add shared content

    (copyrights, ...) How does it work? 29
  20. layout page <p>this is foo content</p> <div>Hello</div> {% snippet ‘foosnip’

    %} {% block foo %}{% endblock %} {% block bar %}{% endblock %} {% block baz %}{% endblock %} snippet <span> This is a sample </span> block ‘bar’ block ‘foo’ 31 How does it work? 31
  21. Routing 32 Products Rackets Performance products rackets performance Pages Slugs

    Urls http://tennis.foo.com/products http://tennis.foo.com/products/rackets http://tennis.foo.com/products/rackets/performance How does it work? 32
  22. Routing 33 Products Rackets Performance products rackets performance Pages Slugs

    Urls http://tennis.foo.com/products http://tennis.foo.com/products/rackets http://tennis.foo.com/products/rackets/performance How does it work? 33
  23. Routing 34 Products Rackets Performance products rackets performance Pages Slugs

    Urls http://tennis.foo.com/products http://tennis.foo.com/products/rackets http://tennis.foo.com/products/rackets/performance How does it work? 34
  24. Routing 35 Products Rackets Performance products rackets performance Pages Slugs

    Urls http://tennis.foo.com/products http://tennis.foo.com/products/rackets http://tennis.foo.com/products/rackets/performance How does it work? 35
  25. Security? 40 Only roles matter! role_hierarchy: ROLE_ROGER_CONTENT: [ROLE_ROGER_READ_CONTENT, ROLE_ROGER_WRITE_CONTENT, ROLE_ROGER_DELETE_CONTENT,

    ROLE_ROGER_PUBLISH_CONTENT] ROLE_ROGER_DESIGN: [ROLE_ROGER_READ_DESIGN, ROLE_ROGER_WRITE_DESIGN, ROLE_ROGER_DELETE_DESIGN] ROLE_ROGER_EDITOR: [ROLE_ROGER_CONTENT, ROLE_ROGER_READ_DESIGN, ROLE_ROGER_PUBLISHER] ROLE_ROGER_DESIGNER: [ROLE_ROGER_CONTENT, ROLE_ROGER_DESIGN, ROLE_ROGER_PUBLISHER] ROLE_ADMIN: [ROLE_USER, ROLE_ROGER_DESIGNER, ROLE_ROGER_EDITOR] ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] 40
  26. Demo :) 42 Just like that (Or see the project's

    sandbox) https://github.com/theodo/rogercms-sandbox 42