forked from 20xd6/simple_blog
Compare commits
30 Commits
add_byline
...
issue#5
| Author | SHA1 | Date | |
|---|---|---|---|
| fa921bcf39 | |||
| c312dbf995 | |||
| b91d699261 | |||
| 858d880837 | |||
| a06e7dabeb | |||
| e624e7c287 | |||
| b4ffc0b9f8 | |||
| b40b877a3f | |||
| 7734de9fa4 | |||
| 470773721a | |||
| 5d7b4cc121 | |||
| efe61157e8 | |||
| 5016fa8ce8 | |||
| 206f94f5db | |||
| 8da50f2841 | |||
| 7ff2cf1d0f | |||
| f80bc8dafa | |||
| 32f7d23ee4 | |||
| 015c5ef6db | |||
| 4958a76f9a | |||
| b01c237d5d | |||
| dd3405137f | |||
| 25f1887590 | |||
| 81629aa133 | |||
| 3e169d54ed | |||
| b7688ae2d4 | |||
| dc66b2db0f | |||
| 88b08fd1fc | |||
| d2861f1203 | |||
| 5e29d1e4d5 |
74
README.md
74
README.md
@@ -40,6 +40,11 @@ This folder contains an index file that displays an article list generated by pa
|
|||||||
| "/blog/by_year/2022/06/28_A_Test_Post/"| | |
|
| "/blog/by_year/2022/06/28_A_Test_Post/"| | |
|
||||||
| "A Test Post" | | |
|
| "A Test Post" | | |
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
Post authors can be kept under `/blog/authors/`. Authors are kept in separate directories.
|
||||||
|
|
||||||
|
The authors directory is parsed by [`article.php`](/git/20xd6/simple_blog/src/commit/7734de9fa483257a90a658b74b78b47e4de716e2/common/php/article.php#L25) using a file named `author` from the post's directory. This file should contain a single line with the author's name.
|
||||||
|
|
||||||
## File Descriptions
|
## File Descriptions
|
||||||
|
|
||||||
@@ -49,14 +54,14 @@ Contains the blog articles. The articles are placed in subdirectories of `by_yea
|
|||||||
|
|
||||||
```
|
```
|
||||||
├── by_year
|
├── by_year
|
||||||
│  ├── 2021
|
│ ├── 2021
|
||||||
│  │  ├── 12
|
│ │ ├── 12
|
||||||
│  │  └── index.php -> /path/to/common/index.php
|
│ │ └── index.php -> /path/to/common/index.php
|
||||||
│  ├── 2022
|
│ ├── 2022
|
||||||
│  │  ├── 01
|
│ │ ├── 01
|
||||||
│  │  ├── 02
|
│ │ ├── 02
|
||||||
│  │  └── index.php -> /path/to/common/index.php
|
│ │ └── index.php -> /path/to/common/index.php
|
||||||
│  └── index.php
|
│ └── index.php
|
||||||
└── index.php -> /path/to/common/index.php
|
└── index.php -> /path/to/common/index.php
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -69,49 +74,44 @@ This directory contains the files and libraries used to render the site's pages.
|
|||||||
* composer.lock
|
* composer.lock
|
||||||
* [/common/vendor]() - Stores the composer files and libraries managed via composer.
|
* [/common/vendor]() - Stores the composer files and libraries managed via composer.
|
||||||
|
|
||||||
#### CSS
|
#### [CSS](/git/20xd6/simple_blog/src/branch/master/common/css)
|
||||||
|
|
||||||
* [styles.css](/git/20xd6/simple_blog/src/branch/master/common/styles.css) - The main site CSS.
|
* [styles.css](/git/20xd6/simple_blog/src/branch/master/common/css/styles.css) - The main site CSS.
|
||||||
* [jmenu.css]() - Used to render the responsive menus.
|
* [jmenu.css](/git/20xd6/simple_blog/src/branch/master/common/css/jmenu.css) - Used to render the responsive menus.
|
||||||
* [print.css]() - Used to style printed pages.
|
* [print.css](/git/20xd6/simple_blog/src/branch/master/common/css/print.css) - Used to style printed pages.
|
||||||
* [gallery.css]() - Styles the floating
|
|
||||||
|
|
||||||
#### JS
|
#### [JS](/git/20xd6/simple_blog/src/branch/master/common/js)
|
||||||
|
|
||||||
* font_size.js
|
* [page_format.js](/git/20xd6/simple_blog/src/branch/master/common/js/page_format.js) - The main JS file used for formatting and adding extra functions to pages.
|
||||||
* [page_format.js]() - The main JS file used for formatting and adding extra functions to pages.
|
|
||||||
* gallery.js
|
|
||||||
|
|
||||||
#### PHP
|
#### [PHP](/git/20xd6/simple_blog/src/branch/master/common/php)
|
||||||
|
|
||||||
* [footer.php]() - The common page footer. Contains copyright information and links to the license.
|
* [footer.php](/git/20xd6/simple_blog/src/branch/master/common/php/footer.php) - The common page footer. Contains copyright information and links to the license.
|
||||||
* [get_month_name.php]() - Translates a numeral month into the corresponding name. I.E. 01 into January.
|
* [get_month_name.php](/git/20xd6/simple_blog/src/branch/master/common/php/get_month_name.php) - Translates a numeral month into the corresponding name. I.E. 01 into January.
|
||||||
* [h1_month.php]() - Adds the proper `<h1>` heading based on the location of the
|
* [h1_month.php](/git/20xd6/simple_blog/src/branch/master/common/php/h1_month.php) - Adds the proper `<h1>` heading based on the location of the
|
||||||
* [header.php]() - The common page header.
|
* [header.php](/git/20xd6/simple_blog/src/branch/master/common/php/header.php) - The common page header.
|
||||||
* [index.php]() - The index file used for most of the pages on the site.
|
* [index.php](/git/20xd6/simple_blog/src/branch/master/common/php/index.php) - The index file used for most of the pages on the site.
|
||||||
* [markdown.php]()
|
* [markdown.php]()
|
||||||
* [md_read.php]() - Renders Markdown files and adds
|
* [md_read.php](/git/20xd6/simple_blog/src/branch/master/common/php/md_read.php) - Renders Markdown files and adds
|
||||||
* [menu.php]() - Generates the blog menu items in the navigation menu.
|
* [menu.php](/git/20xd6/simple_blog/src/branch/master/common/php/menu.php) - Generates the blog menu items in the navigation menu.
|
||||||
* [modal.php]() - Adds the modal `<div>` for displaying the image pop out.
|
* [modal.php](/git/20xd6/simple_blog/src/branch/master/common/php/modal.php) - Adds the modal `<div>` for displaying the image pop out.
|
||||||
* [page_menu.php]() - Generates a menu from the files and directories where it's run from.
|
* [page_menu.php](/git/20xd6/simple_blog/src/branch/master/common/php/page_menu.php) - Generates a menu from the files and directories where it's run from.
|
||||||
* [page_menu_table.php]()
|
|
||||||
* [path_menu.php]()
|
|
||||||
|
|
||||||
#### /common/error_pages/
|
#### [/common/error_pages/](/git/20xd6/simple_blog/src/branch/master/common/error_pages)
|
||||||
|
|
||||||
* [/common/403.php]() - The 403 not allowed page.
|
* [403.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/403.php) - The 403 not allowed page.
|
||||||
* [/common/404.php]() - The 404 page.
|
* [404.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/404.php) - The 404 page.
|
||||||
* [/common/500.php]() - Displayed for all HTTP 500 errors
|
* [500.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/500.php) - Displayed for all HTTP 500 errors
|
||||||
|
|
||||||
#### /common/imgs/
|
#### [/common/imgs/](/git/20xd6/simple_blog/src/branch/master/common/imgs)
|
||||||
|
|
||||||
Images used site wide.
|
Images used site wide.
|
||||||
|
|
||||||
* [cursor.gif]() - Blinking cursor used on the front page.
|
* [cursor.gif](/git/20xd6/simple_blog/src/branch/master/common/imgs/cursor.gif) - Blinking cursor used on the front page.
|
||||||
* [icon-rss.png]() - RSS icon
|
* [icon-rss.png](/git/20xd6/simple_blog/src/branch/master/common/imgs/icon-rss.png) - RSS icon
|
||||||
|
|
||||||
|
|
||||||
#### /common/prisim
|
#### [/common/prisim](/git/20xd6/simple_blog/src/branch/master/common/prisim)
|
||||||
|
|
||||||
Files for the prism syntax highlighter.
|
Files for the prism syntax highlighter.
|
||||||
|
|
||||||
|
|||||||
104
blog/by_tag/index.php
Normal file → Executable file
104
blog/by_tag/index.php
Normal file → Executable file
@@ -4,65 +4,57 @@
|
|||||||
|
|
||||||
echo "<article><h1 id=\"page_title\">Posts by Tag</h1></article>";
|
echo "<article><h1 id=\"page_title\">Posts by Tag</h1></article>";
|
||||||
echo "<div id=\"search_inputs\"><input type=\"text\" id=\"tag_sort\" onkeyup=\"tag_search()\" placeholder=\"Search Tags...\" title=\"Type a tage to search\"><input id=\"search_toggle\" type=\"button\" value=\"Search Titles\" onclick=\"search_toggle()\"></div><!--End Div Search Inputs-->";
|
echo "<div id=\"search_inputs\"><input type=\"text\" id=\"tag_sort\" onkeyup=\"tag_search()\" placeholder=\"Search Tags...\" title=\"Type a tage to search\"><input id=\"search_toggle\" type=\"button\" value=\"Search Titles\" onclick=\"search_toggle()\"></div><!--End Div Search Inputs-->";
|
||||||
|
function read_tags($tags_file){
|
||||||
//if(file_exists("tags.csv")){
|
if (filesize($tags_file) == 0){
|
||||||
//echo "<ul id=\"tag_menu\">\n";
|
echo "<br/>\n<br/>";
|
||||||
//$csv = array_map('str_getcsv', file("tags.csv"));
|
return;
|
||||||
//array_walk($csv, function(&$a) use ($csv) {
|
}
|
||||||
//$a = array_combine($csv[0], $a);
|
$tags_csv = array_map('str_getcsv', file('tags.csv'));
|
||||||
//});
|
$tags_rows = sizeof($tags_csv);
|
||||||
//array_shift($csv); # remove column header
|
$tags_coloums = sizeof($tags_csv[0]);
|
||||||
//foreach ($csv as $row){
|
//echo "<pre>\n";
|
||||||
//$counter = 0;
|
//print_r($tags_csv);
|
||||||
//foreach ($row as $item){
|
//echo $tags_coloums . "\n" . $tags_rows . "\n";
|
||||||
//$counter++;
|
//echo "</pre>\n";
|
||||||
//if ($counter == 1){
|
echo "<ul id=\"tag_menu\">\n";
|
||||||
//echo "\t<li id=\"" . $item . "\">" . $item . " <a id=\"" . $item . "\"></a>\n";
|
$coloum_number = 0;
|
||||||
//} elseif ($counter % 2 == 0) {
|
for ($row_number = 0; $row_number <= $tags_coloums; $row_number++){
|
||||||
//if ($item == ""){
|
//echo $row_number;
|
||||||
//break;
|
$section_title = $tags_csv[0][$coloum_number];
|
||||||
//} else {
|
echo "\t<li id=\"" . $section_title . "\"><b>" . $section_title . " </b>\n";
|
||||||
//echo "\t\t<ol><a href=\"" . $item . "\">";
|
for ($row = 1; $row < $tags_coloums; $row++){
|
||||||
//}
|
//echo "rn: " . $row . "\ncn:" . $coloum_number ." ";
|
||||||
//} elseif ($counter % 2 != 0) {
|
$tag_content = $tags_csv[$row][$coloum_number];
|
||||||
//echo $item . "</a></ol>\n";
|
if ($tag_content == ""){
|
||||||
//}
|
break;
|
||||||
//}
|
} else {
|
||||||
//echo "\t</li>\n";
|
if ($row % 2 != 0){
|
||||||
//}
|
echo "\t\t<ol><a href=\"" . $tag_content . "\">";
|
||||||
//echo "</ul>\n";
|
} elseif ($row % 2 == 0){
|
||||||
//}
|
echo $tag_content . "</a></ol>\n";
|
||||||
|
}
|
||||||
# Tags rewrite
|
|
||||||
$tags_csv = array_map('str_getcsv', file('tags.csv'));
|
|
||||||
$tags_rows = sizeof($tags_csv);
|
|
||||||
$tags_coloums = sizeof($tags_csv[0]);
|
|
||||||
//echo "<pre>\n";
|
|
||||||
//print_r($tags_csv);
|
|
||||||
//echo $tags_coloums . "\n" . $tags_rows . "\n";
|
|
||||||
//echo "</pre>\n";
|
|
||||||
echo "<ul id=\"tag_menu\">\n";
|
|
||||||
$coloum_number = 0;
|
|
||||||
for ($row_number = 0; $row_number <= $tags_coloums; $row_number++){
|
|
||||||
//echo $row_number;
|
|
||||||
$section_title = $tags_csv[0][$coloum_number];
|
|
||||||
echo "\t<li id=\"" . $section_title . "\"><b>" . $section_title . " </b>\n";
|
|
||||||
for ($row = 1; $row < $tags_coloums; $row++){
|
|
||||||
//echo "rn: " . $row . "\ncn:" . $coloum_number ." ";
|
|
||||||
$tag_content = $tags_csv[$row][$coloum_number];
|
|
||||||
if ($tag_content == ""){
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
if ($row % 2 != 0){
|
|
||||||
echo "\t\t<ol><a href=\"" . $tag_content . "\">";
|
|
||||||
} elseif ($row % 2 == 0){
|
|
||||||
echo $tag_content . "</a></ol>\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo "\t</li>\n";
|
||||||
|
$coloum_number++;
|
||||||
}
|
}
|
||||||
echo "\t</li>\n";
|
echo "</ul>\n";
|
||||||
$coloum_number++;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Tags rewrite
|
||||||
|
if (file_exists('tags.csv')){
|
||||||
|
read_tags('tags.csv');
|
||||||
|
} elseif( file_exists('tags.csv.bak') ){
|
||||||
|
if (copy('tags.csv.bak', './tags.csv')) {
|
||||||
|
read_tags('tags.csv');
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$empty_csv = fopen("tags.csv", "w") or die("Cannot write new tags.csv file.");
|
||||||
|
fwrite($empty_csv, "");
|
||||||
|
fclose($empty_csv);
|
||||||
|
chmod('./tags.csv', 0666);
|
||||||
|
read_tags('tags.csv');
|
||||||
}
|
}
|
||||||
echo "</ul>\n";
|
|
||||||
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
|
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
/* Style the Image Used to Trigger the Modal */
|
|
||||||
#myImg {
|
|
||||||
border-radius: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
img:hover {opacity: 0.7;}
|
|
||||||
|
|
||||||
/* The Modal (background) */
|
|
||||||
.modal_gal {
|
|
||||||
display: none; /* Hidden by default */
|
|
||||||
position: fixed; /* Stay in place */
|
|
||||||
z-index: 1; /* Sit on top */
|
|
||||||
padding-top: 100px; /* Location of the box */
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 100%; /* Full width */
|
|
||||||
height: 100%; /* Full height */
|
|
||||||
overflow: auto; /* Enable scroll if needed */
|
|
||||||
background-color: rgb(0,0,0); /* Fallback color */
|
|
||||||
background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Modal Content (Image) */
|
|
||||||
.gallery_img {
|
|
||||||
margin: auto;
|
|
||||||
display: block;
|
|
||||||
width: 80%;
|
|
||||||
max-width: 700px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Caption of Modal Image (Image Text) - Same Width as the Image */
|
|
||||||
#modal_img_caption {
|
|
||||||
margin: auto;
|
|
||||||
display: block;
|
|
||||||
width: 80%;
|
|
||||||
max-width: 700px;
|
|
||||||
text-align: center;
|
|
||||||
color: #ccc;
|
|
||||||
padding: 10px 0;
|
|
||||||
height: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add Animation - Zoom in the Modal */
|
|
||||||
.gallery_img, #caption {
|
|
||||||
animation-name: zoom;
|
|
||||||
animation-duration: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes zoom {
|
|
||||||
from {transform:scale(0)}
|
|
||||||
to {transform:scale(1)}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The Close Button */
|
|
||||||
.close_modal {
|
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
right: 35px;
|
|
||||||
color: #00cc00;
|
|
||||||
font-size: 40px;
|
|
||||||
font-weight: bold;
|
|
||||||
transition: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close_modal:hover,
|
|
||||||
.close_modal:focus {
|
|
||||||
color: #bbb;
|
|
||||||
text-decoration: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 100% Image Width on Smaller Screens */
|
|
||||||
@media only screen and (max-width: 700px){
|
|
||||||
.gallery_img {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
var modalEle = document.querySelector(".modal_gal");
|
|
||||||
var modalImage = document.querySelector(".gallery_img");
|
|
||||||
Array.from(document.querySelectorAll(".img_thumb")).forEach(item => {
|
|
||||||
item.addEventListener("click", event => {
|
|
||||||
modalEle.style.display = "block";
|
|
||||||
modalImage.src = event.target.src;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
document.querySelector(".close").addEventListener("click", () => {
|
|
||||||
modalEle.style.display = "none";
|
|
||||||
});
|
|
||||||
|
|
||||||
function image_modal(document){
|
|
||||||
// Get the modal
|
|
||||||
var modal = document.getElementById("modal_gallery");
|
|
||||||
// Get the image and insert it inside the modal - use its "alt" text as a caption
|
|
||||||
var img = document.getElementById("myImg");
|
|
||||||
var modalImg = document.getElementById("modal_img");
|
|
||||||
var captionText = document.getElementById("modal_img_caption");
|
|
||||||
img.onclick = function(){
|
|
||||||
modal.style.display = "block";
|
|
||||||
modalImg.src = this.src;
|
|
||||||
captionText.innerHTML = this.alt;
|
|
||||||
}
|
|
||||||
// Get the <span> element that closes the modal
|
|
||||||
var span = document.getElementsByClassName("close_modal")[0];
|
|
||||||
|
|
||||||
// When the user clicks on <span> (x), close the modal
|
|
||||||
span.onclick = function() {
|
|
||||||
modal.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,22 +22,17 @@
|
|||||||
|
|
||||||
echo "\n</div><!--End of print-content div-->\n";
|
echo "\n</div><!--End of print-content div-->\n";
|
||||||
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
|
echo("<nav class=\"jmenu\"><div class=\"pmenu\"><ul id=\"back_btn\"><li><a href='..'>Back</a></li></ul></div></nav>\n");
|
||||||
if (file_exists('author')){
|
if (file_exists('author') && (filesize('author') != 0)){
|
||||||
$author_name_raw = fopen('author', 'r');
|
$author_name_raw = fopen('author', 'r');
|
||||||
$author_name = fread($author_name_raw, filesize('author'));
|
$author_name = fread($author_name_raw, filesize('author'));
|
||||||
$author_name = str_replace("\n", "", $author_name);
|
$author_name = str_replace("\n", "", $author_name);
|
||||||
$byline_path = $_SERVER['DOCUMENT_ROOT'].'blog/authors/'.$author_name.'/byline.md';
|
$byline_path = $_SERVER['DOCUMENT_ROOT'].'blog/authors/'.$author_name.'/byline.md';
|
||||||
if (file_exists($byline_path)){
|
if (file_exists($byline_path)){
|
||||||
echo "<div class =\"byline\">\n"
|
echo "<div class =\"byline\">\n"
|
||||||
. read_md($byline_path)
|
. read_md($byline_path)
|
||||||
."</div><!--End byline div-->\n";
|
."</div><!--End byline div-->\n";
|
||||||
} else {
|
}
|
||||||
echo "<h2>No byline</h2>";
|
fclose($author_name_raw);
|
||||||
echo "<p>$byline_path</p>";
|
|
||||||
}
|
|
||||||
fclose($author_name_raw);
|
|
||||||
}else {
|
|
||||||
echo "<h2>No author</h2>";
|
|
||||||
}
|
}
|
||||||
if ($tag_data != NULL){
|
if ($tag_data != NULL){
|
||||||
$page_tags = str_getcsv($tag_data);
|
$page_tags = str_getcsv($tag_data);
|
||||||
|
|||||||
@@ -2,20 +2,11 @@
|
|||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<?php
|
<?php
|
||||||
//Sets the page title based on the name of the current directory
|
//Sets the page title based on the name of the current directory
|
||||||
function Title() {//Needs cleanup.
|
function Title() {
|
||||||
//~ $new_title = $_SERVER['REQUEST_URI'];
|
|
||||||
|
|
||||||
//~ $new_title = preg_replace("/^^\//i", "", $new_title);
|
|
||||||
//~ $new_title = preg_replace("/\//i", "", $new_title);
|
|
||||||
//~ $page_title = $_SERVER['REQUEST_URI'];
|
|
||||||
//~ $page_title = preg_replace("/^(.*)\//i", "", $page_title);
|
|
||||||
$page_title = basename($_SERVER['SCRIPT_FILENAME'], '.php');
|
$page_title = basename($_SERVER['SCRIPT_FILENAME'], '.php');
|
||||||
//~ echo($page_title);
|
|
||||||
if(strtolower($page_title) == 'index'){
|
if(strtolower($page_title) == 'index'){
|
||||||
parse_str($_SERVER['REQUEST_URI'], $page_uri);
|
parse_str($_SERVER['REQUEST_URI'], $page_uri);
|
||||||
$page_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
$page_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||||
//~ echo($page_path);
|
|
||||||
//~ $folder_name = sizeof($page_path);
|
|
||||||
$folder_name = explode("/", trim($page_path, "/"));
|
$folder_name = explode("/", trim($page_path, "/"));
|
||||||
$page_title = $folder_name[(sizeof($folder_name) - 1)];
|
$page_title = $folder_name[(sizeof($folder_name) - 1)];
|
||||||
} elseif(strtolower($page_title) == 'homepage'){
|
} elseif(strtolower($page_title) == 'homepage'){
|
||||||
|
|||||||
@@ -18,11 +18,12 @@ function remove_sorting_number($link_title){
|
|||||||
$dir = '.';
|
$dir = '.';
|
||||||
// Check if the directory exists
|
// Check if the directory exists
|
||||||
if (file_exists($dir) && is_dir($dir) ) {
|
if (file_exists($dir) && is_dir($dir) ) {
|
||||||
// Get the files of the directory as an array
|
// Get the files of the directory as an array
|
||||||
$scan_arr = scandir($dir);
|
$scan_arr = scandir($dir);
|
||||||
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
|
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
|
||||||
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
|
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
|
||||||
// Get each files of our directory with line break
|
// Get each files of our directory with line break
|
||||||
|
if (sizeof($files_arr) != 0 ) {
|
||||||
foreach ($files_arr as $file) {
|
foreach ($files_arr as $file) {
|
||||||
//Get the file path
|
//Get the file path
|
||||||
$file_path = "./".$file;
|
$file_path = "./".$file;
|
||||||
@@ -41,6 +42,7 @@ if (file_exists($dir) && is_dir($dir) ) {
|
|||||||
$link_title = remove_sorting_number($link_title);//Removes the number used to keep articles in post order from the displayed title.
|
$link_title = remove_sorting_number($link_title);//Removes the number used to keep articles in post order from the displayed title.
|
||||||
echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n");//Output the result.
|
echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n");//Output the result.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "Directory does not exists";
|
echo "Directory does not exists";
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<table border="1" class="pmenu">
|
|
||||||
<tr>
|
|
||||||
<td><a href=/>Home</a></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
$dir = '.';
|
|
||||||
// Check if the directory exists
|
|
||||||
if (file_exists($dir) && is_dir($dir) ) {
|
|
||||||
// Get the files of the directory as an array
|
|
||||||
$scan_arr = scandir($dir);
|
|
||||||
$files_arr = array_diff($scan_arr, array('.','..','index.php','common','.htaccess') );
|
|
||||||
// echo "<pre>"; print_r( $files_arr ); echo "</pre>";
|
|
||||||
// Get each files of our directory with line break
|
|
||||||
foreach ($files_arr as $file) {
|
|
||||||
//Get the file path
|
|
||||||
$file_path = "./".$file;
|
|
||||||
// Get the file extension
|
|
||||||
$file_ext = pathinfo($file_path, PATHINFO_EXTENSION);
|
|
||||||
if ($file_ext=="php" || $file_ext=="html" || $file_ext=="htm" || $file_ext == "") {
|
|
||||||
$file_array[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach($file_array as $file) {
|
|
||||||
$_replace = array('.php', '.html', '.htm');
|
|
||||||
$link_title = str_replace('_',' ',$file);
|
|
||||||
$link_title = str_replace($_replace,'',$link_title);
|
|
||||||
$link_title = ucwords($link_title);
|
|
||||||
echo("<tr><td><a href='$file'> $link_title </a></td></tr>\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "Directory does not exists";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
Reference in New Issue
Block a user