2 Commits

Author SHA1 Message Date
dd3405137f Update tags index to handle issue # 9
Now checks for the file and either copies a backup or creates a blank
file.
2022-07-26 13:06:52 -04:00
25f1887590 Merge pull request 'issue #7' (#19) from issue#7 into master
Reviewed-on: #19
2022-07-26 11:28:32 -04:00

18
blog/by_tag/index.php Normal file → Executable file
View File

@@ -32,8 +32,7 @@
//}
//echo "</ul>\n";
//}
# Tags rewrite
function read_tags($tags_file){
$tags_csv = array_map('str_getcsv', file('tags.csv'));
$tags_rows = sizeof($tags_csv);
$tags_coloums = sizeof($tags_csv[0]);
@@ -64,5 +63,20 @@
$coloum_number++;
}
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');
?>