From 831f4ca317b096f9a0126b2d74287315d95eb550 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Sun, 16 Sep 2012 22:12:26 +0200 Subject: [PATCH] Added blog RSS feed Signed-off-by: Gergely POLONKAI (W00d5t0ck) --- .../FrontBundle/Controller/BlogController.php | 16 +++++++++ .../Resources/public/images/rss_16.png | Bin 0 -> 711 bytes .../Resources/views/Blog/feed.xml.twig | 31 ++++++++++++++++++ .../views/Default/front_base.html.twig | 2 ++ 4 files changed, 49 insertions(+) create mode 100755 src/GergelyPolonkai/FrontBundle/Resources/public/images/rss_16.png create mode 100644 src/GergelyPolonkai/FrontBundle/Resources/views/Blog/feed.xml.twig diff --git a/src/GergelyPolonkai/FrontBundle/Controller/BlogController.php b/src/GergelyPolonkai/FrontBundle/Controller/BlogController.php index be4d3ff..6f773a5 100644 --- a/src/GergelyPolonkai/FrontBundle/Controller/BlogController.php +++ b/src/GergelyPolonkai/FrontBundle/Controller/BlogController.php @@ -71,4 +71,20 @@ class BlogController extends Controller 'post' => $post, ); } + + /** + * @Route("/feed", name="GergelyPolonkaiFrontBundle_blogFeed", defaults={"_format": "xml"}) + * @Template + */ + public function feedAction() + { + $query = $this->getDoctrine()->getEntityManager()->createQuery("SELECT p FROM GergelyPolonkaiFrontBundle:Post p WHERE p.draft = FALSE ORDER BY p.createdAt DESC"); + $query->setMaxResults(10); + $posts = $query->getResult(); + + return array( + 'now' => new \DateTime('now'), + 'posts' => $posts, + ); + } } diff --git a/src/GergelyPolonkai/FrontBundle/Resources/public/images/rss_16.png b/src/GergelyPolonkai/FrontBundle/Resources/public/images/rss_16.png new file mode 100755 index 0000000000000000000000000000000000000000..f921046f9cdd1a3c52e2620969d6be299712c5ab GIT binary patch literal 711 zcmV;&0yzDNP)dbVG7wVRUJ4ZXi@?ZDjy9FETVQ zFgf2>@*^pm{)V1x4Nl z;*HW$B_@fR2>ie`0l=5{8SMEK_S+=7YO~+F4a5RT+(4iM7t-JhgSQ(1=X;4y=`pMq z29b_`xG91pt|RDZxb%e~Za~jP0Lr;Jmc|E&`s}|Ut00Lh2)ZDf1D6WA2fFrv;t#|5 z6m<6DluIn#2@`3vn*kp|rUE!{c)ZjF7XM~U7wDF%nJzX6j8gqgt;>_t9d;8dFdl1Ly3HrP64z{ybnK0G={D4#;{ zhjB(`5P)^>03C8Y$_mIEw0sHX3y_~QV7woI(4{1+6%C3eOi!S;YS5QxiXl_Cqz)QH z9+;?u2CU4&^V=vMAM&xQ;DGXK3;=h}+24R_13-@_aJ6@%$Ll{lHCQi~(2myUHIvHP zGTws&e*hfdD=2T0U@h0q4SV@nT + + + Gergely Polonkai + Gergely Polonkai's Blog + {{ app.request.scheme }}://{{ app.request.host }}{{ app.request.basepath }} + {{ now|date('r') }} + {{ now|date('r') }} + 7200 + en + + Gergely Polonkai + {{ app.request.scheme }}://{{ app.request.host }}{{ asset('bundles/gergelypolonkaifront/images/profile.png') }} + {{ app.request.scheme }}://{{ app.request.host }}{{ app.request.basepath }} + +{% for post in posts %} + + <![CDATA[{{ post.title }}]]> + {{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }} + {{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}#comments + {{ post.createdAt|date('r') }} + Content lead + {{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }} +{# + +#} + +{% endfor %} + + + diff --git a/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig index 09d05b7..059820e 100644 --- a/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig +++ b/src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig @@ -7,6 +7,7 @@ {% stylesheets 'bundles/gergelypolonkaifront/css/*' filter='cssrewrite' output='css/gergelypolonkaiweb.css' %} {% endstylesheets %} + @@ -28,6 +29,7 @@ Tumblr Windows Live deviantArt + RSS Feed