list_template = $str_template; } /** * Method to set SQL criteria of list * * @param string $str_criteria * @return void */ public function setSQLcriteria($str_criteria) { $this->criteria = $str_criteria; } /** * Method to set SQL field ordering of list * * @param string $str_order * @return void */ public function setSQLorder($str_order) { $this->order = $str_order; } /** * Method to enable or disable list paging * * @param boolean $bool_enable * @return void */ public function pagingEnable($bool_enable) { $this->paging_enable = $bool_enable; } /** * Method to parse list template * * @param array $array_associative_data * @return string */ protected function parseListTemplate($array_associative_data) { if (!$this->list_template) { echo 'There is no template for content list yet'; return; } // get the template markers from regular expression preg_match_all("/\{[a-z_]+?\}/", $this->list_template, $matches); $_markers = $matches[0]; // result buffer var $_result = $this->list_template; foreach ($_markers as $_each_marker) { $_index = str_replace(array('{','}'), '', $_each_marker); if (isset($array_associative_data[$_index]) AND $array_associative_data[$_index]) { $_result = str_replace($_each_marker, $array_associative_data[$_index], $_result); } else { $_result = str_replace($_each_marker, '', $_result); } } return $_result; } }