diff --git a/index.php b/index.php new file mode 100644 index 0000000..401f022 --- /dev/null +++ b/index.php @@ -0,0 +1,52 @@ + $value) + { + if (!in_array($value,array(".",".."))) + { + if (is_dir($path . DIRECTORY_SEPARATOR . $value)) + { + $result[$value] = dirToArray($path . DIRECTORY_SEPARATOR . $value); + } + else + { + $result[] = $value; + } + } + } + + return $result; +} + +function renderTemplates($entryPoint){ + $templates = dirToArray($entryPoint); + $content = ''; + + foreach ($templates as $key => $value) { + $content = include("$entryPoint/$value"); + } + return $content; + +} + +// function renderTemplatesRecursive($pageName, $content = ''){ +// ob_start(); +// $filename = 'templates/' . $pageName . '.php'; +// if(file_exists($filename)){ +// include($filename); +// } +// return ob_get_clean(); +// } + + +renderTemplates('templates'); +?> \ No newline at end of file diff --git a/scripts/task1.php b/scripts/task1.php new file mode 100644 index 0000000..fae2e6c --- /dev/null +++ b/scripts/task1.php @@ -0,0 +1,12 @@ += 0 && $b >= 0) { + $sub = $a - $b; +} elseif ($a < 0 || $b < 0) { + $mul = $a * $b; +} else { + $sum = $a + $b; +} +?> \ No newline at end of file diff --git a/scripts/task2.php b/scripts/task2.php new file mode 100644 index 0000000..f5d18fb --- /dev/null +++ b/scripts/task2.php @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/scripts/task3&4.php b/scripts/task3&4.php new file mode 100644 index 0000000..00518da --- /dev/null +++ b/scripts/task3&4.php @@ -0,0 +1,47 @@ + \ No newline at end of file diff --git a/scripts/task6.php b/scripts/task6.php new file mode 100644 index 0000000..eddaccc --- /dev/null +++ b/scripts/task6.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/scripts/task7.php b/scripts/task7.php new file mode 100644 index 0000000..c4122ec --- /dev/null +++ b/scripts/task7.php @@ -0,0 +1,28 @@ + 10 && $str < 20){ //11 - 19 + return $for_5; + } + if ($str_x > 1 && $str_x < 5){ //2,3,4 + return $for_2; + } + if ($str_x == 1){ //1 + return $for_1; + } + return $for_5; +} + +$h = handleCases(getHours(), 'час', 'часа', 'часов'); +$m = handleCases(getMinutes(), 'минута', 'минуты', 'минут'); +?> \ No newline at end of file diff --git a/templates/main.php b/templates/main.php new file mode 100644 index 0000000..80cacf6 --- /dev/null +++ b/templates/main.php @@ -0,0 +1,65 @@ + + +
+ +