$30 off During Our Annual Pro Sale. View Details »

TheodoRogerCMSBundle

 TheodoRogerCMSBundle

Presentation of the RogerCMS Bundle

Benjamin Grandfond

June 11, 2012
Tweet

More Decks by Benjamin Grandfond

Other Decks in Programming

Transcript

  1. RogerCms
    A developer friendly CMS
    by Benjamin Grandfond & Marek Kalnik
    1
    1

    View Slide

  2. About us
    2
    2

    View Slide

  3. 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

    View Slide

  4. 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

    View Slide

  5. Why?
    5
    5

    View Slide

  6. 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

    View Slide

  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)
    7
    7

    View Slide

  8. 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

    View Slide

  9. 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

    View Slide

  10. 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

    View Slide

  11. History
    11
    11

    View Slide

  12. 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

    View Slide

  13. History
    Fabrice Bernhard:
    13
    13

    View Slide

  14. History
    14
    14

    View Slide

  15. 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

    View Slide

  16. 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

    View Slide

  17. 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

    View Slide

  18. 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

    View Slide

  19. • 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

    View Slide

  20. 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

    View Slide

  21. History
    21
    21

    View Slide

  22. How does it work?
    22
    22

    View Slide

  23. It’s twig
    23
    How does it work?
    {# layout ‘normal’ #}


    {% block title %}No title{% endblock %}



    {% block content %}{% endblock %}



    {% block footer %}{% endblock %}



    23

    View Slide

  24. 24
    {# Your template #}
    {% extends "layout:name" %}

    {% block content %}
    bar content
    {% endblock %}

    Using of layout from the CMS
    It’s twig
    How does it work?
    24

    View Slide

  25. 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

    View Slide

  26. 4 objects
    26
    How does it work?
    26

    View Slide

  27. layout
    27
    • HTML page structure
    • declare Twig blocks
    How does it work?
    27

    View Slide

  28. 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

    View Slide

  29. snippet
    29
    • special Twig tag
    • add shared content (copyrights, ...)
    How does it work?
    29

    View Slide

  30. media
    30
    • manage images
    How does it work?
    30

    View Slide

  31. layout
    page
    this is foo content
    Hello
    {% snippet ‘foosnip’ %}
    {% block foo %}{% endblock %}
    {% block bar %}{% endblock %}
    {% block baz %}{% endblock %} snippet

    This is a
    sample

    block ‘bar’
    block ‘foo’
    31
    How does it work?
    31

    View Slide

  32. 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

    View Slide

  33. 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

    View Slide

  34. 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

    View Slide

  35. 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

    View Slide

  36. Security?
    36
    36

    View Slide

  37. Security?
    • based in Symfony2 security system
    • need more? Have you tried FOSUserBundle? :)
    37
    37

    View Slide

  38. Security?
    • based in Symfony2 security system
    • need more? Have you tried FOSUserBundle? :)
    38
    38

    View Slide

  39. Security?
    • based in Symfony2 security system
    • need more? Have you tried FOSUserBundle? :)
    39
    39

    View Slide

  40. 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

    View Slide

  41. Demo time :)
    41
    41

    View Slide

  42. Demo :)
    42
    Just like that
    (Or see the project's sandbox)
    https://github.com/theodo/rogercms-sandbox
    42

    View Slide

  43. Thank you!
    43
    43

    View Slide

  44. Questions
    44
    Contribute!
    https://github.com/theodo/TheodoRogerCmsBundle
    https://github.com/theodo/rogercms-sandbox
    Feedback!
    @benjaM1 @marekkalnik
    44

    View Slide