From a775f44a35c2d01208ab4ff3fbd5c2deec5aee68 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Sat, 16 Jun 2012 16:33:00 +0200 Subject: [PATCH] Added FrontBundle with a sample static blog entry Signed-off-by: Gergely POLONKAI (W00d5t0ck) --- app/AppKernel.php | 1 + app/config/routing.yml | 4 + .../Controller/DefaultController.php | 14 ++++ .../DependencyInjection/Configuration.php | 29 ++++++++ .../GergelyPolonkaiFrontExtension.php | 28 +++++++ .../GergelyPolonkaiFrontBundle.php | 9 +++ .../FrontBundle/Resources/config/routing.yml | 7 ++ .../FrontBundle/Resources/config/services.yml | 7 ++ .../views/Default/front_base.html.twig | 26 +++++++ .../Resources/views/Default/index.html.twig | 7 ++ .../Controller/DefaultControllerTest.php | 17 +++++ web/css/front.css | 73 +++++++++++++++++++ 12 files changed, 222 insertions(+) create mode 100644 src/GergelyPolonkai/FrontBundle/Controller/DefaultController.php create mode 100644 src/GergelyPolonkai/FrontBundle/DependencyInjection/Configuration.php create mode 100644 src/GergelyPolonkai/FrontBundle/DependencyInjection/GergelyPolonkaiFrontExtension.php create mode 100644 src/GergelyPolonkai/FrontBundle/GergelyPolonkaiFrontBundle.php create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/config/routing.yml create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/config/services.yml create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/views/Default/index.html.twig create mode 100644 src/GergelyPolonkai/FrontBundle/Tests/Controller/DefaultControllerTest.php create mode 100644 web/css/front.css diff --git a/app/AppKernel.php b/app/AppKernel.php index cecead7..8fddcb8 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -17,6 +17,7 @@ class AppKernel extends Kernel new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), + new GergelyPolonkai\FrontBundle\GergelyPolonkaiFrontBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/config/routing.yml b/app/config/routing.yml index 8b4740a..3aa39ed 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,3 +1,7 @@ +GergelyPolonkaiFrontBundle: + resource: "@GergelyPolonkaiFrontBundle/Resources/config/routing.yml" + prefix: / + # Internal routing configuration to handle ESI #_internal: # resource: "@FrameworkBundle/Resources/config/routing/internal.xml" diff --git a/src/GergelyPolonkai/FrontBundle/Controller/DefaultController.php b/src/GergelyPolonkai/FrontBundle/Controller/DefaultController.php new file mode 100644 index 0000000..473f395 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/Controller/DefaultController.php @@ -0,0 +1,14 @@ +render('GergelyPolonkaiFrontBundle:Default:index.html.twig', array()); + } +} diff --git a/src/GergelyPolonkai/FrontBundle/DependencyInjection/Configuration.php b/src/GergelyPolonkai/FrontBundle/DependencyInjection/Configuration.php new file mode 100644 index 0000000..286ed20 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/DependencyInjection/Configuration.php @@ -0,0 +1,29 @@ +root('gergely_polonkai_front'); + + // Here you should define the parameters that are allowed to + // configure your bundle. See the documentation linked above for + // more information on that topic. + + return $treeBuilder; + } +} diff --git a/src/GergelyPolonkai/FrontBundle/DependencyInjection/GergelyPolonkaiFrontExtension.php b/src/GergelyPolonkai/FrontBundle/DependencyInjection/GergelyPolonkaiFrontExtension.php new file mode 100644 index 0000000..9c4f0f4 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/DependencyInjection/GergelyPolonkaiFrontExtension.php @@ -0,0 +1,28 @@ +processConfiguration($configuration, $configs); + + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yml'); + } +} diff --git a/src/GergelyPolonkai/FrontBundle/GergelyPolonkaiFrontBundle.php b/src/GergelyPolonkai/FrontBundle/GergelyPolonkaiFrontBundle.php new file mode 100644 index 0000000..7e9bbb7 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/GergelyPolonkaiFrontBundle.php @@ -0,0 +1,9 @@ + + + + + Gergely Polonkai{% block title %}{% endblock %} + + + +
+ +
+{% block content %}{% endblock content %} +
+
+
+
+
+ :: Copyright © 2012, Gergely Polonkai :: Disclaimer :: +
+
+ + + diff --git a/src/GergelyPolonkai/FrontBundle/Resources/views/Default/index.html.twig b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/index.html.twig new file mode 100644 index 0000000..ca5b181 --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/index.html.twig @@ -0,0 +1,7 @@ +{% extends 'GergelyPolonkaiFrontBundle:Default:front_base.html.twig' %} +{% block content %} +

Wordpress madness

+ +

I'm a bit fed up that I had to install MySQL on my server to have Wordpress working, so I've Googled a bit to find a solution for my pain. I found this: http://codex.wordpress.org/Using_Alternative_Databases. I don't know when this post was written, but I think it's a bit out of date. I mean come on, PDO is the part of PHP for ages now, and they say adding a DBAL to the dependencies would be a project as large as (or larger than) WP itself. Well, yes, but PHP is already a dependency, isn't it? Remove it guys, it's too large!

+

Okay, to be serious... Having a heavily MySQL dependent codebase is a bad thing in my opinion, and changing it is no easy task. But once it is done, it would be a child's play to keep it up to date, and to port WP to other database backends. And it would be more than enough to call it 4.0, and raising version numbers fast is a must nowadays (right, Firefox and Linux Kernel guys?)

+{% endblock content %} diff --git a/src/GergelyPolonkai/FrontBundle/Tests/Controller/DefaultControllerTest.php b/src/GergelyPolonkai/FrontBundle/Tests/Controller/DefaultControllerTest.php new file mode 100644 index 0000000..076b37a --- /dev/null +++ b/src/GergelyPolonkai/FrontBundle/Tests/Controller/DefaultControllerTest.php @@ -0,0 +1,17 @@ +request('GET', '/hello/Fabien'); + + $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); + } +} diff --git a/web/css/front.css b/web/css/front.css new file mode 100644 index 0000000..ebcb1f9 --- /dev/null +++ b/web/css/front.css @@ -0,0 +1,73 @@ +* { + font-family: sans-serif; +} + +body { + background-color: #333333; + margin: 0; +} + +#content-wrapper { + background-color: #ffffff; + width: 960px; + margin-left: auto; + margin-right: auto; + padding-top: 14px; +} + +#header { + height: 120px; + background-color: #4d4d4d; + color: #ffffff; +} + +#header h1 { + text-align: right; + margin: 0 10px 0 0; + font-size: 41px; + font-weight: bold; + padding-top: 45px; +} + +#header h2 { + text-align: right; + margin: 0 10px 0 0; + font-size: 12px; + font-weight: normal; + padding-top: 5px; +} + +#content { + padding: 8px; +} + +#bottombar-wrapper { + display: block; +} + +#bottombar-padding { + clear: both; + height: 35px; +} + +#bottombar { + position: fixed; + background-color: #4d4d4d; + bottom: 0; + left: 0; + margin: 0; + z-index: 70000; + width: 100%; + padding: 1em; + text-align: center; + vertical-align: center; + color: #b3b3b3; + font-size: 10px; + border-top: 1px solid black; +} + +#bottombar a { + color: #b3b3b3; + text-decoration: underline; +} +