Tags
This commit is contained in:
parent
ac16378dd8
commit
0ae529b163
5 changed files with 52 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
%TITLE: Version 2.0
|
%TITLE: Version 2.0
|
||||||
%DATE: 27 March 2015
|
%DATE: 27 March 2015
|
||||||
|
%TAGS: 0.2-Series
|
||||||
|
|
||||||
This version introduces some very imporant features:
|
This version introduces some very imporant features:
|
||||||
- **Own page for every article**
|
- **Own page for every article**
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
%TITLE: About the Future of pBlog
|
%TITLE: About the Future of pBlog
|
||||||
%DATE: 29 March 2015
|
%DATE: 29 March 2015
|
||||||
%AUTHOR: Marcel Michael Kapfer
|
%AUTHOR: Marcel Michael Kapfer
|
||||||
|
%TAGS: Important, 0.2-Series
|
||||||
|
|
||||||
I figured out that there will be many changes in the engine which will require many changes in the files (especially the posts file) and in the filestructure. I can't say right now which things will change and what you have to change. Out of this reason. I change the Version numbers and add an zero in front of them. So instead of 2.1 the latest version is now 0.2.1. The 0.2.x series is now on GitHub as an own branch and will recive bugfix updates. The series 0.3, 0.4, 0.5 and so own will be development releases which won't be compatible to the 0.2 series. I recommend current users to stay on 0.2.x - at least until the 1.0 release. I'm verry sorry for this and in case that there are requests I may write a small script that will help you switch to version 1.0.
|
I figured out that there will be many changes in the engine which will require many changes in the files (especially the posts file) and in the filestructure. I can't say right now which things will change and what you have to change. Out of this reason. I change the Version numbers and add an zero in front of them. So instead of 2.1 the latest version is now 0.2.1. The 0.2.x series is now on GitHub as an own branch and will recive bugfix updates. The series 0.3, 0.4, 0.5 and so own will be development releases which won't be compatible to the 0.2 series. I recommend current users to stay on 0.2.x - at least until the 1.0 release. I'm verry sorry for this and in case that there are requests I may write a small script that will help you switch to version 1.0.
|
|
@ -1,5 +1,6 @@
|
||||||
%TITLE: What else are we working on?
|
%TITLE: What else are we working on?
|
||||||
%DATE: 11 June 2015
|
%DATE: 11 June 2015
|
||||||
|
%TAGS: Future
|
||||||
|
|
||||||
Near the Rangitaki PHP blogging engine there are other projects were working on or where we will start development soon:
|
Near the Rangitaki PHP blogging engine there are other projects were working on or where we will start development soon:
|
||||||
|
|
||||||
|
|
14
index.php
14
index.php
|
@ -83,7 +83,7 @@ THE SOFTWARE.
|
||||||
<?php
|
<?php
|
||||||
require_once 'res/php/Parsedown.php';
|
require_once 'res/php/Parsedown.php';
|
||||||
require_once 'res/php/ArticleGenerator.php';
|
require_once 'res/php/ArticleGenerator.php';
|
||||||
if(file_exists("blogs/$blog.md") && $_GET['article'] == "" && $blogintro == "yes"){
|
if(file_exists("blogs/$blog.md") && $_GET['article'] == "" && $blogintro == "yes" && $_GET['tag'] == ""){
|
||||||
$file = file_get_contents("blogs/$blog.md");
|
$file = file_get_contents("blogs/$blog.md");
|
||||||
$file = $file . "\n";
|
$file = $file . "\n";
|
||||||
$file = substr($file, strpos($file, "\n"));
|
$file = substr($file, strpos($file, "\n"));
|
||||||
|
@ -97,7 +97,17 @@ THE SOFTWARE.
|
||||||
</section>
|
</section>
|
||||||
<?php
|
<?php
|
||||||
$articlesdir = "./articles/$blog/";
|
$articlesdir = "./articles/$blog/";
|
||||||
if($_GET['article'] == ""){
|
if($_GET['tag'] != ""){
|
||||||
|
$articles = scandir($articlesdir, 1);
|
||||||
|
foreach ($articles as $article) {
|
||||||
|
$tags = ArticleGenerator::getTags($articlesdir, $article);
|
||||||
|
if(in_array($_GET['tag'], $tags)){
|
||||||
|
if(strlen($article) >= 3 && substr($article, -3) == ".md"){
|
||||||
|
ArticleGenerator::newArticle($articlesdir, $article, $_GET['blog']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if($_GET['article'] == ""){
|
||||||
$articles = scandir($articlesdir, 1);
|
$articles = scandir($articlesdir, 1);
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
if(strlen($article) >= 3 && substr($article, -3) == ".md"){
|
if(strlen($article) >= 3 && substr($article, -3) == ".md"){
|
||||||
|
|
|
@ -60,16 +60,52 @@ class ArticleGenerator {
|
||||||
$article = substr($article, strpos($article, "\n") + 1);
|
$article = substr($article, strpos($article, "\n") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(substr($article, 0, 5) == "%TAGS"){
|
||||||
|
$tags = substr($article, 7, strpos($article, "\n") - 7);
|
||||||
|
$tags = explode(", ", $tags);
|
||||||
|
$article = substr($article, strpos($article, "\n") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
//TODO Code detection
|
//TODO Code detection
|
||||||
|
|
||||||
echo Parsedown::instance()
|
echo Parsedown::instance()
|
||||||
->setBreaksEnabled(true)
|
->setBreaksEnabled(true)
|
||||||
->text($article);
|
->text($article);
|
||||||
|
|
||||||
echo "<small>$author</small>";
|
echo "<small>$author<br>";
|
||||||
|
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
if($_GET['blog'] == ""){
|
||||||
|
echo "<a href='./?tag=$tag'>$tag</a> ";
|
||||||
|
} else {
|
||||||
|
echo "<a href='./?blog=$blog&tag=$tag'>$tag</a> ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</small>";
|
||||||
|
|
||||||
echo "</section>" . "\n";
|
echo "</section>" . "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTags($directory, $articlefile){
|
||||||
|
$article = file_get_contents($directory . $articlefile);
|
||||||
|
if(substr($article, 0, 6) == "%TITLE"){
|
||||||
|
$article = substr($article, strpos($article, "\n") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($article, 0, 5) == "%DATE"){
|
||||||
|
$article = substr($article, strpos($article, "\n") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(substr($article, 0, 7) == "%AUTHOR"){
|
||||||
|
$article = substr($article, strpos($article, "\n") + 1);
|
||||||
|
}
|
||||||
|
if(substr($article, 0, 5) == "%TAGS"){
|
||||||
|
$tags = substr($article, 7, strpos($article, "\n") - 7);
|
||||||
|
$tags = explode(", ", $tags);
|
||||||
|
}
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue