A
A
Avguston2017-10-09 19:36:48
CodeIgniter
Avguston, 2017-10-09 19:36:48

How to make CNC in CodeIgniter?

Hello. Can you please explain how CNC works in CI? I have already read the documentation. Here I have mysite.ru/main/page/10 - I want it to be mysite.ru/novosti
As I understand it, you need to create a separate novosti controller and do CNC through the route. Is it possible without creating a controller? As a result, pages will be created from under the admin panel - and creating a controller for each page - well, it won’t work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2017-10-09
@Avguston

mysite.ru/main/page/10 - I want it to be mysite.ru/novosti

application/config/routes.php : main controller :
class Main extends CI_Controller
{
    function page($page_id)
    {
          /* Тут ваш код. */
    }
}

S
Sergey Kazakov, 2017-10-09
@walovari

We do this, for each page, based on the title, a title_url is formed
from the route, this title_url is taken and searched in the
route.php Pages Controller database

function index($title_url){
// Поиск нужной страницы
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question