Skip to content

Commit

Permalink
better look + path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
panique committed Dec 2, 2014
1 parent 58a73b1 commit 473e8cb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
13 changes: 12 additions & 1 deletion application/views/_templates/footer.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
<!-- jQuery, loaded in the recommended protocol-less way -->
<!-- more http://www.paulirish.com/2010/the-protocol-relative-url/ -->
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>

<!-- define the project's URL (to make AJAX calls possible, even when using this in sub-folders etc) -->
<script>
var url = "<?php echo URL; ?>";
</script>

<!-- our JavaScript -->
<script src="<?php echo URL; ?>js/application.js"></script>
</body>
</html>
</html>
28 changes: 15 additions & 13 deletions application/views/_templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>PHP MVC skeleton</title>
<meta name="description" content="">
<title>MINI 2</title>
<!-- css -->
<link href="/css/style.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>
<!-- jQuery -->
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<!-- our JavaScript -->
<script src="/js/application.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- JS -->
<!-- please note: The JavaScript files are loaded in the footer to speed up page construction -->
<!-- See more here: http://stackoverflow.com/q/2105327/1114320 -->

<!-- CSS -->
<link href="<?php echo URL; ?>css/style.css" rel="stylesheet">
</head>
<body>
<!-- logo -->
<div class="logo">
MINI
MINI<span class="number">2</span>
</div>

<!-- navigation -->
<div class="navigation">
<a href="/">home</a>
<a href="/home/exampleone">subpage</a>
<a href="/songs">songs</a>
</div>
<a href="<?php echo URL; ?>">home</a>
<a href="<?php echo URL; ?>home/exampleone">subpage</a>
<a href="<?php echo URL; ?>home/exampletwo">subpage 2</a>
<a href="<?php echo URL; ?>songs">songs</a>
</div>
4 changes: 2 additions & 2 deletions application/views/songs/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container">
<h2>You are in the View: application/views/song/index.php (everything in this box comes from that file)</h2>
<!-- add song form -->
<div>
<div class="box">
<h3>Add a song</h3>
<form action="<?php echo URL; ?>songs/addsong" method="POST">
<label>Artist</label>
Expand All @@ -14,7 +14,7 @@
</form>
</div>
<!-- main content output -->
<div>
<div class="box">
<h3>Amount of songs (data from second model)</h3>
<div>
<?php echo $amount_of_songs; ?>
Expand Down
2 changes: 1 addition & 1 deletion public/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $(function() {

// send an ajax-request to this URL: current-server.com/songs/ajaxGetStats
// "url" is defined in views/_templates/footer.php
$.ajax("/songs/ajaxGetStats")
$.ajax(url + "/songs/ajaxGetStats")
.done(function(result) {
// this will be executed if the ajax-call was successful
// here we get the feedback from the ajax-call (result) and show it in #javascript-ajax-result-box
Expand Down

0 comments on commit 473e8cb

Please sign in to comment.