I’m trying to load data from the mysql db to a static page.I’ve already created the DB,assigned it to a yii project in config file. Now I need to load this data into a var and send it to a static page. If I’ve wanted to send to an ordinary page - I would write smth like this
$this->render('about', $content);
So the main question is - how to send data to a static page?
Second question : how to load data from mysql db to a variable! For example db name: testdb, table name: alltext.
I want to load text from content cell of alltext table where id = 1. Thanks in advance!
thanks! I see now - that static page is not an option. It’s just that I feel weird writing several similar actions with only two changing things :
value of $content variable
page to render(term,about etc…)
public function actionTerm()
{
$content = 'Terms content';
$this->render('term',array(
'content'=>'$content'),
));
}
public function actionAboutUs()
{
$content = 'About us content';
$this->render('about',array(
'content'=>'$content'),
));
}
I’m new to Yii and MVC structure in general, so I may express myself incorect sometimes.