Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 015c5ef6db | |||
| 4958a76f9a | |||
| b01c237d5d | |||
| dd3405137f | |||
| 25f1887590 |
46
blog/by_tag/index.php
Normal file → Executable file
46
blog/by_tag/index.php
Normal file → Executable file
@@ -4,36 +4,7 @@
|
|||||||
|
|
||||||
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")){
|
|
||||||
//echo "<ul id=\"tag_menu\">\n";
|
|
||||||
//$csv = array_map('str_getcsv', file("tags.csv"));
|
|
||||||
//array_walk($csv, function(&$a) use ($csv) {
|
|
||||||
//$a = array_combine($csv[0], $a);
|
|
||||||
//});
|
|
||||||
//array_shift($csv); # remove column header
|
|
||||||
//foreach ($csv as $row){
|
|
||||||
//$counter = 0;
|
|
||||||
//foreach ($row as $item){
|
|
||||||
//$counter++;
|
|
||||||
//if ($counter == 1){
|
|
||||||
//echo "\t<li id=\"" . $item . "\">" . $item . " <a id=\"" . $item . "\"></a>\n";
|
|
||||||
//} elseif ($counter % 2 == 0) {
|
|
||||||
//if ($item == ""){
|
|
||||||
//break;
|
|
||||||
//} else {
|
|
||||||
//echo "\t\t<ol><a href=\"" . $item . "\">";
|
|
||||||
//}
|
|
||||||
//} elseif ($counter % 2 != 0) {
|
|
||||||
//echo $item . "</a></ol>\n";
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
//echo "\t</li>\n";
|
|
||||||
//}
|
|
||||||
//echo "</ul>\n";
|
|
||||||
//}
|
|
||||||
|
|
||||||
# Tags rewrite
|
|
||||||
$tags_csv = array_map('str_getcsv', file('tags.csv'));
|
$tags_csv = array_map('str_getcsv', file('tags.csv'));
|
||||||
$tags_rows = sizeof($tags_csv);
|
$tags_rows = sizeof($tags_csv);
|
||||||
$tags_coloums = sizeof($tags_csv[0]);
|
$tags_coloums = sizeof($tags_csv[0]);
|
||||||
@@ -64,5 +35,20 @@
|
|||||||
$coloum_number++;
|
$coloum_number++;
|
||||||
}
|
}
|
||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# 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);
|
||||||
|
}
|
||||||
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
|
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ if (file_exists($dir) && is_dir($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;
|
||||||
@@ -42,6 +43,7 @@ if (file_exists($dir) && is_dir($dir) ) {
|
|||||||
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";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user