Advertisement
seriy-coder

func (o_0)

Feb 18th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.         private function parse_array($arr){
  2.            
  3.             if(!@$arr["file"] ) {
  4.                   $result = "";
  5.                 foreach($arr as $one)
  6.                      $result .= $this->parse_array($one);
  7.                      }
  8.             else{
  9.                     $result = file_get_contents("templates/".$arr["file"].".tpl");
  10.                     foreach($arr["keys"] as $key => $one){
  11.                         if(is_array($one)){  /////is tpl
  12.                             $tmp = $this->parse_array($one);
  13.                             $result = str_replace("{".strtoupper($key)."}", $tmp, $result);
  14.                         }
  15.                         else    /////is value
  16.                             $result = str_replace("{".strtoupper($key)."}", $one, $result);
  17.                     }      
  18.             }
  19.             return $result;
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement