A
A
Alexey Orlov2020-02-22 01:51:27
OctoberCMS
Alexey Orlov, 2020-02-22 01:51:27

How to publish only on this :slug page?

I have a url like 'category/:slug', :slug is replaced by the name of the category, but the template for all categories is the same. Each category has a field for entering feedback, but after sending - this review is published in all categories, because. general template. How can this be fixed?

I work with CMS October, which is tied to PHP, Laravel.

This code outputs a comment:

public function onRun() 
    {
        $this->currentCommentSlug = $this->page['currentCommentSlug'] = $this->param('slug');  - Этот код добавил самостоятельно.

        if ($this->property('reviewstyle')) {
            $this->addCss('assets/css/simplereviews-with-paginate.css');
        }
        
        if ($this->property('SortOrder') == 'new') {
            $this->reviews = \IronLab\SimpleReviews\Models\SimpleReview::where('publish', true)->orderBy('created_at', 'desc')->paginate($this->property('items'));

        } elseif ($this->property('SortOrder') == 'old') {

            $this->reviews = \IronLab\SimpleReviews\Models\SimpleReview::where('publish', true)->orderBy('created_at', 'asc')->paginate($this->property('items'));
        }
    }


Component output:
{% component 'SimpleReviewComponentPaginate' currentCommentSlug = __SELF__.currentCommentSlug %}

currentCommentSlug = __SELF__.currentCommentSlug - also wrote it myself.

All the added code was made by analogy with a plugin for a blog. There, for each category, there is also a url with a slug and posts are published in the desired category.

In which direction to look, am I going in the right direction?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question