Add skeleton.php

This commit is contained in:
Sage Vaillancourt 2024-01-21 22:41:16 -05:00
parent dc81332d01
commit 699ce8a5aa
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,60 @@
<?php
echo '<!DOCTYPE html>';
echo '<html lang="en">';
echo '<!-- This is a simple PHP template -->';
// This section could also use <?= syntax, but for example's sake, will not.
?>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= ucfirst(basename(__FILE__, '.php')) ?></title>
<link rel="stylesheet" href="css/style.css">
<meta name="description" content="">
<meta property="og:title" content="">
<meta property="og:type" content="">
<meta property="og:url" content="">
<meta property="og:image" content="">
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="icon.png">
<link rel="manifest" href="site.webmanifest">
<meta name="theme-color" content="#fafafa">
</head>
<body>
<h1>Hello world!</h1>
<p><?= "This page was rendered on " . date("Y-m-d") ?></p>
<pre><?php
$pairs = [
"hello" => "world!",
"how are" => "you?",
"i like the number" => 3
];
// Iterate over key-value pairs
foreach ($pairs as $k => $v) {
echo "($k, $v) ";
}
echo "\n\n";
// Iterate over keys
foreach (array_keys($pairs) as $key) {
echo "$key: $pairs[$key]\n";
}
echo "\n";
// Iterate over values
foreach ($pairs as $value) {
echo "values = $value\n";
}
?>
</pre>
</body>
</html>

View File

@ -165,6 +165,7 @@ if has ("autocmd")
autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py
autocmd BufNewFile *.rb 0r ~/.vim/templates/skeleton.rb
autocmd BufNewFile *.lua 0r ~/.vim/templates/skeleton.lua
autocmd BufNewFile *.php 0r ~/.vim/templates/skeleton.php
autocmd BufNewFile *.md 0r ~/.vim/templates/skeleton.md
autocmd BufNewFile *.html 0r ~/.vim/templates/skeleton.html
autocmd BufNewFile *.java 0r ~/.vim/templates/skeleton.java