my website banner

created sorting of blogs (redirected everything to blog.PHP)
authorDavid Polakovic <email@dpolakovic.space>
Wed, 26 Apr 2023 18:41:11 +0000 (20:41 +0200)
committerDavid Polakovic <email@dpolakovic.space>
Wed, 26 Apr 2023 18:41:11 +0000 (20:41 +0200)
Blogs/blog-list.html [new file with mode: 0644]
Blogs/blog-template.html
Pictures/gnu40.png [new file with mode: 0644]
ad.html
blog.html
blog.php
index.html

diff --git a/Blogs/blog-list.html b/Blogs/blog-list.html
new file mode 100644 (file)
index 0000000..327651e
--- /dev/null
@@ -0,0 +1,3 @@
+Does it work? Hope it does...
+and what about now?
+and this, this is Edited 
index fb885d673a16ef61fca7b0d946e04b32c77a30c2..df0a7890645b291a5150b26c03bd8c1efa561c8d 100644 (file)
@@ -24,7 +24,7 @@
     <!-- navigation bar -->
     <nav class="nav-bar-blog">
       <ul>
-       <li><a href="https://dpolakovic.space/blog.html">Go back</a></li>
+       <li><a href="https://dpolakovic.space/blog.php">Go back</a></li>
       </ul>
     </nav>
 
diff --git a/Pictures/gnu40.png b/Pictures/gnu40.png
new file mode 100644 (file)
index 0000000..2147bfd
Binary files /dev/null and b/Pictures/gnu40.png differ
diff --git a/ad.html b/ad.html
index 4802f3789832cde79602061dc69e86f75995e364..64216a20291b6fd994785378089d4f00c79690b9 100644 (file)
--- a/ad.html
+++ b/ad.html
@@ -25,7 +25,7 @@
     <nav class="nav-bar">
       <ul>
        <li><a href="https://dpolakovic.space">About</a></li>
-       <li><a href="https://dpolakovic.space/blog.html">Blog</a></li>
+       <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
        <li><a href="https://dpolakovic.space/ad.html">Classified ad</a></li>
        <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
        </li>
        <ul>
          <!-- What I need  -->
          <li>
-           Here I write some stuff.
+           I will buy board game Le Havre in any of these languages: EN, DE, CZE.
+         </li><br>
+         <li>
+           I am looking for Motorola F3 also known as Motofone. I will buy both
+           GSM variants, US and EU, as well as batteries for them.
          </li><br>
 
          <!-- What I offer  -->
          <li>
-           Here I write some stuff.
+           I offer for sale original Nintendo NES classic edition with two controllers,
+           signed by Masayuki Uemura - console only, without box.
          </li><br>
          
        </ul>
index 7164aacc258a903cba08f50e9ea31f92c1094d17..f111924406b7dfdbd48d647952c9912a84e4a66e 100644 (file)
--- a/blog.html
+++ b/blog.html
@@ -27,7 +27,7 @@
     <nav class="nav-bar">
       <ul>
        <li><a href="https://dpolakovic.space">About</a></li>
-       <li><a href="https://dpolakovic.space/blog.html">Blog</a></li>
+       <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
        <li><a href="https://dpolakovic.space/ad.html">Classified ad</a></li>
        <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
        </li>
@@ -46,7 +46,8 @@
        for more than few seconds.<br><br>
       </p>
       <p>
-       <!-- put links here -->
+       WHOOOPS! Nothing's here. You better check
+       <a href="https://dpolakovic.space/blog.php">blog.PHP</a></li>
       </p>
       </main>
 
index 911c769a8c71ef01a8fa12d8de6c1c09195a8313..cc349158e4f0b6d7995e6af0f7a8fec73d7dcf16 100644 (file)
--- a/blog.php
+++ b/blog.php
@@ -27,7 +27,7 @@
     <nav class="nav-bar">
       <ul>
        <li><a href="https://dpolakovic.space">About</a></li>
-       <li><a href="https://dpolakovic.space/blog.php?sort=new">Blog</a></li>
+       <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
        <li><a href="https://dpolakovic.space/ad.html">Classified ad</a></li>
        <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
        </li>
        <br>
        After eating and breathing, expressing opinions on the internet is the
        most important humand need. Here are some of mine that occupied my mind
-       for more than few seconds.<br><br>
+       for more than few seconds.
       </p>
+      <?php
 
-      <!-- These are hyper link buttons for sorting blogs
-          NOTE: WIP see "PHP Blogs" lower
+       $sort = 'new';
+
+       // check if hyperlink has been clicked
+       if (isset($_GET['sort']))
+       {
+         $sort = $_GET['sort'];
+       }
+        
+        // function to print file line by line
+        function printFile($filename)
+        {
+          $lines = file($filename);
+          foreach ($lines as $line)
+          {
+             echo $line . '<br>';
+          }
+        }
+
+        // function to print file line by line in reverse order
+        function printFileReversed($filename)
+        {
+          $lines = file($filename);
+          $reversedLines = array_reverse($lines);
+          foreach ($reversedLines as $line)
+          {
+             echo $line . '<br>';
+          }
+        }
+
+       // function to print file line by line which has "Edit" in them
+       function printFileEdited($filename)
+       {
+          $file = fopen($filename, "r");
+    
+          while (($line = fgets($file)) !== false) {
+          if (strpos($line, 'Edited') !== false)
+              {
+                echo $line . '<br>';
+              }
+            }
+            fclose($file);
+         }     
+      ?>
       <p>
        <center>
-         Sorty by date:&nbsp;
-         <a href="blog.php?sort=new">new first</a>&nbsp; 
-         <a href="blog.php?sort=old">old first</a>&nbsp;
-         <a href="blog.php?sort=edt">edited first</a>
-         <br>
+       Sort: &nbsp;
+       <a href="?sort=new">New first</a> &nbsp;
+       <a href="?sort=old">Old first</a> &nbsp;
+       <a href="?sort=edit">Edited only</a>
        </center>
-      </p> 
-      -->
-      
+      </p>
       <p>
-       <!-- Blog list
-            here I output html file with manually written html tags for each
-         -->
-        <?php
-         echo "Seems empty here!"//file_get_contents("./bloglist.html");
-        
-        // this is for buttons
-        //if ($_GET["sort"] == "new") {echo 'sort by new';}
-        //if ($_GET["sort"] == "old") {echo 'sort by old';}
-        //if ($_GET["sort"] == "edt") {echo 'sort by edited';}
-
-        ?>
+       <?php
+            //debug
+            //echo "<br>Current value of key: $key <br>";                                                 
+         if ($sort == "new")
+         {
+           printFile("./Blogs/blog-list.html");
+         }
+         if ($sort == "old")
+         {
+           printFileReversed("./Blogs/blog-list.html");
+         }
+         if ($sort == "edit")
+         {
+           printFileEdited("./Blogs/blog-list.html");
+         }         
+        ?>
       </p>
-    </main>
+      </main>
 
     <!-- footer  -->
     <footer class="footer">      
index 1aa547940f150e0c4e2d7c2f20db5144d9b204e9..6ec6284ed666df7bd35c77cde6b7540739c7f9c4 100644 (file)
@@ -25,7 +25,7 @@
     <nav class="nav-bar">
       <ul>
        <li><a href="https://dpolakovic.space">About</a></li>
-       <li><a href="https://dpolakovic.space/blog.html">Blog</a></li>
+       <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
        <li><a href="https://dpolakovic.space/ad.html">Classified ad</a></li>
        <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
        </li>
       <p>
        <!-- show my buttons button 
             buttons for PGP and Any browsers campaign
-       -->
+         -->
+               <a class="gif-buttons" href="https://www.gnu.org/gnu40/">
+         <img src="./Pictures/gnu40.png" alt="GIF button: any browser campign">
+       </a>
        <a class="gif-buttons" href="https://emailselfdefense.fsf.org/en/">
          <img src="./Pictures/pgp-now.png" alt="GIF button: PGP set up guide">
        </a>