From 9e9285075179deb662cee2dfd4138647eb4c3ef4 Mon Sep 17 00:00:00 2001 From: radhitya Date: Tue, 21 Jan 2025 22:46:17 +0700 Subject: [PATCH] aman --- main.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 55d6c08..7ecb908 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,9 @@ FILE *fptr, *fpto, *fcss, *fcss_target; char txt[MAX_LENGTH], of[MAX_LENGTH]; int i, len, judul; char *header, *footer; - +char *headertwo; +char *doinsert(const char * nama); + char *gantihuruf(const char *kata) { static char output[100]; char *dot = strrchr(kata, '.'); @@ -105,6 +107,8 @@ void get_posts(const char *path, Post *posts, int *count) { } void generate_pagination(Post *posts, int total_posts, int posts_per_page) { + header = doinsert("./media/header.html"); + footer = doinsert("./media/footer.html"); int total_pages = (total_posts + posts_per_page - 1) / posts_per_page; FILE *archive = fopen("./target/archive.html", "w"); @@ -115,8 +119,10 @@ void generate_pagination(Post *posts, int total_posts, int posts_per_page) { fprintf(archive, "\n\n\n"); fprintf(archive, "Archive - %s", SUBTITLE); fprintf(archive, "\n\n"); - fprintf(archive, "

Archive

\nkembali"); + if (footer != NULL) { + fprintf(page_file, "%s", footer); + } else { + fprintf(stderr, "ga bisa buat footer wqwqwq"); + } + fprintf(page_file, "" ); fclose(page_file); } - fprintf(archive, ""); + fprintf(archive, ""); + + if (footer != NULL) { + fprintf(archive, "%s", footer); + } else { + fprintf(stderr, "ga bisa buat footer wqwqwq"); + } + + + fprintf(archive,""); fclose(archive); } @@ -238,9 +258,6 @@ void newsetup(void) { fclose(fptr); } } -#include -#include - void checker(void) { DIR *dir; @@ -508,11 +525,13 @@ if (txt[0] == '#') { } footer = doinsert("./media/footer.html"); + if(footer == NULL) { printf("gak ada footer bro :(\n"); } else { fprintf(fpto, "%s", footer); } + fprintf(fpto, "\n"); }