@@ -85,6 +85,10 @@ |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | # $type - page,view |
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 88 | 92 | public function file($name=false){ |
| 89 | 93 | if($name === false){ |
| 90 | 94 | $path = self::$config['core']['page']; |
@@ -100,17 +100,17 @@ |
||
| 100 | 100 | $currentUri = null; |
| 101 | 101 | $filePhtml = null; |
| 102 | 102 | for($i=count($uri)-1; $i>=0; $i--){ |
| 103 | - $nextUri = implode('/',array_slice($uri,0,$i+1)); |
|
| 104 | - $getFile = function($type) use($path,$nextUri){ |
|
| 103 | + $nextUri = implode('/',array_slice($uri,0,$i+1)); |
|
| 104 | + $getFile = function($type) use($path,$nextUri){ |
|
| 105 | 105 | $file = $path.'/'.$nextUri.'/index.'.$type; |
| 106 | 106 | if(is_file($file)) return $file; |
| 107 | 107 | return null; |
| 108 | - }; |
|
| 109 | - $filePhtml = $getFile('phtml'); |
|
| 110 | - if($filePhtml) { $currentUri = $nextUri; break; } |
|
| 108 | + }; |
|
| 109 | + $filePhtml = $getFile('phtml'); |
|
| 110 | + if($filePhtml) { $currentUri = $nextUri; break; } |
|
| 111 | 111 | } |
| 112 | 112 | if($filePhtml === null) { |
| 113 | - $filePhtml = $path.'/index.phtml'; |
|
| 113 | + $filePhtml = $path.'/index.phtml'; |
|
| 114 | 114 | } |
| 115 | 115 | return $filePhtml; |
| 116 | 116 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | class View { |
| 5 | 5 | |
| 6 | 6 | public function __get($name){ |
| 7 | - (new Content)->view($name); |
|
| 7 | + (new Content)->view($name); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | } |
@@ -5,6 +5,9 @@ |
||
| 5 | 5 | |
| 6 | 6 | private $source; |
| 7 | 7 | |
| 8 | + /** |
|
| 9 | + * @param string $source |
|
| 10 | + */ |
|
| 8 | 11 | public function __construct($source){ |
| 9 | 12 | $this->source = $source; |
| 10 | 13 | } |