Doubt about layout

Hello friends

I used to use Yii 1.x in my projects some years, now I’m begining a new project and I want use Yii 2, I 'm read the tutorial, but I have some doubt.

I need to create a different layout, and I don’t want use the default main.php in views/layout, so I created this file:

views/layout/adm/default.php

views/layout/adm/menu.php

So in my controller I change the layout:

class SiteController extends Controller

{

public $layout='adm/default';

}

Thats ok.

I have some errors in my default.php, I need to use externals links (css, js, etc)

I created the directory with some js and css in "/" of my project, the directory libs to js and the directory css to some css.

When I use Yii 1.x I call the files using a line like this:

<link rel="stylesheet" type="text/css" href="<?=Yii::app()->request->baseUrl?>/css/main.css">

But in Yii 2 the command Yii::app() does not function. How can I call my external links? I need use my owner js in my default layout

Another line that don’t function in Yii 2 is :

<?php //$this->renderPartial(‘menu’) ?>

Whats Can I use renderPartil in Yii?

Another question, the BootStrap and JQuery are activated for default? I look in config.web.php and don’t find anything

In Yii 2.0 it’s Yii::$app. renderPartial in views is just render. Bootstrap and JQuery are part of both basic and advanced templates but could be turned off.

I don’t know how yii1.1 worked (I’m totally newbie), but in yii2 you have access to Yii::$app instead of Yii::app()

Thanks for informations

How can I turn off the booststrap or jquery on yii 2?

To call external link, this is the better way:

<link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl ?>/css/main.css">

Or there is another and better way?

Use this template to start w/o bootstrap: https://github.com/samdark/yii2-minimal. jQuery removal is about configuring asset bundles. Check the guide.

CSS files are better to be included via assets. Again, check the guide.

Thanks for help

I’m studying the guide, and I found something about Assets and bundle, and I need disable the bootstrap and jquery, so in my web.php I put this conditions on components:

‘components’ => [

    'assetManager' =&gt; [


        'bundles' =&gt; [


            'yii&#092;web&#092;JqueryAsset' =&gt; [


                'js'=&gt;[]


            ],


            'yii&#092;bootstrap&#092;BootstrapPluginAsset' =&gt; [


                'js'=&gt;[]


            ],


            'yii&#092;bootstrap&#092;BootstrapAsset' =&gt; [


                'css' =&gt; [],


            ],





        ],


    ],        

]

And on the file AppAsset, I do this:

class AppAsset extends AssetBundle

{

public &#036;basePath = '@webroot';


public &#036;baseUrl = '@web';


public &#036;css = [       


];


public &#036;js = [


];


public &#036;depends = [


 //   'yii&#092;web&#092;YiiAsset',


  //  'yii&#092;bootstrap&#092;BootstrapAsset',


];   

}

That’s ok or I need to do something more to disable bootstrap and jQuery?

To save some disk space you can remove bootstrap from composer.json and run composer update. Then replace all bootstrap widgets with non-bootstrap code.

Thank you