fix #1; upgrade jquery
[mdref/mdref] / views / layout.phtml
index 69c972763648111576548e9fcd1a43de02c722c3..f3bcbf792e8a0a1da0794319f39d42dd6a5f19fd 100644 (file)
@@ -1,27 +1,53 @@
 <!doctype html>
 <html>
- <head>
-  <meta charset="utf-8">
-  <title><?= $title ?></title>
-  <base href="<?= $baseUrl ?>/">
-  <link rel="stylesheet" href="index.css">
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
- </head>
- <body>
-  <div class="sidebar">
-   <?= $listing ?>
-  </div>
+       <head>
+               <meta charset="utf-8">
+               <title>
+                       <?php if (!empty($title)) : ?>
+                               <?= $title ?> -
+                       <?php elseif (isset($entry)) : ?>
+                               <?= $entry ?> -
+                       <?php endif; ?>
+                       mdref
+               </title>
+               <?php if (isset($baseUrl)) : ?>
+                       <base href="<?= $baseUrl ?>">
+                       <meta http-equiv="Content-Location" content="<?= $baseUrl . $ref ?>">
+                       <link rel="stylesheet" href="index.css">
+               <?php endif; ?>
+               
+               <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
+       </head>
+       <body>
+               <div class="page">
+               <?php include __DIR__."/sidebar.phtml" ?>
+               <?php if (isset($exception)) : ?>
+                       <?= \mdref\ExceptionHandler::htmlException($exception) ?>
+               <?php elseif (isset($entry)) : ?>
+                       <?php include __DIR__."/mdref.phtml" ?>
+               <?php else: ?>
+                       <?php include __DIR__."/index.phtml" ?>
+               <?php endif; ?>
 
-  <?= $content ?>
+               <?php if (@$_SERVER["SERVER_NAME"] != "localhost") : ?>
+               <div id="disqus_thread"></div>
+               <script>
+                       var disqus_shortname = 'mdref';
+                       var disqus_identifier = '<?=$ref?>';
+                       (function() {
+                               var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+                               dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+                               (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+                       })();
+               </script>
+               <?php endif; ?>
 
-  <div id="disqus_thread"></div>
-
-  <footer>
-   <ul>
-       <li><a href="https://github.com/m6w6/mdref">mdref-v<?php readfile("../VERSION")?></a></li>
-       <li><a href="LICENSE">&copy; <?= implode("-", array_unique([2013,idate("Y")]))?></a></li>
-   </ul>
-  </footer>
-  <script src="index.js"></script>
- </body>
+               <footer>
+                       <?php include __DIR__."/footer.phtml" ?>
+               </footer>
+               <?php if (isset($baseUrl)) : ?>
+                       <script src="index.js"></script>
+               <?php endif; ?>
+               </div>
+       </body>
 </html>