BLiu1's Blog

How It Works: Blog v1.1

December 3, 2013
Edited

I'm busy, but here is the source to my blog.


<?php
	if (isset($_GET["page"]) && is_numeric($_GET["page"])){
		$page = $_GET["page"];
	} else {
		$page = "0";
	}
	switch($page){
		case "0": $title = "Index"; break;
		case "1": $title = "First Post"; break;
		case "2": $title = "How It Works: Blog v1.1"; break;
		case "3": $title = "Escape From Isolation 2.1"; break;
		case "4": $title = "Server Side & Client Side Includes"; break;
		case "5": $title = "All Pages PHP"; break;
		default:  $title = "Index";
	}
?>

<!DOCTYPE html>
<html>
<head>
	<title>BLiu1's Blog - <?php echo($title); ?></title>
	<meta name="description" content="My Weblog" />
	<meta name="keywords" content="BLiu1, blog" />
	<meta name="viewport" content="user-scalable = yes, initial-scale = 1" />
	<meta charset="utf-8" />
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
	<link rel="stylesheet" type="text/css" href="/blog/blog.css" />
</head>
<body>
	<header class="container">
		<h1>BLiu1's Blog</h1>
	</header>
	<div id="to_top"><a href="#">^</a></div>

<?php
	if ($title == "Index"){
?>
	<article>
		<h2>Home</h2>
		<p>Blog Posts:</p>
		<ul id="post_list">
			<li><a href="/blog/index.php?page=5">All Pages PHP</a></li>
			<li><a href="/blog/index.php?page=4">Server Side & Client Side Includes</a></li>
			<li><a href="/blog/index.php?page=3">Escape From Isolation 2.1</a></li>
			<li><a href="/blog/index.php?page=2">How It Works: Blog v1.1</a></li>
			<li><a href="/blog/index.php?page=1">First Post</a></li>
		</ul>
		<p>This is a very plain and infrequently updated blog.</p>
	</article>
	<div id="backlink" class="container"><a href="/">Back</a></div>

<?php } else {
include($page.".php");
echo '	<div id="backlink" class="container"><a href="/blog/index.php">Back</a></div> ';
}
?>

<!-- Tracker -->
<div id="eXdiv">
<div id="eXTReMe"><a href="http://extremetracking.com/open?login=bliu1">
<img src="http://t1.extreme-dm.com/i.gif" style="border: 0;"
height="38" width="41" id="EXim" alt="eXTReMe Tracker" /></a>
<script type="text/javascript"><!--
EXref="";top.document.referrer?EXref=top.document.referrer:EXref=document.referrer;//-->
</script><script type="text/javascript"><!--
var EXlogin='bliu1' // Login
var EXvsrv='s9' // VServer
EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?
EXb=EXs.colorDepth:EXb=EXs.pixelDepth;EXsrc="src";
navigator.javaEnabled()==1?EXjv="y":EXjv="n";
EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";
EXref?EXref=EXref:EXref=EXd.referrer;
EXd.write("<img "+EXsrc+"=http://e0.extreme-dm.com",
"/"+EXvsrv+".g?login="+EXlogin+"&",
"jv="+EXjv+"&j=y&srw="+EXw+"&srb="+EXb+"&",
"l="+escape(EXref)+" height=1 width=1>");//-->
</script><noscript><div id="neXTReMe"><img height="1" width="1" alt=""
src="http://e0.extreme-dm.com/s9.g?login=bliu1&j=n&jv=n" />
</div></noscript></div>
</div>

	<script src="/blog/prism.js"></script>
	<script src="/blog/masonry.pkgd.min.js"></script>
	<script>/*<!--*/
	/*To_top script*/var t=document.getElementById('to_top');setInterval(function(){var s=(window.pageYOffset!==undefined)?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;if(s<300){t.className='up'}else{t.className=''};},100)
	/*Masonry Initialization*/
	var container = document.getElementById('post_list');
	var msnry = new Masonry( container, {
		columnWidth: 1,
		gutter: 10,
		itemSelector: 'li'
	});
	/*-->*/
	</script>

</body>
</html>
	

It's very simple.

Using the $_GET superglobal, it assigns the title of the page and includes the numbered file with the article. If the page "number" is not a number or a nonexistent page, it displays the index/homepage.

Tags:

Comments

BLiu1's Blog - How It Works: Blog v1.1

comments powered by Disqus
eXTReMe Tracker