Various Improvements:
- Metatags based on subblog and/or article - Drawer close button - RCC: media upload - RCC subpages: back button
This commit is contained in:
parent
c910225e7d
commit
c242062cd9
12 changed files with 216 additions and 26 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
nbproject/
|
nbproject/
|
||||||
|
.idea/
|
||||||
|
|
|
@ -5,3 +5,5 @@
|
||||||
This is the official Rangitaki logo.
|
This is the official Rangitaki logo.
|
||||||
|
|
||||||
![The Rangitaki logo](media/example.png)
|
![The Rangitaki logo](media/example.png)
|
||||||
|
|
||||||
|
It is saved in the example blog directory.
|
||||||
|
|
67
index.php
67
index.php
|
@ -33,18 +33,48 @@ $getblog = filter_input(INPUT_GET, "blog"); // getting the blog variable
|
||||||
$getarticle = filter_input(INPUT_GET, "article"); // getting the article variable
|
$getarticle = filter_input(INPUT_GET, "article"); // getting the article variable
|
||||||
$gettag = filter_input(INPUT_GET, "tag"); // getting the tag variable
|
$gettag = filter_input(INPUT_GET, "tag"); // getting the tag variable
|
||||||
$url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") . filter_input(INPUT_SERVER, "REQUEST_URI"); // getting the url (used for sharing)
|
$url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") . filter_input(INPUT_SERVER, "REQUEST_URI"); // getting the url (used for sharing)
|
||||||
|
|
||||||
|
// Fetching necessary information about the current article
|
||||||
|
// Set blog to "main" if on main blog, else to $getblog. This variable is needed later
|
||||||
|
if ($getblog == "") {
|
||||||
|
$blog = "main";
|
||||||
|
} else {
|
||||||
|
$blog = $getblog;
|
||||||
|
}
|
||||||
|
$articlesdir = "./articles/$blog/"; // generate a variable with the articles directory
|
||||||
|
// Fetching the articles title
|
||||||
|
if (isset($getarticle)) {
|
||||||
|
$articletitle = ArticleGenerator::getTitle($articlesdir, $getarticle . '.md');
|
||||||
|
}
|
||||||
|
// Make sure that the entry has a title, because main.md hasn't one
|
||||||
|
if (empty($blogmainname)) {
|
||||||
|
$blogmaintitle = $blogtitle;
|
||||||
|
} else {
|
||||||
|
$blogmaintitle = $blogmainname;
|
||||||
|
}
|
||||||
|
if (isset($getblog)) {
|
||||||
|
$subblogtitle = BlogListGenerator::getName('./blogs/' . $getblog . '.md');
|
||||||
|
} else {
|
||||||
|
$subblogtitle = $blogmaintitle;
|
||||||
|
}
|
||||||
|
// Generate title for the html head
|
||||||
|
if (isset($getarticle)) {
|
||||||
|
$hd_subblog_title = $articletitle . ' - ' . $subblogtitle;
|
||||||
|
} else {
|
||||||
|
$hd_subblog_title = $subblogtitle;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><?php echo $blogtitle; // Setting the blog article?></title>
|
<title><?php echo $hd_subblog_title; ?></title>
|
||||||
<!--Metatags-->
|
<!--Metatags-->
|
||||||
<meta name="author" content="<?php echo $blogauthor; // Setting the blog author ?>"/>
|
<meta name="author" content="<?php echo $blogauthor; // Setting the blog author ?>"/>
|
||||||
<meta name="description" content="<?php echo $blogdescription; // the blog description ?>"/>
|
<meta name="description" content="<?php echo $blogdescription; // the blog description ?>"/>
|
||||||
<!-- Meta tag for responsive ui-->
|
<!-- Meta tag for responsive ui-->
|
||||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
|
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'/>
|
||||||
<!-- OpenGraph meta tags -->
|
<!-- OpenGraph meta tags -->
|
||||||
<meta property="og:title" content="<?php echo $blogtitle; ?>"/>
|
<meta property="og:title" content="<?php echo $hd_subblog_title; ?>"/>
|
||||||
<meta property="og:type" content="website"/>
|
<meta property="og:type" content="website"/>
|
||||||
<meta property="og:url" content="<?php echo $url; ?>"/>
|
<meta property="og:url" content="<?php echo $url; ?>"/>
|
||||||
<meta property="og:image" content="<?php echo $favicon; ?>"/>
|
<meta property="og:image" content="<?php echo $favicon; ?>"/>
|
||||||
|
@ -53,7 +83,7 @@ $url = "http://" . filter_input(INPUT_SERVER, "HTTP_HOST") . filter_input(INPUT_
|
||||||
<!-- Twitter meta tags -->
|
<!-- Twitter meta tags -->
|
||||||
<meta name="twitter:card" content="summary"/>
|
<meta name="twitter:card" content="summary"/>
|
||||||
<meta name="twitter:site" content="<?php echo $twitter; ?>"/>
|
<meta name="twitter:site" content="<?php echo $twitter; ?>"/>
|
||||||
<meta name="twitter:title" content="<?php echo $blogtitle; ?>"/>
|
<meta name="twitter:title" content="<?php echo $hd_subblog_title; ?>"/>
|
||||||
<meta name="twitter:description" content="<?php echo $blogdescription; ?>"/>
|
<meta name="twitter:description" content="<?php echo $blogdescription; ?>"/>
|
||||||
<meta name="twitter:image" content="<?php echo $favicon; ?>"/>
|
<meta name="twitter:image" content="<?php echo $favicon; ?>"/>
|
||||||
<meta name="twitter:url" content="<?php echo $url; ?>"/>
|
<meta name="twitter:url" content="<?php echo $url; ?>"/>
|
||||||
|
@ -86,27 +116,24 @@ if ($nav_drawer == "yes") {
|
||||||
?>
|
?>
|
||||||
<div class="overlay"></div> <!-- Darken the background when fading the drawer in. See also the JS file-->
|
<div class="overlay"></div> <!-- Darken the background when fading the drawer in. See also the JS file-->
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
|
<div class="nav-close">
|
||||||
|
<img src="./res/img/close-dark.svg" class="nav-close-img" alt="Close"/>
|
||||||
|
</div>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<?php
|
<?php
|
||||||
$blogs = scandir("./blogs/"); // Getting everything from the blog directory
|
$blogs = scandir("./blogs/"); // Getting everything from the blog directory
|
||||||
if (!isset($getarticle) && !isset($gettag) && sizeof($blogs) > 3) { // Checking if not in article or tag view and if there are more the one blog. The 3 is for these three array entries: 'main.md', '.', '..'
|
if (!isset($getarticle) && !isset($gettag) && sizeof($blogs) > 3) { // Checking if not in article or tag view and if there are more the one blog. The 3 is for these three array entries: 'main.md', '.', '..'
|
||||||
echo "<section>";
|
echo "<section>";
|
||||||
echo "<div class='nav-item-static'>" . $BLOGLANG['Blogs on'] . " $blogtitle:</div>"; // 1. Set localized string 2. Set blogtitle
|
echo "<div class='nav-item-static'>" . $BLOGLANG['Blogs on'] . " $blogtitle:</div>"; // 1. Set localized string 2. Set blogtitle
|
||||||
foreach ($blogs as $blog) { // iterating through the blogs/ directory
|
foreach ($blogs as $navblog) { // iterating through the blogs/ directory
|
||||||
if (strlen($blog) >= 3 && substr($blog, -3) == ".md") { // check if filename is larger than three chars and if the file ends with ".md"
|
if (strlen($navblog) >= 3 && substr($navblog, -3) == ".md") { // check if filename is larger than three chars and if the file ends with ".md"
|
||||||
if ($getblog == "") { // Run when on main blog
|
if ($getblog == "") { // Run when on main blog
|
||||||
if ($blog != "main.md") { // excluding main blog
|
if ($navblog != "main.md") { // excluding main blog
|
||||||
BlogListGenerator::listBlog("./blogs/", $blog, $blogtitle); // creating navigation item
|
BlogListGenerator::listBlog("./blogs/", $navblog, $blogtitle); // creating navigation item
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($getblog . ".md" != $blog) { // Check if $blog is current blog -> this blog will be excluded
|
if ($getblog . ".md" != $navblog) { // Check if $blog is current blog -> this blog will be excluded
|
||||||
// Make sure that the entry has a title, because main.md hasn't one
|
BlogListGenerator::listBlog("./blogs/", $navblog, $blogmaintitle); // creating navigation item
|
||||||
if (empty($blogmainname)) {
|
|
||||||
$blogmaintitle = $blogtitle;
|
|
||||||
} else {
|
|
||||||
$blogmaintitle = $blogmainname;
|
|
||||||
}
|
|
||||||
BlogListGenerator::listBlog("./blogs/", $blog, $blogmaintitle); // creating navigation item
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,12 +155,6 @@ if ($nav_drawer == "yes") {
|
||||||
<?php
|
<?php
|
||||||
} // Endif from line 97; Yes, I really should think about alternative syntax...
|
} // Endif from line 97; Yes, I really should think about alternative syntax...
|
||||||
|
|
||||||
// Set blog to "main" if on main blog, else to $getblog. This variable is needed later
|
|
||||||
if ($getblog == "") {
|
|
||||||
$blog = "main";
|
|
||||||
} else {
|
|
||||||
$blog = $getblog;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<div class="main"> <!-- Main page with content -->
|
<div class="main"> <!-- Main page with content -->
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
@ -181,7 +202,6 @@ if ($getblog == "") {
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$articlesdir = "./articles/$blog/"; // generate a variable with the articles directory
|
|
||||||
// TAG VIEW
|
// TAG VIEW
|
||||||
if (isset($gettag)) { // if there's a tag -> tag view
|
if (isset($gettag)) { // if there's a tag -> tag view
|
||||||
$articles = scandir($articlesdir, 1); // save the content of the directory in the articles variable
|
$articles = scandir($articlesdir, 1); // save the content of the directory in the articles variable
|
||||||
|
@ -216,8 +236,7 @@ if ($getblog == "") {
|
||||||
?>
|
?>
|
||||||
<div class="fabmenu">
|
<div class="fabmenu">
|
||||||
<div class="subfab"><!--Email subfab-->
|
<div class="subfab"><!--Email subfab-->
|
||||||
<a href='mailto:?subject=
|
<a href='mailto:?subject=<?php echo $blogtitle; ?>&body=<?php echo $BLOGLANG['Check out this blog']; ?>: <?php echo $url; ?>'
|
||||||
<?php echo $blogtitle; ?>&body=<?php echo $BLOGLANG['Check out this blog']; ?>: <?php echo $url; ?>'
|
|
||||||
target="blank">
|
target="blank">
|
||||||
<img src="./res/img/email.svg" class="subfab-img"/>
|
<img src="./res/img/email.svg" class="subfab-img"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -110,6 +110,16 @@ THE SOFTWARE.
|
||||||
<input id="button" type="submit" value="Post" class="button"/>
|
<input id="button" type="submit" value="Post" class="button"/>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">Media Upload</div>
|
||||||
|
<form enctype="multipart/form-data" action="media/" method="POST">
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
|
||||||
|
<input id="" name="userfile" type="file" value="Choose a file" />
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<input id="button" type="submit" value="Upload" class="button"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
|
|
60
rcc/media/index.php
Normal file
60
rcc/media/index.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright 2015 mmk2410.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Rangitaki Control Center</title>
|
||||||
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
|
||||||
|
<link rel="stylesheet" href="../res/rcc.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<a href="../" class="title">Rangitaki Control Center</a>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<section class="card">
|
||||||
|
<div class="headline">File Upload</div>
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if($_SESSION['login']) {
|
||||||
|
if ($_FILES['userfile']['name'] == "") {
|
||||||
|
echo "<p>You have to choose a file!</p>";
|
||||||
|
} else {
|
||||||
|
$uploaddir = "../../media/";
|
||||||
|
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
||||||
|
|
||||||
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
||||||
|
echo "<p>The post was successfully uploaded and is now published.</p>";
|
||||||
|
} else {
|
||||||
|
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?><a href="../" class="button">GO BACK</a><?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -61,6 +61,7 @@ EOD;
|
||||||
} else {
|
} else {
|
||||||
echo "Some error happend, while publishing.";
|
echo "Some error happend, while publishing.";
|
||||||
}
|
}
|
||||||
|
?><a href="../" class="button">GO BACK</a><?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -2,6 +2,9 @@ window.onload = function () {
|
||||||
var t = document.getElementsByTagName('textarea')[0];
|
var t = document.getElementsByTagName('textarea')[0];
|
||||||
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
|
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following three code clocks are for proper resizing of the input textarea
|
||||||
|
*/
|
||||||
var resize = function (t) {
|
var resize = function (t) {
|
||||||
t.style.height = 'auto';
|
t.style.height = 'auto';
|
||||||
t.style.height = (t.scrollHeight + offset ) + 'px';
|
t.style.height = (t.scrollHeight + offset ) + 'px';
|
||||||
|
|
|
@ -52,6 +52,7 @@ THE SOFTWARE.
|
||||||
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
|
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
?><a href="../" class="button">GO BACK</a><?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -97,7 +97,6 @@ body{
|
||||||
height: 100%;
|
height: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: -301px;
|
left: -301px;
|
||||||
padding-top: 64px;
|
|
||||||
z-index: 40;
|
z-index: 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +112,15 @@ body{
|
||||||
transition: background-color 125ms ease-in-out 0ms;
|
transition: background-color 125ms ease-in-out 0ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-close {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-close-img{ /* the hamburger icon */
|
||||||
|
height: 35px;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-item{ /* additional setting for clickable nav items */
|
.nav-item{ /* additional setting for clickable nav items */
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +237,15 @@ body{
|
||||||
|
|
||||||
.nav{ /* always show navigation bar */
|
.nav{ /* always show navigation bar */
|
||||||
left: 0;
|
left: 0;
|
||||||
|
padding-top: 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-close-img {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-close {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-img{ /* always hide navigation bar icon*/
|
.nav-img{ /* always hide navigation bar icon*/
|
||||||
|
|
60
res/img/close-dark.svg
Normal file
60
res/img/close-dark.svg
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
fill="#000000"
|
||||||
|
height="48"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="48"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="close-dark.svg">
|
||||||
|
<metadata
|
||||||
|
id="metadata12">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs10" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="3830"
|
||||||
|
inkscape:window-height="2074"
|
||||||
|
id="namedview8"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="13.906433"
|
||||||
|
inkscape:cx="-29.993443"
|
||||||
|
inkscape:cy="32.765779"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="81"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<path
|
||||||
|
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
||||||
|
id="path4"
|
||||||
|
style="fill:#565656;fill-opacity:1" />
|
||||||
|
<path
|
||||||
|
d="M0 0h24v24H0z"
|
||||||
|
fill="none"
|
||||||
|
id="path6" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -40,7 +40,7 @@ var main = function () { // main function; called below
|
||||||
);
|
);
|
||||||
|
|
||||||
var navOpen = false; // nav hidden at begin
|
var navOpen = false; // nav hidden at begin
|
||||||
$('.nav-img, .overlay').click( // action on hamburger click
|
$('.nav-img, .overlay, .nav-close').click( // action on hamburger click
|
||||||
function () {
|
function () {
|
||||||
if (!(navOpen)) { // if nav is hidden
|
if (!(navOpen)) { // if nav is hidden
|
||||||
openNav(); // open the nav drawer
|
openNav(); // open the nav drawer
|
||||||
|
|
|
@ -133,4 +133,20 @@ class ArticleGenerator
|
||||||
return $tags; // remove that array
|
return $tags; // remove that array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function to get an article title as a string
|
||||||
|
*
|
||||||
|
* @param string $directory The directory where the article files are stored
|
||||||
|
* @param string $articlefile The name of the article file
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getTitle($directory, $articlefile)
|
||||||
|
{
|
||||||
|
$article = file_get_contents($directory . $articlefile); // get the article
|
||||||
|
if (substr($article, 0, 6) == "%TITLE") { // detect and remove the title
|
||||||
|
$title = substr($article, 8, strpos($article, "\n") - 8); // get this title
|
||||||
|
return $title; // remove that array
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue