I have a db table named ‘question’ that has placeholders within the ‘question’ field. For example, “What is {company_x}'s price for your product?” where {company_x} will be replaced with another value.
I have a function within my Question model to replace that variable with another, however I call it within the view. For example, in my view I have:
foreach($questions as $question):
echo Question::model()->replace_db_vars($question->question);
endforeach
I feel like this isn’t elegant nor efficient and was wondering if someone had a recommendation on how to do it better.