public function preview($slug = null)
    {
        $post = $this->Posts->findPendingBySlug($slug)
            ->find('forIndex')
            ->firstOrFail();

        $this->set(compact('post'));

        //Gets related posts
        if (getConfig('post.related')) {
            $related = $this->Posts->getRelated($post, getConfigOrFail('post.related.limit'), getConfig('post.related.images'));
            $this->set(compact('related'));
        }

        $this->render('view');
    }
public function preview($slug = null)
    {
        $post = $this->Posts->findPendingBySlug($slug)
            ->find('forIndex')
            ->firstOrFail();

        $this->set(compact('post'));

        //Gets related posts
        if (getConfig('post.related')) {
            $related = $this->Posts->getRelated($post, getConfigOrFail('post.related.limit'), getConfig('post.related.images'));
            $this->set(compact('related'));
        }

        $this->render('view');
    }
public function preview ( $ slug = null ) { $ post = $ this -> Posts -> findPendingBySlug ( $ slug ) -> find ( 'forIndex' ) -> firstOrFail ( ) ; $ this -> set ( compact ( 'post' ) ) ; //Gets related posts if ( getConfig ( 'post.related' ) ) { $ related = $ this -> Posts -> getRelated ( $ post , getConfigOrFail ( 'post.related.limit' ) , getConfig ( 'post.related.images' ) ) ; $ this -> set ( compact ( 'related' ) ) ; } $ this -> render ( 'view' ) ; }
Preview for posts.
It uses the `view` template.
@param string $slug Post slug
@return void
@uses MeCms\Model\Table\PostsTable::getRelated()
Preview for posts . It uses the view template .