2013-03-01 22 views

回答

2

視圖內部的代碼被執行,因爲Cake使用include來處理它。只要有一個PHP開始標籤和語法是好的,是文件中的任何代碼會被執行

include('any_file_you_want.with_any_extension'); 

:你可以這樣做你自己。

1

look cakephp遵循MVC體系結構。

Hence the files structures are divided into 3 main modules:- 

1.Model:- This the file in which you write your validations. 
2.COntroller:- This the file where you write your programs logic. 
3.View:- This is the file where you write your output/design in the form of HTML and also write Java script. 

Now coming back to your question. The .ctp files are nothing but the View part of the cakephp. They are initiated/ called by the controllers. The controllers act as a heart of ur php.They are the one's to call your .ctp file and execute the file and also css files are called and handled by them only. 

Go through the documentation throughly... 

我理解文檔可能會有點混亂,閱讀它的4-5倍ü西港島線得到KNW每一件事情生根粉蛋糕...

0

CakePHP是對MVC結構的PHP框架。 模型視圖控制器的MVC支架。

模型:其中您的數據庫表定義和所有的處理和驗證,如果您有名爲「USER」的表,那麼要訪問該表,您將在Model目錄中創建UserModel.php。

控制器:對於每一個型號一個控制器是定義我們的業務logic.here我們的控制器名稱將是UsersController.php

查看 ::查看文件擴展名有.ctp。它定義瞭如何在客戶端瀏覽器上顯示數據。

CakePHP的流程:客戶端請求將轉到第一個UsersController.php。控制器將從UserModel.php獲取數據。處理檢索到的數據後,Controller將此數據傳遞給View。 View(.ctp)文件包含HTML,CSS和客戶端腳本數據,這些數據將返回到將顯示的客戶端計算機。

相關問題