added detection for header files
This commit is contained in:
parent
52c0c49363
commit
0e71232a62
61
index.pl
61
index.pl
@ -15,6 +15,7 @@ my $data_dir = "./dynamic/";
|
|||||||
my $site_base = "/";
|
my $site_base = "/";
|
||||||
my $site_name = "Murkfall Mountain";
|
my $site_name = "Murkfall Mountain";
|
||||||
my $site_symbol = "⛰";
|
my $site_symbol = "⛰";
|
||||||
|
my $site500 = "There was an oopsy";
|
||||||
my $site404 = "There is nothing here...";
|
my $site404 = "There is nothing here...";
|
||||||
|
|
||||||
# Make some tools
|
# Make some tools
|
||||||
@ -49,7 +50,7 @@ sub http_status {
|
|||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub html_tag { # needs to support attributes
|
sub html_tag {
|
||||||
my $tag = shift;
|
my $tag = shift;
|
||||||
my $content = shift;
|
my $content = shift;
|
||||||
my @attrib_array = @_;
|
my @attrib_array = @_;
|
||||||
@ -72,7 +73,7 @@ sub html_tag { # needs to support attributes
|
|||||||
sub soft_die {
|
sub soft_die {
|
||||||
print http_status(500,"text/html; charset=utf-8");
|
print http_status(500,"text/html; charset=utf-8");
|
||||||
print "<!DOCTYPE html>\n";
|
print "<!DOCTYPE html>\n";
|
||||||
print html_tag("html",html_tag("body","There was an oopsy"));
|
print html_tag("html",html_tag("body",$site500));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,29 +104,36 @@ sub header {
|
|||||||
{attribute=>'content', value=>'text/html; charset=utf-8'});
|
{attribute=>'content', value=>'text/html; charset=utf-8'});
|
||||||
# Make title dynamic
|
# Make title dynamic
|
||||||
$header .= html_tag('title',$site_name);
|
$header .= html_tag('title',$site_name);
|
||||||
# Check these files to see if they exsist, and only add if they do.
|
if (-e $img_dir.'favicon.gif') {
|
||||||
$header .= html_tag(
|
$header .= html_tag(
|
||||||
'link',
|
'link',
|
||||||
undef,
|
undef,
|
||||||
{attribute=>'rel', value=>'icon'},
|
{attribute=>'rel', value=>'icon'},
|
||||||
{attribute=>'type', value=>'image/gif'},
|
{attribute=>'type', value=>'image/gif'},
|
||||||
{attribute=>'href', value=>$img_dir.'favicon.gif'});
|
{attribute=>'href', value=>$img_dir.'favicon.gif'});
|
||||||
$header .= html_tag(
|
}
|
||||||
'link',
|
if (-e $css_dir.'css.css') {
|
||||||
undef,
|
$header .= html_tag(
|
||||||
{attribute=>'rel', value=>"stylesheet"},
|
'link',
|
||||||
{attribute=>'type',value=>"text/css"},
|
undef,
|
||||||
{attribute=>'href',value=>$css_dir.'css'});
|
{attribute=>'rel', value=>"stylesheet"},
|
||||||
$header .= html_tag(
|
{attribute=>'type',value=>"text/css"},
|
||||||
'script',
|
{attribute=>'href',value=>$css_dir.'css.css'});
|
||||||
" ",
|
}
|
||||||
{attribute=>'type', value=>"text/javascript"},
|
if (-e $js_dir.'bluecore.js') {
|
||||||
{attribute=>'src',value=>$js_dir.'bluecore.js'});
|
$header .= html_tag(
|
||||||
$header .= html_tag(
|
'script',
|
||||||
'script',
|
" ",
|
||||||
" ",
|
{attribute=>'type', value=>"text/javascript"},
|
||||||
{attribute=>'type', value=>"text/javascript"},
|
{attribute=>'src',value=>$js_dir.'bluecore.js'});
|
||||||
{attribute=>'src', value=>$js_dir.'base'});
|
}
|
||||||
|
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(
|
$header .= html_tag(
|
||||||
'meta',
|
'meta',
|
||||||
undef,
|
undef,
|
||||||
@ -218,7 +226,6 @@ sub submenu {
|
|||||||
shift(@list);
|
shift(@list);
|
||||||
return render_menu("sub",@list);
|
return render_menu("sub",@list);
|
||||||
}
|
}
|
||||||
|
|
||||||
######################### /menu ###########################
|
######################### /menu ###########################
|
||||||
|
|
||||||
sub page_template {
|
sub page_template {
|
||||||
@ -226,7 +233,7 @@ sub page_template {
|
|||||||
my $page_content = html_tag(
|
my $page_content = html_tag(
|
||||||
'div',
|
'div',
|
||||||
$content
|
$content
|
||||||
# For the main sides command prompt
|
# For the main sites command prompt
|
||||||
# .html_tag('span'," ", {attribute=>'id', value=>"prompt"})
|
# .html_tag('span'," ", {attribute=>'id', value=>"prompt"})
|
||||||
# .html_tag('span',"█", {attribute=>'class', value=>"cursor"})
|
# .html_tag('span',"█", {attribute=>'class', value=>"cursor"})
|
||||||
,{attribute=>'id', value=>'screen'});
|
,{attribute=>'id', value=>'screen'});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user