Permalink
Browse files

Moved Disqus TwigExtension to BlogBundle to namespace it into the Sym…

…fony related code.
  • Loading branch information...
1 parent 4a973c2 commit 49d1290398ee5ae235963205c7179d7250f535c6 @beberlei committed Jan 19, 2011
@@ -5,8 +5,7 @@
<parameters>
<parameter key="whitewashing.blog.feedservice.class">Whitewashing\Blog\FeedService</parameter>
- <parameter key="whitewashing.core.userservice.class">Whitewashing\Blog\UserService</parameter>
- <parameter key="whitewashing.view.twig.htmldisqus.class">Whitewashing\View\Twig\DisqusExtension</parameter>
+ <parameter key="whitewashing.bundle.view.twig.htmldisqus.class">Whitewashing\BlogBundle\View\Twig\DisqusExtension</parameter>
<parameter key="whitewashing.request.currentbloglistener.class">Whitewashing\BlogBundle\Request\CurrentBlogListener</parameter>
<parameter key="whitewashing.blog.default_blog_id">1</parameter>
@@ -40,7 +39,7 @@
<argument>%whitewashing.blog.host_url%</argument>
</service>
- <service id="whitewashing.view.twig.htmldisqus" class="%whitewashing.view.twig.htmldisqus.class%">
+ <service id="whitewashing.bundle.view.twig.htmldisqus" class="%whitewashing.bundle.view.twig.htmldisqus.class%">
<tag name="twig.extension" />
<argument type="service" id="router" />
<argument>%whitewashing.blog.disqus_shortname%</argument>
@@ -7,6 +7,6 @@
<div class="footer">
{{ post.author.name }} on {{ post.created|date('F, d. Y') }},
- <a href="{{ path('blog_show_post', {'id': post.id}) }}#comments">Comments</a>
+ <a href="{{ path('blog_show_post', {'id': post.id}) }}#disqus_thread" data-disqus-identifier="{{post.id}}">Comments and Reactions</a>
</div>
</div>
@@ -0,0 +1,11 @@
+<script type="text/javascript">
+ var disqus_shortname = '{{disqus_shortname}}'; // required: replace example with your forum shortname
+
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function () {
+ var s = document.createElement('script'); s.async = true;
+ s.type = 'text/javascript';
+ s.src = 'http://{{disqus_shortname}}.disqus.com/count.js';
+ (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
+ }());
+</script>
@@ -1,16 +1,16 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<title>Whitewashing.de :: {% block title %}Blog{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
- <link rel="stylesheet" href="{{ asset("bundles/blog/themes/whitewashing-de/blueprint/screen.css") }}" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="{{ asset("bundles/blog/themes/whitewashing-de/blueprint/print.css") }}" type="text/css" media="print" />
- <!--[if lt IE 8]><link rel="stylesheet" href="{{ asset("bundles/blog/themes/whitewashing-de/blueprint/ie.css") }}" type="text/css" media="screen, projection" /><![endif]-->
+ <link rel="stylesheet" href="{{ asset('bundles/blog/themes/whitewashing-de/blueprint/screen.css') }}" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="{{ asset('bundles/blog/themes/whitewashing-de/blueprint/print.css') }}" type="text/css" media="print" />
+ <!--[if lt IE 8]><link rel="stylesheet" href="{{ asset('bundles/blog/themes/whitewashing-de/blueprint/ie.css') }}" type="text/css" media="screen, projection" /><![endif]-->
- <link rel="stylesheet" href="{{ asset("bundles/blog/themes/whitewashing-de/css/whitewashing.css") }}" type="text/css" media="screen, projection" />
- <link rel="stylesheet" href="{{ asset("bundles/blog/themes/whitewashing-de/css/markup.css") }}" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="{{ asset('bundles/blog/themes/whitewashing-de/css/whitewashing.css') }}" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="{{ asset('bundles/blog/themes/whitewashing-de/css/markup.css') }}" type="text/css" media="screen, projection" />
</head>
<body>
@@ -22,7 +22,7 @@
</div>
<div id="menu" class="span-8 last">
- <a href="{{ path('blog') }}"><img class="logo" src="{{ asset("bundles/blog/themes/whitewashing-de/images/logo.jpg") }}" alt="Whitewashing.de" /></a>
+ <a href="{{ path('blog') }}"><img class="logo" src="{{ asset('bundles/blog/themes/whitewashing-de/images/logo.jpg') }}" alt="Whitewashing.de" /></a>
<h3>About Whitewashing.de</h3>
@@ -44,7 +44,7 @@
<p class="buttons">
<a href="http://www.twitter.com/beberlei"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-a.png" alt="Follow beberlei on Twitter"/></a>
- <a href="{{ path('blog_feed') }}"<img src="{{ asset("bundles/blog/themes/whitewashing-de/images/icons/feed-32x32.png") }}" alt="" /></a>
+ <a href="{{ path('blog_feed') }}"<img src="{{ asset('bundles/blog/themes/whitewashing-de/images/icons/feed-32x32.png') }}" alt="" /></a>
</p>
<p>{{ nav_breadcrumb("whitewashing") }}</p>
@@ -66,16 +66,16 @@
<ul class="imagedList">
<li>
- <a href="mailto:kontakt@beberlei.de"><img src="{{ asset("bundles/blog/themes/whitewashing-de/images/icons/email-16x16.png") }}" alt="" />Write me an E-Mail</a>
+ <a href="mailto:kontakt@beberlei.de"><img src="{{ asset('bundles/blog/themes/whitewashing-de/images/icons/email-16x16.png') }}" alt="" />Write me an E-Mail</a>
</li>
<li>
- <a href="{{ path('blog_feed') }}"><img src="{{ asset("bundles/blog/themes/whitewashing-de/images/icons/feed-16x16.png") }}" alt="" />Subscribe to RSS Feed</a>
+ <a href="{{ path('blog_feed') }}"><img src="{{ asset('bundles/blog/themes/whitewashing-de/images/icons/feed-16x16.png') }}" alt="" />Subscribe to RSS Feed</a>
</li>
<li>
- <a href="http://www.twitter.com/beberlei"><img src="{{ asset("bundles/blog/themes/whitewashing-de/images/icons/twitter-16x16.png") }}" alt="" />Follow me on Twitter</a>
+ <a href="http://www.twitter.com/beberlei"><img src="{{ asset('bundles/blog/themes/whitewashing-de/images/icons/twitter-16x16.png') }}" alt="" />Follow me on Twitter</a>
</li>
<li>
- <a href="http://www.slideshare.net/beberlei"><img src="{{ asset("bundles/blog/themes/whitewashing-de/images/icons/slideshare-16x16.png") }}" alt="" />View Conference Slides</a>
+ <a href="http://www.slideshare.net/beberlei"><img src="{{ asset('bundles/blog/themes/whitewashing-de/images/icons/slideshare-16x16.png') }}" alt="" />View Conference Slides</a>
</li>
</ul>
</div>
@@ -94,6 +94,8 @@
</div>
</div>
</div>
+
+ {{ disqus_head_comment_count() }}
</body>
</html>
@@ -1,6 +1,6 @@
<?php
-namespace Whitewashing\View\Twig;
+namespace Whitewashing\BlogBundle\View\Twig;
use Twig_Extension;
use Twig_Environment;
@@ -45,7 +45,7 @@ public function getFunctions()
{
return array(
'disqus_comments' => new Twig_Function_Method($this, 'comments', array('is_safe' => array('html'))),
- 'disqus_comment_count' => new Twig_Function_Method($this, 'commentCount', array('is_safe' => array('html')))
+ 'disqus_head_comment_count' => new Twig_Function_Method($this, 'headCommentCount', array('is_safe' => array('html')))
);
}
@@ -74,8 +74,10 @@ public function comments($object, $route, $param = 'id')
* @param object $object
* @return string
*/
- public function commentCount($object, $route, $param = 'id')
+ public function headCommentCount()
{
- return 0;
+ return $this->engine->render('BlogBundle:Disqus:count.twig.html', array(
+ 'disqus_shortname' => $this->disqusShortname,
+ ));
}
}

0 comments on commit 49d1290

Please sign in to comment.