added detection for header files

This commit is contained in:
bluesaxman 2019-04-29 08:02:47 -06:00
parent 52c0c49363
commit 0e71232a62

View File

@ -15,6 +15,7 @@ my $data_dir = "./dynamic/";
my $site_base = "/";
my $site_name = "Murkfall Mountain";
my $site_symbol = "&#9968";
my $site500 = "There was an oopsy";
my $site404 = "There is nothing here...";
# Make some tools
@ -49,7 +50,7 @@ sub http_status {
return $header;
}
sub html_tag { # needs to support attributes
sub html_tag {
my $tag = shift;
my $content = shift;
my @attrib_array = @_;
@ -72,7 +73,7 @@ sub html_tag { # needs to support attributes
sub soft_die {
print http_status(500,"text/html; charset=utf-8");
print "<!DOCTYPE html>\n";
print html_tag("html",html_tag("body","There was an oopsy"));
print html_tag("html",html_tag("body",$site500));
exit;
}
@ -103,29 +104,36 @@ sub header {
{attribute=>'content', value=>'text/html; charset=utf-8'});
# Make title dynamic
$header .= html_tag('title',$site_name);
# Check these files to see if they exsist, and only add if they do.
$header .= html_tag(
'link',
undef,
{attribute=>'rel', value=>'icon'},
{attribute=>'type', value=>'image/gif'},
{attribute=>'href', value=>$img_dir.'favicon.gif'});
$header .= html_tag(
'link',
undef,
{attribute=>'rel', value=>"stylesheet"},
{attribute=>'type',value=>"text/css"},
{attribute=>'href',value=>$css_dir.'css'});
$header .= html_tag(
'script',
" ",
{attribute=>'type', value=>"text/javascript"},
{attribute=>'src',value=>$js_dir.'bluecore.js'});
$header .= html_tag(
'script',
" ",
{attribute=>'type', value=>"text/javascript"},
{attribute=>'src', value=>$js_dir.'base'});
if (-e $img_dir.'favicon.gif') {
$header .= html_tag(
'link',
undef,
{attribute=>'rel', value=>'icon'},
{attribute=>'type', value=>'image/gif'},
{attribute=>'href', value=>$img_dir.'favicon.gif'});
}
if (-e $css_dir.'css.css') {
$header .= html_tag(
'link',
undef,
{attribute=>'rel', value=>"stylesheet"},
{attribute=>'type',value=>"text/css"},
{attribute=>'href',value=>$css_dir.'css.css'});
}
if (-e $js_dir.'bluecore.js') {
$header .= html_tag(
'script',
" ",
{attribute=>'type', value=>"text/javascript"},
{attribute=>'src',value=>$js_dir.'bluecore.js'});
}
if (-e $js_dir.'base.js') {
$header .= html_tag(
'script',
" ",
{attribute=>'type', value=>"text/javascript"},
{attribute=>'src', value=>$js_dir.'base.js'});
}
$header .= html_tag(
'meta',
undef,
@ -218,7 +226,6 @@ sub submenu {
shift(@list);
return render_menu("sub",@list);
}
######################### /menu ###########################
sub page_template {
@ -226,7 +233,7 @@ sub page_template {
my $page_content = html_tag(
'div',
$content
# For the main sides command prompt
# For the main sites command prompt
# .html_tag('span'," ", {attribute=>'id', value=>"prompt"})
# .html_tag('span',"&#9608", {attribute=>'class', value=>"cursor"})
,{attribute=>'id', value=>'screen'});