2016-05-26 11 views
0

あなたはAppViewで別のビューで書いた関数をどのように呼び出すのですか?たとえば、インデックスビュー?ビューからCakephp AppView関数

<?php 
/** 
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) 
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* 
* Licensed under The MIT License 
* Redistributions of files must retain the above copyright notice. 
* 
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* @link  http://cakephp.org CakePHP(tm) Project 
* @since  3.0.0 
* @license http://www.opensource.org/licenses/mit-license.php MIT License 
*/ 
namespace App\View; 

use Cake\View\View; 

/** 
* Application View 
* 
* Your application’s default view class 
* 
* @link http://book.cakephp.org/3.0/en/views.html#the-app-view 
*/ 
class AppView extends View 
{  

    public function initialize(){ 
    }  

    public function printNavSidebar(){ 
     echo '<nav class="large-1 medium-2 columns" id="actions-sidebar">'; 
    } 


} 

インデックスビューでprintNavSidebar()関数を呼び出すにはどうすればよいですか?

+0

@BadHorsie私はOPは、単にクラスを表示しませ_templates_ビューを参照したいと思います:テンプレート$thisでそのビュークラスのインスタンスです。 – ndm

+0

私は自分で答えたときにこの質問に投稿し、OOPについて学ぶように教えてくれるのはなぜですか?キンダー・ルード。 –

答えて

0

うわさが見つかりました。

$this->printNavSidebar(); 
関連する問題