([\s\S]*?)<% end_repeat %>/e'; protected $phpControl='/<% php %>([\s\S]*?)<% end_php %>/'; function PageView() { } function render() { global $view; $isRepeat = false; if (fopen($this->file, "r")) { $content = file_get_contents($this->file); //preg_match($this->phpControl, $content,$functions); $content=preg_replace($this->phpControl,'\\1',$content); $content=preg_replace('/\\$([\w]+)->([\w]+)/e','$\\1->\\2()',$content); $content=preg_replace($this->expRepeat,'$this->processRepeat(\\1)',$content); /* if (preg_match($this->expRepeat, $content, $matches)) { $isRepeat = true; $repeatContent = $this->processRepeat($matches[1]); $split = preg_split($this->expRepeat, $content); if (is_array($split)) { $content = $split[0]; } }*/ foreach($this->patterns as $pattern => $field) { for($i = 0;$i < count($this->data);$i++) { $content = ereg_replace($pattern, $this->data[$i][$field] , $content); } } if ($isRepeat) { $content .= $repeatContent . $split[1]; } } else { return $this->default; } return $content; } private function processRepeat($content) { $data = ""; for($i = 0;$i < count($this->data);$i++) { $tmp=$content; foreach($this->patterns as $pattern => $field) { $tmp= ereg_replace($pattern, $this->data[$i][$field] , $tmp); } $data .=$tmp; } return $data; } } ?> // template file
{ContestName} Submissions.

<% repeat %>
  • {ProfileTitle}

    • Views: {Views}
    • Since: {SignupDate}
<% end_repeat %>