From cd9135e3bdb0cfafc252e3adfcd31a3a37803401 Mon Sep 17 00:00:00 2001 From: Matt Way Date: Tue, 30 Jul 2024 23:00:02 +1000 Subject: [PATCH] Create a php version of page template --- php-template/.devcontainer/devcontainer.json | 30 +++++++++++++++++++ php-template/.vscode/launch.json | 14 +++++++++ php-template/example-input | 15 ++++++++++ php-template/main.php | 28 ++++++++++++++++++ php-template/page_renderer.php | 27 +++++++++++++++++ php-template/template.php | 31 ++++++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 php-template/.devcontainer/devcontainer.json create mode 100644 php-template/.vscode/launch.json create mode 100644 php-template/example-input create mode 100644 php-template/main.php create mode 100644 php-template/page_renderer.php create mode 100644 php-template/template.php diff --git a/php-template/.devcontainer/devcontainer.json b/php-template/.devcontainer/devcontainer.json new file mode 100644 index 0000000..40ade77 --- /dev/null +++ b/php-template/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/php +{ + "name": "PHP", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/php:1-8.3", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Configure tool-specific properties. + // "customizations": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [8000], + + // Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference. + "portsAttributes": { + "8000": { + "label": "Hello Remote World", + "onAutoForward": "notify" + } + } + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html" + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/php-template/.vscode/launch.json b/php-template/.vscode/launch.json new file mode 100644 index 0000000..6362d68 --- /dev/null +++ b/php-template/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch application", + "type": "php", + "request": "launch", + "program": "${workspaceFolder}/main.php", + "args": ["${workspaceFolder}/example-input"], + "cwd": "${workspaceFolder}", + "port": 9000 + } + ] +} \ No newline at end of file diff --git a/php-template/example-input b/php-template/example-input new file mode 100644 index 0000000..4ca0136 --- /dev/null +++ b/php-template/example-input @@ -0,0 +1,15 @@ +{ + "shortName": "Ballarat", + "councilName": "Ballarat City Council", + "wardNames": [ + "Alfredton", + "Delacombe", + "Sebastopol", + "Central", + "Wendouree", + "Golden Point", + "North", + "Brown Hill", + "Buninyong" + ] +} \ No newline at end of file diff --git a/php-template/main.php b/php-template/main.php new file mode 100644 index 0000000..4d4e138 --- /dev/null +++ b/php-template/main.php @@ -0,0 +1,28 @@ +renderCouncilPage($config); +if ($pageContent === null) { + exit(2); +} + +echo $pageContent; +exit(0); diff --git a/php-template/page_renderer.php b/php-template/page_renderer.php new file mode 100644 index 0000000..402fafa --- /dev/null +++ b/php-template/page_renderer.php @@ -0,0 +1,27 @@ + +

+ + + $wardName): ?> + +

+ + + +
+ + +
+ +

Candidate

+ + + +
+ + + +

Lorem Ipsum

+ +
+ + + +
+ \ No newline at end of file