Added FrontBundle with a sample static blog entry

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Polonkai Gergely 2012-06-16 16:33:00 +02:00
parent b3172570e7
commit a775f44a35
12 changed files with 222 additions and 0 deletions

View File

@ -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'))) {

View File

@ -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"

View File

@ -0,0 +1,14 @@
<?php
namespace GergelyPolonkai\FrontBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function homepageAction()
{
return $this->render('GergelyPolonkaiFrontBundle:Default:index.html.twig', array());
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace GergelyPolonkai\FrontBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->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;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace GergelyPolonkai\FrontBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class GergelyPolonkaiFrontExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}

View File

@ -0,0 +1,9 @@
<?php
namespace GergelyPolonkai\FrontBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class GergelyPolonkaiFrontBundle extends Bundle
{
}

View File

@ -0,0 +1,7 @@
GergelyPolonkaiFrontBundle_homepage:
pattern: /
defaults: { _controller: GergelyPolonkaiFrontBundle:Default:homepage }
GergelyPolonkaiFrontBundle_disclaimer:
pattern: /disclaimer.html
defaults: { _controller: GergelyPolonkaiFrontBundle:Default:disclaimer }

View File

@ -0,0 +1,7 @@
parameters:
# gergely_polonkai_front.example.class: GergelyPolonkai\FrontBundle\Example
services:
# gergely_polonkai_front.example:
# class: %gergely_polonkai_front.example.class%
# arguments: [@service_id, "plain_value", %parameter%]

View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Gergely Polonkai{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ asset('css/front.css') }}" media="screen" />
</head>
<body>
<div id="content-wrapper">
<div id="header">
<h1>Gergely Polonkai</h1>
<h2>developer, systems engineer and administrator</h2>
</div>
<div id="content">
{% block content %}{% endblock content %}
</div>
</div>
<div id="bottombar-wrapper">
<div id="bottombar-padding"></div>
<div id="bottombar"{% if app.environment == 'dev' %} style="bottom: 40px;"{% endif %}>
:: Copyright &copy; 2012, Gergely Polonkai :: <a href="{{ path('GergelyPolonkaiFrontBundle_disclaimer') }}">Disclaimer</a> ::
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,7 @@
{% extends 'GergelyPolonkaiFrontBundle:Default:front_base.html.twig' %}
{% block content %}
<h3>Wordpress madness</h3>
<p class="article-date">14 June, 2012 :: 08:40 by Gergely Polonkai</p>
<p>I'm a bit fed up that I had to install <a href="http://www.mysql.com/">MySQL</a> on my server to have <a href="http://wordpress.org/">Wordpress</a> working, so I've Googled a bit to find a solution for my pain. I found this: <a href="http://codex.wordpress.org/Using_Alternative_Databases">http://codex.wordpress.org/Using_Alternative_Databases</a>. 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!</p>
<p>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?)</p>
{% endblock content %}

View File

@ -0,0 +1,17 @@
<?php
namespace GergelyPolonkai\FrontBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}

73
web/css/front.css Normal file
View File

@ -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;
}