diff --git a/content/blog-listing.php b/content/blog-listing.php new file mode 100644 index 0000000..434fd9f --- /dev/null +++ b/content/blog-listing.php @@ -0,0 +1,113 @@ + +

+  '.$title.'

'); + + echo('
+'.$previewImageAlt.'
+
'); + + if(!empty($previewPreface)) { + echo('

'.$previewPreface.'

'); + } + + if(!empty($previewText)) { + echo('

'.$previewText.'
Click here

'); + } else { + echo('

Click here

'); + } + + echo('
'); + + echo('

'); + foreach($tags as &$tagValue) { + echo('  #'.$tagValue.''); + } + echo('

'); +} + +/* Defining globals and constants */ +const BLOG_ACTION_NONE = "n"; +const BLOG_ACTION_SEARCH_TAGS = "t"; +const BLOG_ACTION_SEARCH_AUTHOR = "a"; +const BLOG_ACTION_SEARCH_DATE = "d"; +//const BLOG_ACTION_ERROR_SEARCH_TYPE_INVALID = "e"; + +const BLOG_PARAM_ACTION = "c"; +const BLOG_PARAM_ARTICLE_PER_PAGE = "c"; +const BLOG_PARAM_PAGE = "p"; +const BLOG_PARAM_SEARCH_PARAM = "s"; + +$blog_action = BLOG_ACTION_NONE; +$blog_search_parameter = ""; +$current_page = 0; +$article_per_page = 10; + +/* Parsing and verifying arguments */ +if(count($_GET) > 0) { + if(array_key_exists(BLOG_PARAM_ACTION, $_GET)) { + $blog_action = $_GET[BLOG_PARAM_ACTION]; + } + if(array_key_exists(BLOG_PARAM_ARTICLE_PER_PAGE, $_GET)) { + $article_per_page = $_GET[BLOG_PARAM_ARTICLE_PER_PAGE]; + } + if(array_key_exists(BLOG_PARAM_PAGE, $_GET)) { + $current_page = $_GET[BLOG_PARAM_PAGE]; + } + if(array_key_exists(BLOG_PARAM_SEARCH_PARAM, $_GET)) { + $blog_search_parameter = $_GET[BLOG_PARAM_SEARCH_PARAM]; + } +} + +if(!($blog_action == BLOG_ACTION_NONE || $blog_action == BLOG_ACTION_SEARCH_TAGS || + $blog_action == BLOG_ACTION_SEARCH_AUTHOR || $blog_action == BLOG_ACTION_SEARCH_DATE)) { + $blog_action = BLOG_ACTION_NONE; +} + +if(!is_numeric($article_per_page)) { + $article_per_page = 10; +} + +if(!is_numeric($current_page)) { + $current_page = 0; +} + +/* Loading blog entries */ +$jsonArticles = null; + +try { + $jsonArticles = file_get_contents("articles.json"); + $jsonArticles = json_decode($jsonArticles, true); +} catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + $jsonArticles = null; +} + +if($jsonArticles == null) { + exit("An error occured during the JSON parsing process..."); +} + +/* Printing the articles... */ +$currentArticleId = 0; +$articlesLeft = $article_per_page; + +//TODO: Max value is not right or checked yet ! +for($currentArticleId = ($article_per_page * $current_page); $currentArticleId < count($jsonArticles); $currentArticleId++) { + //echo($jsonArticles[$currentArticleId]["id"]."
"); + printBlogPreviewCard( + $jsonArticles[$currentArticleId]["id"], + $jsonArticles[$currentArticleId]["title"], + $jsonArticles[$currentArticleId]["preview"]["preface"], + $jsonArticles[$currentArticleId]["preview"]["text"], + $jsonArticles[$currentArticleId]["preview"]["image"], + $jsonArticles[$currentArticleId]["preview"]["imageAlt"], + $jsonArticles[$currentArticleId]["tags"], + $jsonArticles[$currentArticleId]["preview"]["icon"]); +} +?> diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..e026c2a --- /dev/null +++ b/notes.txt @@ -0,0 +1,4 @@ +* Add bottom margin to the last container in the content container for small screens + * Maybe for big ones too ? + * Does not happen on the privacy one, probably because all of them are shown. + * Small is done ! diff --git a/resources/Azias/imgs/maki-dumb01.png b/resources/Azias/imgs/maki-dumb01.png new file mode 100644 index 0000000..1410d2f Binary files /dev/null and b/resources/Azias/imgs/maki-dumb01.png differ diff --git a/resources/Azias/imgs/maki-nanners-smoothed.png b/resources/Azias/imgs/maki-nanners-smoothed.png new file mode 100644 index 0000000..b79d1dd Binary files /dev/null and b/resources/Azias/imgs/maki-nanners-smoothed.png differ diff --git a/resources/Azias/imgs/maki-nanners.png b/resources/Azias/imgs/maki-nanners.png new file mode 100644 index 0000000..eb543f9 Binary files /dev/null and b/resources/Azias/imgs/maki-nanners.png differ