I can not understand how to display the contents.

For example, there is a controller:

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class News extends CI_Controller { public function __construct() { parent::__construct(); } public function index() { // код } public function view($slug = NULL) { // код } public function photo() { // код } } 

When calling:

site / news - all news opens

site / news / view / 2 - opens 1 news with id 2

How to add a final photo link to one news page to open a page with photos of this news, for example:

site / news / view / 2 - opens 1 news with id 2

site / news / view / 2 / photo - a page of photos to news with id 2 opens

I can not understand how to implement. If you specify the photo function in the controller, it opens as the site / news / photo.

Is there any way to make an option from the site / news / view / 2 / photo?

    1 answer 1

    You can do it through routs, see http://code-igniter.ru/user_guide/general/routing.html

    The rule would be something like this: $route['news/view/(\d+)/photo'] = "news/photo/$1";

    the class method is accordingly:

     public function photo($id=0) { // код } 
    • Thank. Everything works - kate