- di group/masuk dlm controller (misal site controller)
cara nulis, contoh : action[nama action nya dimulai huruf besar]
actionSay
actionCreateComment
namespace app\controllers;
use yii\web\Controller;
class SiteController extends Controller
{
// ...existing code...
public function actionSay($message = 'Hello')
{
return $this->render('say', ['message' => $message]);
}
}
fungsi render = memanggil view di parameter ke 1, berarti file 'say'
file view disimpan di views/site/say.php
maka header dan footer akan tetap sama, isinya yg berubah
tampilan diambil dari : views/layouts/main.php
kalau Controller cara nulisnya : namaController, contoh : siteController.php
No comments:
Post a Comment