ViewModel:
app/views/index.php
<?php
class View_Index extends ViewModel
{
public function view()
{
$this->title = "Testing this ViewModel thing";
}
}
View
app/views/index.php
<h1><?php echo $title; ?></h1>
Controller
app/classes/controller/home.php
public function action_index()
{
ViewModel::forge('index');
}
But it did not work, is there any wrong?
A viewmodel is a class and should therefore go in app/classes/view.
If something doesn't work as expected, tell us what you have done, what you expected, what the error message was. We can't do much with "it doesnt work"...