diff --git a/src/Dispatcher/PageDispatcher.php b/src/Dispatcher/PageDispatcher.php index f7774e6b..7802e2e5 100644 --- a/src/Dispatcher/PageDispatcher.php +++ b/src/Dispatcher/PageDispatcher.php @@ -64,11 +64,15 @@ public function loadSource($path, $pathFile) { switch($specialName) { case "header": - $headerSource = file_get_contents($fullPath); + if(empty($headerSource)) { + $headerSource = file_get_contents($fullPath); + } break; case "footer": - $footerSource = file_get_contents($fullPath); + if(empty($footerSource)) { + $footerSource = file_get_contents($fullPath); + } break; } } diff --git a/test/Acceptance/HeaderFooter/src/Page/View/_footer.html b/test/Acceptance/HeaderFooter/src/Page/View/_footer.html new file mode 100644 index 00000000..cfa90e50 --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/_footer.html @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/_header.html b/test/Acceptance/HeaderFooter/src/Page/View/_header.html new file mode 100644 index 00000000..d5ffab6f --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/_header.html @@ -0,0 +1,10 @@ + + + + + Test Website + + +
+

Test Website (base header)

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/another-page.html b/test/Acceptance/HeaderFooter/src/Page/View/another-page.html new file mode 100644 index 00000000..5b0697ef --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/another-page.html @@ -0,0 +1,4 @@ +
+

Another page

+

Look. Another page!

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/_header.html b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/_header.html new file mode 100644 index 00000000..87afa386 --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/_header.html @@ -0,0 +1,10 @@ + + + + + Test Website + + +
+

Test Website (overridden header)

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/index.html b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/index.html new file mode 100644 index 00000000..257efe9a --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-own-header/index.html @@ -0,0 +1,4 @@ +
+

Non-shared nested page

+

This page should have its own header.

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/directory-with-shared-header-footer/index.html b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-shared-header-footer/index.html new file mode 100644 index 00000000..1cf961ae --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/directory-with-shared-header-footer/index.html @@ -0,0 +1,4 @@ +
+

Nested page

+

Look. A nested page!

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/src/Page/View/index.html b/test/Acceptance/HeaderFooter/src/Page/View/index.html new file mode 100644 index 00000000..ebbcdc6e --- /dev/null +++ b/test/Acceptance/HeaderFooter/src/Page/View/index.html @@ -0,0 +1,4 @@ +
+

Homepage

+

Look. The homepage!

+
\ No newline at end of file diff --git a/test/Acceptance/HeaderFooter/test/Acceptance/Behat/FeatureContext.php b/test/Acceptance/HeaderFooter/test/Acceptance/Behat/FeatureContext.php new file mode 100644 index 00000000..e104abdc --- /dev/null +++ b/test/Acceptance/HeaderFooter/test/Acceptance/Behat/FeatureContext.php @@ -0,0 +1,5 @@ +