Load the doctype / HTML version / head from a separate file. re #79

This commit is contained in:
Sébastien Lucas 2014-02-09 15:24:54 +01:00
parent 42c14764f3
commit 04e22728fa
3 changed files with 113 additions and 45 deletions

View file

@ -43,52 +43,20 @@
}
header ("Content-Type:text/html;charset=utf-8");
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="apple-touch-icon" href="./icons/icon57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="./icons/icon72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="./icons/icon114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="./icons/icon144.png" />
<meta name="msapplication-TileColor" content="#123456"/>
<meta name="msapplication-TileImage" content="./icons/icon144.png"/>
<title>COPS</title>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jQuery/jquery-1.10.2.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jquery-cookie/jquery.cookies.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/jquery-sortelements/jquery.sortElements.js") ?>"></script>
<?php if (!useServerSideRendering ()) { ?>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/Magnific-Popup/jquery.magnific-popup.min.js") ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/Magnific-Popup/magnific-popup.css") ?>" media="screen" />
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/doT/doT.min.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/lru/lru.js") ?>"></script>
<script type="text/javascript" src="<?php echo getUrlWithVersion("resources/typeahead/typeahead.js") ?>"></script>
<?php } ?>
<script type="text/javascript" src="<?php echo getUrlWithVersion("util.js") ?>"></script>
<link rel="related" href="<?php echo $config['cops_full_url'] ?>feed.php" type="application/atom+xml;profile=opds-catalog" title="<?php echo $config['cops_title_default']; ?>" />
<link rel="icon" type="image/vnd.microsoft.icon" href="<?php echo $config['cops_icon']; ?>" />
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic&subset=latin,cyrillic' />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/normalize/normalize.css") ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("styles/font-awesome.css") ?>" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
<?php if (!useServerSideRendering ()) { ?>
<script type="text/javascript">
$(document).ready(function() {
initiateAjax ("<?php echo "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1); ?>",
"<?php echo getCurrentTemplate (); ?>");
});
</script>
<?php } ?>
</head>
<body>
$data = array("title" => $config['cops_title_default'],
"version" => VERSION,
"opds_url" => $config['cops_full_url'] . "feed.php",
"template" => getCurrentTemplate (),
"server_side_rendering" => useServerSideRendering (),
"current_css" => getCurrentCss (),
"favico" => $config['cops_icon'],
"getjson_url" => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
$headcontent = file_get_contents('templates/' . getCurrentTemplate () . '/file.html');
$template = new doT ();
$dot = $template->template ($headcontent, NULL);
echo ($dot ($data));
?><body>
<?php
if (useServerSideRendering ()) {
// Get the data

View file

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="apple-touch-icon" href="./icons/icon57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="./icons/icon72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="./icons/icon114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="./icons/icon144.png" />
<meta name="msapplication-TileColor" content="#123456"/>
<meta name="msapplication-TileImage" content="./icons/icon144.png"/>
<title>{{=it.title}}</title>
<script type="text/javascript" src="resources/jQuery/jquery-1.10.2.min.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/jquery-cookie/jquery.cookies.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/jquery-sortelements/jquery.sortElements.js?v={{=it.version}}"></script>
{{? it.server_side_rendering == 0}}
<script type="text/javascript" src="resources/Magnific-Popup/jquery.magnific-popup.min.js?v={{=it.version}}"></script>
<link rel="stylesheet" type="text/css" href="resources/Magnific-Popup/magnific-popup.css?v={{=it.version}}" media="screen" />
<script type="text/javascript" src="resources/doT/doT.min.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/lru/lru.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/typeahead/typeahead.js?v={{=it.version}}"></script>
{{?}}
<script type="text/javascript" src="util.js"></script>
<link rel="related" href="{{=it.opds_url}}" type="application/atom+xml;profile=opds-catalog" title="{{=it.title}}" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{{=it.favico}}" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<style media="screen" type="text/css">
.demo{
margin-bottom: -99999px;
padding-bottom: 99999px;
border:1px solid #efefef;
}
.panel-body { padding: 5px; }
.bottomright {position:absolute; bottom:0; margin-bottom:25px; right: 20px;}
</style>
{{? it.server_side_rendering == 0}}
<script type="text/javascript">
$(document).ready(function() {
initiateAjax ("{{=it.getjson_url}}", "{{=it.template}}");
});
</script>
{{?}}
</head>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="apple-touch-icon" href="./icons/icon57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="./icons/icon72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="./icons/icon114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="./icons/icon144.png" />
<meta name="msapplication-TileColor" content="#123456"/>
<meta name="msapplication-TileImage" content="./icons/icon144.png"/>
<title>{{=it.title}}</title>
<script type="text/javascript" src="resources/jQuery/jquery-1.10.2.min.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/jquery-cookie/jquery.cookies.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/jquery-sortelements/jquery.sortElements.js?v={{=it.version}}"></script>
{{? it.server_side_rendering == 0}}
<script type="text/javascript" src="resources/Magnific-Popup/jquery.magnific-popup.min.js?v={{=it.version}}"></script>
<link rel="stylesheet" type="text/css" href="resources/Magnific-Popup/magnific-popup.css?v={{=it.version}}" media="screen" />
<script type="text/javascript" src="resources/doT/doT.min.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/lru/lru.js?v={{=it.version}}"></script>
<script type="text/javascript" src="resources/typeahead/typeahead.js?v={{=it.version}}"></script>
{{?}}
<script type="text/javascript" src="util.js"></script>
<link rel="related" href="{{=it.opds_url}}" type="application/atom+xml;profile=opds-catalog" title="{{=it.title}}" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{{=it.favico}}" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300italic,800,300,400italic,600,600italic,700,700italic,800italic&subset=latin,cyrillic" />
<link rel="stylesheet" type="text/css" href="resources/normalize/normalize.css?v={{=it.version}}" />
<link rel="stylesheet" type="text/css" href="styles/font-awesome.css?v={{=it.version}}" media="screen" />
<link rel="stylesheet" type="text/css" href="{{=it.current_css}}?v={{=it.version}}" media="screen" />
{{? it.server_side_rendering == 0}}
<script type="text/javascript">
$(document).ready(function() {
initiateAjax ("{{=it.getjson_url}}", "{{=it.template}}");
});
</script>
{{?}}
</head>