-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
431b494
commit d7ac570
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,57 @@ | ||
snippet php "" | ||
snippet php "simple php boiler" | ||
<?php | ||
$1 | ||
?> | ||
endsnippet | ||
|
||
snippet php-if "php conditionals" | ||
<? if ($1): ?> | ||
<? elseif (): ?> | ||
<? else: ?> | ||
<? endif; ?> | ||
endsnippet | ||
|
||
snippet php-composer "php composer imports" | ||
use Dotenv\Dotenv; | ||
require 'vendor/autoload.php'; | ||
|
||
$dotenv = Dotenv::createImmutable(__DIR__); | ||
$dotenv->load(); | ||
endsnippet | ||
|
||
snippet html "creates a html5 template" | ||
<html lang="en"> | ||
<head> | ||
<title></title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
<title></title> | ||
</head> | ||
<body> | ||
$1 | ||
</body> | ||
</html> | ||
endsnippet | ||
|
||
snippet html-style "html style tag" | ||
<style> | ||
$1 | ||
</style> | ||
endsnippet | ||
|
||
snippet php-pages "multiple page routes" | ||
<?php if ($_SERVER['REQUEST_URI'] == '$1'): ?> | ||
<?php elseif ($_SERVER['REQUEST_URI'] == ''): ?> | ||
<?php else: ?> | ||
<?php endif; ?> | ||
endsnippet | ||
|
||
snippet php-sqlite "init a sqlite db using php" | ||
try { | ||
$db = new PDO('sqlite:users.db'); | ||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
$db->exec($1); | ||
} catch(Exception $e) { | ||
error_log("Database Error: " . $e->getMessage()); | ||
} | ||
endsnippet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters