zoukankan      html  css  js  c++  java
  • Upgrade Guide

    Upgrade Guide

    This guide will point out the key points to be aware of when upgrading to version 3.

    All classes within the app directory have a new namespace of App, controllers and models/modules have the following namespaces for classes placed directly in those directories.

    Controllers

    namespace AppControllers;

    Models

    namespace AppModels;

    Modules

    namespace AppControllersModuleName;

    Instantiating a model

    Models are instantiated typically within a construct method, use the full namespace to call the class:

    public function __construct()
    {
        parent::__construct();
        $this->model = new AppModelsModelName();
    }

    Views

    Views like classes should have filenames starting with a capital letter for both the directory and the file, for instance welcome/index.php becomes Welcome/Index.php.

    View::render('Welcome/Index', $data);

    Loading Images, css, js and assets

    Nova has been designed to live above the document root as such images and other assets cannot be called directly instead they need to be routed from Nova, this is done by calling Url::resourcePath().

    By default this will return the path to the assets folder, place general assets in there. For theme files place them inside the Theme/Assets directory and call them by using Url::templatePath() this loads the path to the default template.

    Make use of the Assets helper to load the css files:

    Assets::css([
        'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css',
        Url::templatePath().'css/style.css'
    ]);

    An example of loading an image from Default/Assets/images.

    <img src='<?=Url::templatePath();?>images/nova.png' alt='<?=SITETITLE;?>'>

     

  • 相关阅读:
    如何学习WindDbg
    如何在程序中嵌入google的V8 Javascript引擎
    理解程序内存
    如何学习Windows编程
    如何让窗口控件半透明
    Sessions, Window Stations and Desktops
    QQ截图时窗口自动识别的原理
    为什么设计模式在C++社区没有Java社区流行?
    当年写的俄罗斯方块
    如何判断一个C++对象是否在堆上
  • 原文地址:https://www.cnblogs.com/chunguang/p/5642921.html
Copyright © 2011-2022 走看看