CI =& get_instance(); } /** * Parse a template * * Parses pseudo-variables contained in the specified template view, * replacing them with the data in the second param * * @access public * @param string * @param array * @param bool * @return string */ public function parse($template, $data, $return = FALSE) { $template = $this->CI->load->view($template, $data, TRUE); return $this->_parse($template, $data, $return); } // -------------------------------------------------------------------- /** * Parse a String * * Parses pseudo-variables contained in the specified string, * replacing them with the data in the second param * * @access public * @param string * @param array * @param bool * @return string */ function parse_string($template, $data, $return = FALSE) { return $this->_parse($template, $data, $return); } // -------------------------------------------------------------------- /** * Parse a template * * Parses pseudo-variables contained in the specified template, * replacing them with the data in the second param * * @access public * @param string * @param array * @param bool * @return string */ function _parse($template, $data, $return = FALSE) { if ($template == '') { return FALSE; } foreach ($data as $key => $val) { if (is_array($val)) { $template = $this->_parse_pair($key, $val, $template); } else { $template = $this->_parse_single($key, (string)$val, $template); } } if ($return == FALSE) { $this->CI->output->append_output($template); } return $template; } } // END Parser Class, Extended /* End of file Parser.php */ /* Location: ./application/libraries/MY_Parser.php */