Advertisement
Guest User

Untitled

a guest
Feb 6th, 2021
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. title = "Blog Post"
  2. url = "/:slug"
  3. layout = "default"
  4. description = "Viewing a single blog post"
  5. is_hidden = 0
  6.  
  7. [blogPost]
  8. slug = "{{ :slug }}"
  9. categoryPage = "blog/category"
  10.  
  11. [resources]
  12. less[] = "pages/blog.less"
  13. ==
  14. function onInit()
  15. {
  16. $slug = str_replace('.html', '', $this->param('slug'));
  17. $this->addComponent('blogPost', null, ['slug' => $slug]);
  18. }
  19. ==
  20. <?php
  21. function onEnd()
  22. {
  23.     if ($this->post) {
  24.         $this->page->title = $this->post->title;
  25.     }
  26.     else {
  27.         return Redirect::to($this->pageUrl('404'));
  28.     }
  29. }
  30. ?>
  31. ==
  32. {% set image = post.featured_images.first %}
  33. {% set nextPost = blogPost.nextPost %}
  34. {% set lastPost = blogPost.previousPost %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement