From 9c91a87720a74fd2a0061c58ecb44d8b3e030897 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 10 Dec 2025 15:54:25 +0100 Subject: [PATCH] Refactor: Extract header and footer into reusable snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Created site/snippets/header.php with parameterized title and template - Created site/snippets/footer.php with optional additional scripts - Updated home.php and product.php to use the new snippets - Reduces code duplication and improves maintainability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- site/snippets/footer.php | 19 +++++++++++ site/snippets/header.php | 50 ++++++++++++++++++++++++++++ site/templates/home.php | 66 ++---------------------------------- site/templates/product.php | 68 ++------------------------------------ 4 files changed, 73 insertions(+), 130 deletions(-) create mode 100644 site/snippets/footer.php create mode 100644 site/snippets/header.php diff --git a/site/snippets/footer.php b/site/snippets/footer.php new file mode 100644 index 0000000..6acee68 --- /dev/null +++ b/site/snippets/footer.php @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/site/snippets/header.php b/site/snippets/header.php new file mode 100644 index 0000000..262e42b --- /dev/null +++ b/site/snippets/header.php @@ -0,0 +1,50 @@ + + + + + + + <?= $title ?? $page->title() ?> | Index.ngo + + + + + + + + + + diff --git a/site/templates/home.php b/site/templates/home.php index 3860da0..26ed9c6 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -1,53 +1,4 @@ - - - - - - - <?= $site->title() ?> | Index.ngo - - - - - - - - - - + $site->title(), 'template' => 'store']) ?>

@@ -75,17 +26,4 @@

- - - - - + diff --git a/site/templates/product.php b/site/templates/product.php index f44a401..cf1fd98 100644 --- a/site/templates/product.php +++ b/site/templates/product.php @@ -1,53 +1,4 @@ - - - - - - - <?= $page->title() ?> | Index.ngo - - - - - - - - - - + $page->title(), 'template' => 'shop']) ?>
- - - - - - - + ['assets/js/product-size.js', 'assets/js/snipcart.js']]) ?>