Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Undefined offset: 1, Undefined offset: 1
nygus9928
post 24.10.2014, 17:57:37
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 19.10.2012

Ostrzeżenie: (0%)
-----


  1.  
  2. class Template {
  3. public $temp;
  4.  
  5. public $stemp;
  6.  
  7. public $track;
  8.  
  9. public $optype;
  10.  
  11. public $arr_elem;
  12.  
  13. public $temp_elem;
  14.  
  15. public $path = "templates/";
  16.  
  17. public $temp_name = "default";
  18.  
  19. public $ext = ".tpl";
  20.  
  21. public $arr_type = array("options","inputs");
  22.  
  23. public function render_page($tpl, $arr_data="", $directory="")
  24. {
  25. global $scms;
  26.  
  27. $directory = ($directory)? $directory."/" : $directory;
  28. $this->track = $this->path.$this->temp_name."/".$directory.$tpl.$this->ext;
  29. @$this->temp = file_get_contents($this->track);
  30.  
  31. if(empty($arr_data))
  32. return $this->temp;
  33.  
  34. if($this->temp)
  35. {
  36. foreach($arr_data as $elem => $val)
  37. {
  38. if(is_array($val))
  39. {
  40. $this->arr_elem = explode("-",$elem);
  41. $elem = $this->arr_elem[0];
  42. $this->temp_elem = substr($this->arr_elem[1], 0, -1);
  43. foreach($val as $attr => $op)
  44. {
  45. if(in_array($this->arr_elem[1] ,$this->arr_type))
  46. {
  47. switch($this->arr_elem[1])
  48. {
  49. case "options":
  50. $this->optype .= "<$this->temp_elem value=\"$attr\">$op</$this->temp_elem>";
  51. break;
  52.  
  53. case "inputs":
  54. $this->optype .= "$op<$this->temp_elem name=\"$attr\" />";
  55. break;
  56. }
  57. }
  58. else
  59. $this->optype .= $op;
  60. }
  61. $this->stemp = $this->optype;
  62. unset($this->optype);
  63. }
  64. else
  65. $this->stemp = $val;
  66.  
  67. $this->temp = str_replace("{tpl::$elem}", $this->stemp, $this->temp);
  68. }
  69.  
  70. $this->temp = preg_replace("({(.*?)})", "", $this->temp);
  71.  
  72. return $this->temp;
  73. }
  74. else
  75. return $this->track." not found<br />";
  76. }
  77.  
  78. public function __desctruct()
  79. {
  80. unset($this->temp);
  81. unset($this->stemp);
  82. unset($this->track);
  83. unset($this->arr_elem);
  84. unset($this->temp_elem);
  85. }


Wywala mi 1 błąd w 42 linijce i 6 błędów w 45.
Nie mam pojęcia co jest nie tak.

Ten post edytował nygus9928 24.10.2014, 17:58:17
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 15:20