Created
August 1, 2021 12:21
-
-
Save stefanocudini/d7ac418f7533c8a3dc89f04199acdfdf to your computer and use it in GitHub Desktop.
php cli script to genrate html boilerplate
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
#!/usr/bin/env php | |
<?php | |
ob_start(); | |
if(isset($argv[1])) | |
$outfile = $argv[1]; | |
else | |
$outfile = 'index.html'; | |
if($outfile==='-') | |
$outfile = 'php://stdout'; | |
$content = readline("Content:"); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title></title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<style> | |
/* @import url('style.css'); */ | |
#content { | |
} | |
</style> | |
</head> | |
<body> | |
<div id="content"> | |
<?php | |
echo $content; | |
?> | |
</div> | |
<!--script src="https://unpkg.com/browse/[email protected]/dist/jquery.min.js"></script--> | |
<script> | |
$(function() { | |
}); | |
</script> | |
</body> | |
</html> | |
<?php | |
$HTML = ob_get_clean(); | |
if(!is_file('index.html')) | |
file_put_contents($outfile, $HTML); | |
else | |
echo $HTML; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment