panique / huge

Simple user-authentication solution, embedded into a small framework.
2.14k stars 788 forks source link

Calling model on view? #884

Closed testt23 closed 4 years ago

testt23 commented 4 years ago

I have a view which comport a table of data, this data is generated on a model. How can I call this model in my view to be posted on my view.

app/controller/Test.php app/model/TestModel.php app/model/view/test/index.php

in app/model/TestModel.php I have use this function:

<?php
class TestModel
{
    public static function getOption($column, $value)
    {
            $database = DatabaseFactory::getFactory()->getConnection();

            $query = $database->prepare("SELECT * FROM `options` WHERE `category`='".$column."' AND `value`='".$value."' LIMIT 0,1");
            $query->execute();

            return $query;
    }
}

And how I can calling this function in my: app/view/test/index.php ?

I have a test this , but not working: echo $this->TestModel::getOption('listing_condition', $this->test->listing_condition) echo TestModel::getOption('listing_condition', $this->test->listing_condition)