S
S
sacred12015-02-08 09:51:49
Yii
sacred1, 2015-02-08 09:51:49

Routing Yii1?

Actually, right now I just started to understand Yii, and got a little stuck. It's not very clear how this routing works. Right now, naturally, the default application out of the box (My web Application), which is actually very confusing for beginners. Right now I want to organize everything from scratch, and the questions are:
1) Where to register the default controller, or will it always look for this same SiteController ?
2) In the same laravel there are so-called "routes", in other words, the routes.php file, in which you register all the controllers and actions that you want to use, and most importantly, you specify the $_GET or $_POST methods, depending on how the data is being transferred .Looks like this in Laravel:

Route::get('/', [                                      // $_GET
   'as' => 'index',                                   // главная страница
   'uses' => '[email protected]'  //[email protected]
]);

And how is this organized in Yii? Here, as I understand it, we should simply create a controller with a name like this (PostController) and it will contain, for example, the ActionShow method, but how does it indicate that, for example, we want to send data by POST?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
search74, 2015-02-09
@search74

1) Where to register the default controller:
in the config (/protected/config/main.php) :

return array(
   'defaultController' => 'test', // /protected/controllers/TestController
)

2) In the same laravel there are so-called "routes" ...
in the same config:
'components'=>array(
    'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName' => false,
        'rules'=>array(
            'about' => 'test/actionAbout', // контроллер /protected/controllers/TestController, метод actionAbout()
        )
    )
)

I
Ildar Gizetdinov, 2017-09-23
@webirus

var stop_mobile_scroll = false;

$('.callback__link').click(function(e){
  stop_mobile_scroll = true;
});

$('.popup__close').click(function(e){
  stop_mobile_scroll = false;
});

$(document).on('touchmove',function(e){
  if (stop_mobile_scroll)
    e.preventDefault();
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question