Load text from DB before <!-- more --> tag

I have

in mysql db.

How can i get data before <!-- more --> tag on the mysql side without using php’s regexp?

SELECT SUBSTRING_INDEX(foo, '<!--more-->',1) AS bar

where ‘foo’ is the column you want to select.

See substring_index.

Code from yii blog example (probably partly modified)


     * Lists all posts.


    public function actionList()


	$criteria = new CDbCriteria;

	$criteria->condition = 'status=' . Post::STATUS_PUBLISHED;

//TODO SELECT SUBSTRING_INDEX till <!-- more --> <<<< here

	$criteria->order = 'createTime DESC';

	$postCount = Post::model()->count($criteria);

	$pages = new CPagination($postCount);

	$pages->pageSize = Yii::app()->params['postsPerPage'];


	//TODO add tags criteria

	$posts = Post::model()->findAll($criteria);

	$this->render('list', array(





And how can i

SELECT SUBSTRING_INDEX(foo, '<!--more-->',1) AS bar

with yii AR in this action?

If <!-- more --> tag is absent full content should be loaded.

CDbCriteria has a ‘select’ attribute.