【发布时间】:2014-05-02 12:20:47
【问题描述】:
我说的是 CakePHP Helper。我想使用 CakePHP 的助手加载 JS 文件。
考虑Helper类的构建会加载所有必要的JS文件。
但是,我需要在一个视图中多次调用该 Helper。因此,JS文件可能会被多次调用。我只想加载这些 JS 文件一次。
谁能帮我介绍一下这个?
这将是我的助手脚本
<?php
App::uses('AppHelper', 'View/Helper');
/**
* @alias Mathjax Class for helper
* @description This class is to define helper in cakephp.
*/
class MathjaxHelper extends AppHelper {
/*
* Constructor of the class.
*/
function __construct(View $View, $settings = array()) {
parent::__construct($View, $settings);
//login to load all necessary JS files.
}
function create() {
//this function will return the helper html
}
}
【问题讨论】:
标签: javascript php cakephp cakephp-2.0