E
E
Evgeny Sharafetdinov2017-01-17 23:00:00
Kohana
Evgeny Sharafetdinov, 2017-01-17 23:00:00

How to make personal user pages in kohana?

Tell me how to write personal accounts of users on kohana so that the addresses of their pages are implemented like Vkontakte. More precisely, each user had an id and with the help of it one could go to the page of any user.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lander, 2017-01-17
@usdglander

Have you read ?
As far as I understand, looking diagonally in Bootstrap, you need to write something like:

Route::set('users', '(users(/<id>))')
  ->defaults(array(
            'controller' => 'users,
            'action'     => 'personalPage',
  ));

and in the Users Controller, implement the personalPage method that takes id as a parameter.

E
Evgeniy Sharafetdinov, 2017-01-17
@sharafetdinov_art

is that, it turns out for each user you need to create a controller, the name of which will be Id?

E
entermix, 2017-01-17
@entermix

Something like this:
Controller:

class Controller_Index_Account extends Controller_Index
{
    public function action_index()
    {
        $user_id = $this->request->param('id');
        ...
    }
}

Route:
Route::set('index_account', 'id(/<id>)', ['action' => '(index)',])->
defaults([
        'directory' => 'index',
        'controller' => 'account',
        'action' => 'index',
    ]);

kohanaframework.org/3.3/guide/kohana/routing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question