| @@ 253-275 (lines=23) @@ | ||
| 250 | * @return DBHTMLText|$this |
|
| 251 | * @throws HTTPResponse_Exception |
|
| 252 | */ |
|
| 253 | public function tag() |
|
| 254 | { |
|
| 255 | // Ensure tag exists |
|
| 256 | $tag = $this->getCurrentTag(); |
|
| 257 | if (!$tag) { |
|
| 258 | $this->httpError(404, 'Not Found'); |
|
| 259 | } |
|
| 260 | ||
| 261 | // Get posts with this tag |
|
| 262 | $posts = $this |
|
| 263 | ->data() |
|
| 264 | ->getBlogPosts() |
|
| 265 | ->filter(['Tags.URLSegment' => $tag->URLSegment]); // Soft duplicate handling |
|
| 266 | ||
| 267 | $this->setFilteredPosts($posts); |
|
| 268 | ||
| 269 | // Render as RSS if provided |
|
| 270 | if ($this->isRSS()) { |
|
| 271 | return $this->rssFeed($posts, $tag->getLink()); |
|
| 272 | } |
|
| 273 | ||
| 274 | return $this; |
|
| 275 | } |
|
| 276 | ||
| 277 | /** |
|
| 278 | * Get BlogTag assigned to current filter |
|
| @@ 321-340 (lines=20) @@ | ||
| 318 | * @return DBHTMLText|$this |
|
| 319 | * @throws HTTPResponse_Exception |
|
| 320 | */ |
|
| 321 | public function category() |
|
| 322 | { |
|
| 323 | $category = $this->getCurrentCategory(); |
|
| 324 | ||
| 325 | if (!$category) { |
|
| 326 | $this->httpError(404, 'Not Found'); |
|
| 327 | } |
|
| 328 | ||
| 329 | // Get posts with this category |
|
| 330 | $posts = $this |
|
| 331 | ->data() |
|
| 332 | ->getBlogPosts() |
|
| 333 | ->filter(['Categories.URLSegment' => $category->URLSegment]); // Soft duplicate handling |
|
| 334 | $this->setFilteredPosts($posts); |
|
| 335 | ||
| 336 | if ($this->isRSS()) { |
|
| 337 | return $this->rssFeed($posts, $category->getLink()); |
|
| 338 | } |
|
| 339 | return $this; |
|
| 340 | } |
|
| 341 | ||
| 342 | /** |
|
| 343 | * Category Getter for use in templates. |
|