Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
すべてのモデルのすべてのアクションにリクエストを追加することなく、すべての CakePHP ページに何かをロードすることは可能ですか? どこかに追加するだけで、すべてのページで完了ですか?
まず、モデルにはアクションがありません。コントローラーにはアクションがあります。
を使用して、すべてのコントローラーにデータをロードできます。AppController::beforeFilter()
AppController::beforeFilter()
class AppController extends Controller { public function beforeFilter() { $this->set('something', $foobar); } }
レイアウト ファイル内のすべてのページにビューを読み込むこともできます。