博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Upgrade Guide
阅读量:7080 次
发布时间:2019-06-28

本文共 1539 字,大约阅读时间需要 5 分钟。

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 App\Controllers;

Models

namespace App\Models;

Modules

namespace App\Controllers\ModuleName;

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 \App\Models\ModelName(); }

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.

<?=SITETITLE;?>

 

转载地址:http://shlml.baihongyu.com/

你可能感兴趣的文章
linux 修改时区
查看>>
ueditor 定制工具栏图标
查看>>
编程技术面试的五大要点
查看>>
函数fgets和fputs、fread和fwrite、fscanf和fprintf用法小结
查看>>
wxwidgets wxstring与std::string互相转换
查看>>
zoj 2316 Matrix Multiplication(2-D)
查看>>
ios委托delegate与协议protocol
查看>>
Java动态调用webService,axis2动态调用webService
查看>>
PHP 发送邮件
查看>>
java初学代码,还不太熟练
查看>>
gb2312提交的url编码转换成utf8的查询
查看>>
python使用SUDS调用webservice
查看>>
会议室预定设计
查看>>
oracle lengthb
查看>>
js执行效率小结
查看>>
5.Selector详解
查看>>
[LeetCode] Set Matrix Zeroes 解题报告
查看>>
[转载]Linux open函数简介
查看>>
未能读取并闩锁页 (1:xxxxx)(用闩锁类型 SH)
查看>>
字符串 和null值相加 结果依然是null值的实验
查看>>