Browse code

Added a default homepage and the ability to view single posts.

haywalk authored on 27/09/2020 13:05:40
Showing 5 changed files

1 1
new file mode 100755
... ...
@@ -0,0 +1,45 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+	<head>
4
+		<title>Blog</title>
5
+	
6
+		<link rel="stylesheet" type="text/css" href="/sheet1.css">
7
+		<link rel="bookmark icon" type="image/png" href="/images/h2.png">
8
+	
9
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
10
+		<meta charset="utf-8">
11
+	</head>
12
+
13
+	<body>
14
+		<h1>My Blog</h1>
15
+	
16
+		<a id='top'></a>
17
+	
18
+		<?php
19
+			readfile('../nav.html');
20
+		?>
21
+
22
+		<p>This is my blog, where I'll post website-related and personal updates. Want to be notified of new posts? Subscribe to my <a href="/blog.xml">RSS feed</a>.</p>
23
+
24
+		<?php
25
+			$posts = scandir("./posts", 1);
26
+
27
+			for($i = 0; $i < count($posts) - 2; ++$i) {
28
+				$file = "./posts/".$posts[$i];
29
+				if (file_exists($file)) {
30
+					echo "<hr>";
31
+					readfile($file);
32
+				}
33
+
34
+			}
35
+		?>
36
+
37
+		<hr>
38
+
39
+		<div class="menu">
40
+			<a href="#top">Top of page</a>
41
+		</div>
42
+		
43
+		<a id="bottom"></a>
44
+	</body>
45
+</html>
0 46
new file mode 100755
... ...
@@ -0,0 +1,8 @@
1
+<a id="26september2020"></a>
2
+
3
+<h3>26 September 2020 - Another example post!</h3>
4
+
5
+<a href="view.php?post=001-26september2020">View/link this post</a>
6
+
7
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
8
+
0 9
new file mode 100755
... ...
@@ -0,0 +1,13 @@
1
+<a id="27september2020"></a>
2
+
3
+<h3>27 September 2020 - SimpleBlogScript</h3>
4
+
5
+<a href="view.php?post=002-27september2020">View/link this post</a>
6
+
7
+<p>This is <a href="https://www.haywalk.ca">haywalk</a>'s blog script. The code can be found <a href="https://github.com/haywalk/simpleblogscript">here</a>.</p>
8
+
9
+<p><b>Steps to posting:</b> To post to this blog, add a plaintext file (with no *.txt ending), and name it <code>###-DDmonthYYYY</code>, where <code>###</code> is the post number (your first post should be 1, etc.), <code>DD</code> is the day (numerical), <code>month</code> is the month (written/lowercase), and <code>YYYY</code> is the year (numerical).</p>
10
+
11
+<p>Inside the document, add a line with <code>&lt;a id="DDmonthYYYY"&gt;</code>, a title header somewhere (but you don't necessarily have to add one), and a 'view' link that links to <code>view.php?post={FILENAME}</code>, where <code>{FILENAME}</code> is the filename of your post. Then write your post! That should be it!</p>
12
+
13
+<p>Note: You can just copy these example posts and change the tags :^)</p>
0 14
new file mode 100755
... ...
@@ -0,0 +1,35 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+	<head>
4
+		<title>Blog</title>
5
+	
6
+		<link rel="stylesheet" type="text/css" href="/sheet1.css">
7
+		<link rel="bookmark icon" type="image/png" href="/images/h2.png">
8
+	
9
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
10
+		<meta charset="utf-8">
11
+	</head>
12
+
13
+	<body>
14
+		<h1>My Blog</h1>
15
+	
16
+		<a id='top'></a>
17
+	
18
+		<?php
19
+		    readfile('../nav.html');
20
+		?>
21
+
22
+                <a href="./#<?php echo substr($_GET['post'], 4);?>">Back to blog</a>
23
+		<?php
24
+		    readfile('posts/'.$_GET['post']);
25
+                ?>
26
+
27
+		<hr>
28
+
29
+		<div class="menu">
30
+			<a href="#top">Top of page</a>
31
+		</div>
32
+		
33
+		<a id="bottom"></a>
34
+	</body>
35
+</html>
0 36
deleted file mode 100644
... ...
@@ -1,39 +0,0 @@
1
-<?php
2
-/*
3
-Copyright (c) 2020, Hayden Walker <planethaywalk@aol.com>
4
-
5
-Redistribution and use in source and binary forms, with or without
6
-modification, are permitted provided that the following conditions are met:
7
-
8
-1. Redistributions of source code must retain the above copyright notice, this
9
-   list of conditions and the following disclaimer.
10
-2. Redistributions in binary form must reproduce the above copyright notice,
11
-   this list of conditions and the following disclaimer in the documentation
12
-   and/or other materials provided with the distribution.
13
-
14
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
-*/
25
-
26
-// To make this script work, all you need to do is add this code to your php file, and save your posts in the form of text files (with any HTML tags you want to use) in ./posts.
27
-
28
-	$posts = scandir("./posts", 1);
29
-
30
-	for($i = 0; $i < count($posts) - 2; ++$i) {
31
-
32
-		$file = "./posts/".$posts[$i];
33
-
34
-		if (file_exists($file)) {
35
-			echo "<hr>";
36
-			readfile($file);
37
-		}
38
-	}
39
-?>