Share
Embed
Transcript
44 slides
-
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
• 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 -
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 -
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 -
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 -
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 -
layout 27 • HTML page structure • declare Twig blocks
How does it work? 27 -
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 -
snippet 29 • special Twig tag • add shared content
(copyrights, ...) How does it work? 29 -
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 -
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 -
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 -
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 -
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 -
Security? • based in Symfony2 security system • need more?
Have you tried FOSUserBundle? :) 37 37 -
Security? • based in Symfony2 security system • need more?
Have you tried FOSUserBundle? :) 38 38 -
Security? • based in Symfony2 security system • need more?
Have you tried FOSUserBundle? :) 39 39 -
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 -
Demo :) 42 Just like that (Or see the project's
sandbox) https://github.com/theodo/rogercms-sandbox 42