diff --git a/src/Blogger/BlogBundle/Entity/Blog.php b/src/Blogger/BlogBundle/Entity/Blog.php index 18c657e..09cc4a1 100644 --- a/src/Blogger/BlogBundle/Entity/Blog.php +++ b/src/Blogger/BlogBundle/Entity/Blog.php @@ -268,6 +268,15 @@ public function getTags() return $this->tags; } + public function getTagsLink() + { + $tags = array(); + if ($this->getTags() != '') { + $tags = explode(',', $this->getTags()); + } + return $tags; + } + /** * Set hits * diff --git a/src/Blogger/BlogBundle/Entity/Repository/BlogRepository.php b/src/Blogger/BlogBundle/Entity/Repository/BlogRepository.php index e86c136..1cefc4b 100644 --- a/src/Blogger/BlogBundle/Entity/Repository/BlogRepository.php +++ b/src/Blogger/BlogBundle/Entity/Repository/BlogRepository.php @@ -73,9 +73,10 @@ public function getTagWeights($tags) public function getBlogsForTag($tag, $limit = null) { $qb = $this->createQueryBuilder('b') - ->select('b, c') + ->select('b, c, ct') //->where('FIND_IN_SET(":tag", b.tags)') ->leftJoin('b.comments', 'c') + ->leftJoin('b.category', 'ct') ->addOrderBy('b.created', 'DESC'); //->setParameter('tag', strtolower(trim($tag))); diff --git a/src/Blogger/BlogBundle/Resources/views/Page/category_blogs.html.twig b/src/Blogger/BlogBundle/Resources/views/Page/category_blogs.html.twig index ef7d03a..f0938a2 100644 --- a/src/Blogger/BlogBundle/Resources/views/Page/category_blogs.html.twig +++ b/src/Blogger/BlogBundle/Resources/views/Page/category_blogs.html.twig @@ -24,7 +24,11 @@

Category: {{ blog.category.name }}

Comments: {{ blog.comments|length }}

Posted by {{ blog.author }} at {{ blog.created|date('h:iA') }}

-

Tags: {{ blog.tags }}

+

Tags: + {% for tag in blog.tagsLink %} + {{ tag|trim }} + {% endfor %} +

Hits: {{ blog.hits }}

diff --git a/src/Blogger/BlogBundle/Resources/views/Page/index.html.twig b/src/Blogger/BlogBundle/Resources/views/Page/index.html.twig index 8b4759e..555d2b2 100644 --- a/src/Blogger/BlogBundle/Resources/views/Page/index.html.twig +++ b/src/Blogger/BlogBundle/Resources/views/Page/index.html.twig @@ -20,7 +20,11 @@

Category: {{ blog.category.name }}

Comments: {{ blog.comments|length }}

Posted by {{ blog.author }} at {{ blog.created|date('h:iA') }}

-

Tags: {{ blog.tags }}

+

Tags: + {% for tag in blog.tagsLink %} + {{ tag|trim }} + {% endfor %} +

Hits: {{ blog.hits }}

diff --git a/src/Blogger/BlogBundle/Resources/views/Page/tag_search.html.twig b/src/Blogger/BlogBundle/Resources/views/Page/tag_search.html.twig index 050b10b..2cee427 100644 --- a/src/Blogger/BlogBundle/Resources/views/Page/tag_search.html.twig +++ b/src/Blogger/BlogBundle/Resources/views/Page/tag_search.html.twig @@ -21,9 +21,14 @@