Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling model on view? #884

Closed
testt23 opened this issue Mar 25, 2020 · 0 comments
Closed

Calling model on view? #884

testt23 opened this issue Mar 25, 2020 · 0 comments

Comments

@testt23
Copy link

testt23 commented Mar 25, 2020

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)

@testt23 testt23 closed this as completed Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant