| Code: |
|
function RunTemplate($__name__, $__dict__) {
extract($__dict__); include 'modules/' . $GLOBALS['module'] . '/templates/' . $__name__ . '.php'; } |
| Code: |
| Hello, <?=$person?>! |
| Wiseman wrote: |
| I don't think PDO would be better. In terms of performance, most likely not. |
| Wiseman wrote: |
| MVC frameworks are an order of magnitude slower |
| Wiseman wrote: |
| I would like to see how you create a complex SELECT joining several tables.... |
| Wiseman wrote: |
|
(BTW, regarding Python 3000, I'm all for it as long as Guido doesn't mess with lambda, or even better, makes def an rvalue.) |
| Code: |
|
[md:code lang="php"]
highlight php code [/md:code] |
| Code: |
|
private function parse_content_bbcode($text)
{ $cbc_data = array(); preg_match_all('#\[rk_([a-z_0-9]*) (.*?)\](.*?)\[/rk_(\\1)\]#es', $text, $array1); preg_match_all('#\[rk:([a-z_0-9]*) (.*?)\]#es', $text, $array2); IF(is_array($array1) and count($array1[1]) > 0) { foreach($array1[1] as $key => $val) { IF(!is_array($cbc_data[$val])) { $cbc_data[$val] = array(); } array_push($cbc_data[$val], array('atrib' => diamanda::parse_atribute($array1[2][$key]), 'content' => $array1[3][$key], 'all' => $array1[0][$key])); } } unset($array1); IF(is_array($array2) and count($array2[1]) > 0) { foreach($array2[1] as $key => $val) { IF(!is_array($cbc_data[$val])) { $cbc_data[$val] = array(); } array_push($cbc_data[$val], array('atrib' => diamanda::parse_atribute($array2[2][$key]), 'all' => $array2[0][$key])); } } unset($array2); $klucze = array_keys($cbc_data); $klucze = implode('\' OR cbc_key=\'', $klucze); $klucze = 'cbc_key=\''.$klucze.'\''; $query = $this->db->query_select("SELECT cbc_code FROM ".SITE_KEY."_diamanda_cbc WHERE ".$klucze); unset($klucze); IF(is_array($query)) { foreach($query as $res) { eval(stripslashes(base64_decode($res['cbc_code']))); //unset($res['cbc_code']); } } unset($query); unset($cbc_data); return $text; } /** * metoda używana przez parse_content_bbcode */ private function parse_atribute($line) { $line = explode('" ', $line); foreach($line as $key => $foo) { $foo = str_replace('"', '', $foo); $foo = explode('=', $foo); $ret[$foo[0]] = $foo[1]; } unset($line); unset($foo); return $ret; } } |
| Code: |
|
foreach($cbc_data['graf'] as $val)
{ IF(!is_file('data/images/'.SITE_KEY.'/'.md5($val['content']).'.png')) { IF(!isset($val['atrib']['name'])) { $val['atrib']['name'] = 'Wykres'; } $entries = explode("\n", $val['content']); IF(is_array($entries)) { foreach($entries as $res) { $values = explode(':', $res); IF(is_array($values) and strlen($values[0]) > 1) { $vals[strip_tags($values[0])] = (int)$values[1]; } } IF(count($vals > 1)) { $y = $vals; arsort($y); $y_max = array_shift($y); $iter = ceil($y_max/5); $vals = @array_map("strip_tags", $vals); include_once 'kernel/cbc/class.bargraph.php'; $g = new BarGraph(); $g->graph_areaheight = 200; $g->axis_step = $iter; $g->SetGraphPadding(45, 30, 20, 15); $g->SetBarData($vals); $g->SetGraphTitle($val['atrib']['name']); ob_start(); $g->DrawGraph(); $png = ob_get_contents(); ob_end_clean(); file_put_contents('data/images/'.SITE_KEY.'/'.md5($val['content']).'.png', $png); } } } $text = str_replace($val['all'], '<div align="center"><img src="data/images/'.SITE_KEY.'/'.md5($val['content']).'.png" /></div>', $text); unset($vals); unset($val); unset($iter); unset($y); unset($entries); } |
| Code: |
|
[rk_graf name="graph name"]
foo:60 bar:72 barfoo:13 [/rk_graf] |
| TiMax wrote: |
| Wiseman we plain to include also Ajax in next versions after MDLite, if you want to collaborate or to share your code please contact us. |
| Riklaunim wrote: |
| PDO is binary, adodb is a lot of PHP code |
| Quote: |
| PHP needs some time to get such tools (or bindings to object databases). |