Web Analytics Made Easy -
StatCounter For JudgeDredd, homepage rewrite - CodingForum

Announcement

Collapse
No announcement yet.

For JudgeDredd, homepage rewrite

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    @judgedredd,
    Three year old Github Repository:

    https://github.com/John-Betong/Analyze-Path-Differences

    Comment


    • #32
      Originally posted by JOhn_Betong View Post
      @judgedredd,
      Three year old Github Repository:

      https://github.com/John-Betong/Analyze-Path-Differences
      Thanks for that. I will take a look.

      Comment


      • #33
        Originally posted by JOhn_Betong View Post
        @judgedredd,
        Three year old Github Repository:
        Which is STILL utterly unrelated to what he's asking.

        What he's asking for is bascially... well, let's assume all his content pages are in a subdirectory /content as .content.php and are loaded into a "one index to rule them all"...

        The best operation to use would probably be DirectoryIterator:

        https://www.php.net/manual/en/direct....construct.php

        Something like: (untested, drive-by from laptop)

        Code:
        if ($directory = new DirectoryIterator('content/*.content.php')) {
            $item = clone $directory->current();
            while ($directory->next()) {
                $test = $directory->current();
                if ($test->getCTime() > $item->getCTime()) $item = clone $test;
            }
            // $item is now the most recent file thus
            // $item->getCTime() is the time of that file
        } else {
            // no files found
        }
        What your git directory of the typical nonsensical bloated "long way" code with non-semantic trash markup has to do with that I have no idea. All he's flipping asking for is the date of the most recently created file.

        Though honestly I'd NEVER do it this way with static files. That's time to man the **** up and use a database.
        Last edited by deathshadow; Jul 31, 2020, 04:00 AM.
        I'll kill you and your dreams tonight, begin new life.
        Bleed your death upon me, let your bloodline feed my youth.
        https://cutcodedown.com

        Comment


        • #34
          Hi guys,

          I have been looking at all the errors on my front page when I have gone to that code validation site that was provided. I am pretty fed up with seeing so much crap. I have tried to correct stuff but I have realized that it is pointless as the code base of the site makes it too work-intensive to do that. Even shoving stuff from the html page to the CSS page is tedious as the whole site is illogical in how it has an index page with its own CSS sheet while others have their own plus there is also a main-body.css file that is called on most pages. I say 'most' because the index page doesn't have it and there may be others that don't have it too. For Under the Consideration of the King! What was I thinking.... well, I shouldn't be too hard on myself. I got the bloody thing working so that people could at least see the stuff I am trying to present.

          What I am going to do is print out all the pages of this thread and the other thread where all this began, where deathshadow has given his input, print out all the example pages that deathshadow has created, print out a couple of my old pages, then bloody well read everything and compare old code to new code and see if I can junk all that I have 'learnt' about HTML from the past and take on board the new way of doing things (HTML and CSS - PHP will be left alone for the time being). I will probably also print out the entire list of HTML elements so that I can have that handy. I'll be printing out this stuff because part of the problem of looking at a computer screen is that one doesn't retain information as well as if one has something in one's hands that can be touched.

          As for the actual content of each page, unfortunately that does not have its own standalone text files that are pulled from an includes or content folder. I was wondering about that and have realised that it should have been done a) in case I ever wanted to go to a CMS (which I do) and b) to make it easier to build a template and just plug in the content of the page separately. Oh, well. What else is there to do in the world at the moment?

          I will take deathshadows's pages and build from there. Though it will be interesting if I can get the left-hand menu to work on the other pages (not including the donations and rabbit hole pages) as shown on the current pages. I believe that will be just a question of creating a display:block class for that section with everything else CSS-wise the same.

          This does bring up a point that I remembered reading in a coding book (actually a very good one that I don't have access to at the present and I can't remember its name) - namely how I want a page to look has to be considered first, then when that is squared away, create the HTML semantic markup with the content. Then style everything to how I want it to look to match the first point.

          What I did in the past was creat a table and then plugged everything into the cells completely clueless as to the fact I was doing it assbackwards. In those days we didn't have mobile devices as being the dominant device that people used so I ignored those things. Now it is totally the opposite. Hence this thread and thanks again to deathshadow for his invaluable assistance in putting me on the right track. Wish I had met you years ago.
          Last edited by judgedredd; Jul 31, 2020, 10:02 AM.

          Comment


          • #35
            deathshadow, I tried your code and modified it very slightly to:

            PHP Code:
            <?php if ($directory = new DirectoryIterator('sitepages')) {
            $item = clone $directory->current();
            while (
            $directory->next()) {
            $test $directory->current();
            if (
            $test->getCTime() > $item->getCTime()) $item = clone $test;
            }
            echo 
            $item;
            // $item is now the most recent file thus
            // $item->getCTime() is the time of that file
            } else {
            // no files found
            }
            ?>
            I'm not sure if it will print anything to screen though.

            I changed a file in the sitepages folder and it didn't show that on the front page.
            Last edited by judgedredd; Jul 31, 2020, 11:08 AM.

            Comment


            • #36
              @judgedredd,
              > I have been looking at all the errors on my front page when I have gone to that code validation site that was provided. I am pretty fed up with seeing so much crap.

              Please supply a link to the front page, message me if you want. (I have eventually changed a menu system on a site, database, etc and now in the finishing process of making it pretty so have time on my hands).

              Comment


              • #37
                Hi JOhn_Betong,

                I have spent the morning cleaning up the code as much as I can and have got it down to 4 errors from over 30. Here is the site link:

                http://matrixfiles.com/index.php

                So, even though I said I would leave it alone, being a bit OCD, I cleaned it up just for the hell of it and to not be as irked by the code as I was even though its going to be all changed anyway.

                I have tried to add the validation code at the bottom as per your last post on that issue but I could never get it to work properly which is why its not there. Yes, a bit annoying for you and deathshadow but I couldn't see where the error was.
                Last edited by judgedredd; Jul 31, 2020, 02:08 PM.

                Comment


                • #38
                  deathshadow, In one of your early posts you pondered over a new name for the HTML language. I may have one for you (which I can't remember if you said the same or not)...

                  I looked up the difinition of Semantic and even there I had to go to two places to find the more correct definition.
                  https://dictionary.cambridge.org/dic...glish/semantic
                  connected with the meanings of words

                  https://www.lexico.com/en/definition/semantic
                  Relating to meaning in language or logic.

                  The second one is the more correct definition and it comes from the Oxford English Dictionary to boot. So reading the second definition the new name should be:

                  Semantic Markup Language or SML

                  because that will cut out the garbage that so-called 'IT engineers' added to the mix. I mean does anybody (normal people I am talking about) understand what HyperText Markup Language actually means? Its the 'HyperText' bit that people get stuck on.

                  Whereas most people can understand what the word Semantic means.

                  It also conveys what it means and would force people to comply with correct Semantic HTML markup if they wanted to call their coding SML.

                  I'm even thinking that it could have a snappy acronym like so:

                  SMILE - Semantic Markup Internet Language for Everyone

                  (and I claim the copyright to it , along with deathshadow of course, so that some yahoos don't come along and change the definition of it [and rules of how to use it] like what happened with PHP, which was originally called Personal Home Page programming and was created by Danish-Canadian Rasmus Lerdorf).
                  Last edited by judgedredd; Jul 31, 2020, 03:42 PM.

                  Comment


                  • #39
                    Originally posted by judgedredd View Post
                    Hi JOhn_Betong,

                    I have spent the morning cleaning up the code as much as I can and have got it down to 4 errors from over 30. Here is the site link:

                    http://matrixfiles.com/index.php

                    So, even though I said I would leave it alone, being a bit OCD, I cleaned it up just for the hell of it and to not be as irked by the code as I was even though its going to be all changed anyway.

                    I have tried to add the validation code at the bottom as per your last post on that issue but I could never get it to work properly which is why its not there. Yes, a bit annoying for you and deathshadow but I couldn't see where the error was.
                    @deathsahdow has already rewritten that page and I have added the corrects to the following web-page and it validates OK.

                    I would be tempted to use that particular page rather than the one supplied.

                    https://this-is-a-test-to-see-if-it-.../step7_php.php

                    I did look at the errors in the web-page supplied and found that the problem was with using a table colspan="2" on a single column. Removing colspan removed all the errors. give it a whil and see if it works for you.



                    Comment


                    • #40
                      Hi JOhn_Betong, I didn't want to use the page that deathshadow created as yet because I need to get the left menu working on the other pages. I must admit, having the image on the right is starting to grow on me and even the non-justified paragraphs seem ok.

                      That colspan error comes up because of the fact that the entire page is created inside a table with the body of the page having two columns - the left menu and the body. So the header and footer had to span the two columns otherwise the whole thing would break. I guess that nowadays that is considered bad form. The table was created so long ago that I can't remember exactly when it was made!

                      Comment


                      • #41
                        I have just been reading the HTML elements section of the given site: https://developer.mozilla.org/en-US/...b/HTML/Element

                        Very logical and easy to understand and read. I even spent all day Sunday putting the entire section into its own word document (as I didn't like the way it was being printed by the browsers) then printed it to file as a pdf.

                        I can now see how easy it is to create semantically correct pages. I kind of wonder why no-one pointed this out before deathshadow mentioned it. Thank you for that!

                        I can also see that it is far easier to create a page using these elements and code them to be responsive than it is to take a crazily complex 'simple' template and alter it to one's liking, like what I have done with the site I am revamping. So that will get the semantic makeover soon too! Which also means that Bootcrap will be ditched.

                        Here's another shocker - downloading the Wordpress site that comprised https://rachelceller.org was just over 1GB!!! That's more than the entire Windows 98SE OS (yeah, I know its ancient - but an interesting comparison). The actual content was only around 184MB. What the hell have Wordpress put in there? Another reason its being ditched.

                        Anyway, still working on learning the ropes.

                        Comment


                        • #42
                          I had another go and quite pleased with the results. Many of the menus work although upon reflection the color scheme is not 100% but at least the layout is behaving itself. The footer validation links all work and also the "Google Mobile Friendly reports every page is responsive!!!!!

                          https://this-is-a-test-to-see-if-it-...?page=home.php


                          I don't know how the sub-pages were handled but I passed the links as a GET parameter and required the relevant page.

                          Here is the script to the main file which is rough and ready and still meeds a little bit of tender Loving Care

                          File: index.php
                          Code:
                          <?php declare(strict_types=1);
                          error_reporting(-1);
                          ini_set('display_errors', 'true');
                          
                          $PAGE = $_GET['page'] ?? 'home.php';
                          $content = 'sitepages/' . $PAGE;
                          $PAGE = ucFirst($PAGE);
                          $PAGE = str_replace('.php', '', $PAGE);
                          
                          
                          ?><!DOCTYPE html><html lang="en">
                          <head lang="en">
                          <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
                          
                          <link rel="shortcut icon" href="http://matrixfiles.com/favicon.ico">
                          
                          <title> Matrix Files </title>
                          
                          <link rel="stylesheet"
                          href="includes/style-001.css"
                          media="screen">
                          
                          <style>
                          body {
                          background: #000 url('../m-images/matrix.jpg');
                          background-repeat: repeat; /* no-repeat */
                          background-size: cover; /* auto contain */
                          }
                          p,
                          div,
                          .bd2 {border: dotted 0px yellow;}
                          
                          .rad {border-radius: 0.42em }
                          .bgl {background-color: lime;}
                          .bgo {background-color: #FBD789;}
                          .bgs {background-color: snow;}
                          
                          .clb {clear: both;}
                          .dib {display: inline-block;}
                          .fgr {color: red;}
                          .fll {float: left;} .flr {float: right;}
                          .fsm {font-size: medium;}
                          .fss {font-size: small;}
                          .lh2 {line-height: 2;}
                          .mga {margin: 0 auto;}
                          .mgt {margin-top: 4.2em;}
                          
                          .p12 {padding: 0.21em;}
                          .p42 {padding: 0.42em;}
                          
                          .tdn {text-decoration: none;}
                          .tac {text-align: center;} .tal {text-align: left;} .tar {text-align: right;}
                          .w88 {width: 88%; max-width: 971px;}
                          
                          #menu-top li {display: inline-block; margin: 0.1em 0.42em;}
                          #menu-top li a {color: lime; text-decoration: none;}
                          
                          #menu-left {width: 7.5em; margin: 0 1em 0 0;}
                          #menu-left li {display: inline-block;}
                          #menu-left li a {color: darkgreen; text-decoration: none;}
                          
                          #sidebar {width:8em;}
                          #sidebar li {display: inline-block;}
                          #img-matrix {width:100%; height: auto;}
                          
                          </style>
                          </head>
                          <!-- body tag -->
                          <body id="XXXbigwrapper" class="tac">
                          
                          <div class="fll">
                          <?php require 'includes/sidebar.php'; ?>
                          </div>
                          
                          <h1 class="bgo dib rad p21">
                          &nbsp; <?= $PAGE ?> &nbsp;
                          </h1>
                          
                          
                          <div class="w88 mga tdn tal">
                          <img
                          id="img-matrix"
                          src="../m-images/matrix2.jpg"
                          width="971" height="139"
                          alt="#"
                          >
                          
                          <a
                          class="fll tdn"
                          href="http://matrixfiles.com/sitepages/downtherabbithole.php">
                          <img
                          id="rabbit"
                          src="includes/wr2.png"
                          alt="Down the Rabbit Hole we go!"
                          >
                          </a>
                          <ul id="menu-top" class="XXXbgl fll XXXfss">
                          <?php require 'includes/menu-top.php'; ?>
                          </ul>
                          <a
                          class="flr"
                          href="http://matrixfiles.com/sitepages/donations.php">
                          <img
                          id="dollar_sign"
                          class="flr"
                          src="includes/dollar-sign2.png"
                          alt="The almighty Dollar Sign!"
                          width="6">
                          </a>
                          
                          <!-- div id="XXXmenu-left" class="fll tal bgo lh2" -->
                          <div class="fll dib bgo p42">
                          <ol id="menu-left" class="fll XXXclb bgl tal lh2">
                          <?php require 'includes/menu-left.php'; ?>
                          </ol>
                          <?php require $content; ?>
                          </div>
                          
                          
                          <div>
                          <br> &nbsp;
                          </div>
                          
                          </div><!-- #menu-top -->
                          
                          <?php require '../footer.php'; ?>
                          
                          <?php if(0): ?>
                            <!-- span class="px-viewport-dimensions px-viewport-dimensions-hidden tr">
                              &nbsp;
                            </span -->
                            <script async="" src="includes/icons.js"></script>
                            <script async="" src="includes/page.js"></script>
                            <?php require 'includes/statcounter.php'; ?>
                          <?php endif; ?>
                          
                          </body></html>
                          Last edited by JOhn_Betong; Aug 3, 2020, 11:07 AM.

                          Comment


                          • #43
                            Hi JOhn_Betong,

                            I appreciate the effort yet I do prefer deathshadow's look and feel and code base to yours. When I resize the browser your menu doesn't go to hamburger state whereas deathshadow's does. His page works the way I like. I understand that you say your page needs some more work but I would like to spend that time on deathshadow's code.

                            There are a few things going on at my end so it will take a while to get the other pages working and looking the way I would like, which shouldn't be that difficult since deathshadow has done most of the work already. I have yet to thoroughly go over his code but after reading the HTML elements section yesterday and doing what I did, just about all that he has done and explained is now understood. Logical too.

                            I will take note of what you have done and will study what the difference is between your code and his.

                            Comment


                            • #44
                              JOhn_Betong are you SERIOUSLY suggesting he use code like:

                              Code:
                              $PAGE = $_GET['page'] ?? 'home.php';
                              $content = 'sitepages/' . $PAGE;
                              
                              <?php require $content; ?>
                              That's just HORRIFYINGLY INSECURE! This is why you REALLY shouldn't be giving advice to others.

                              benanamen I think you're better at this security stuff than I am -- you certainly complain about it more -- care to explain this to him?

                              It's stuff like this that makes me shudder just thinking about how you build things. It's bad enough the broken garbage "TLA" with style slopped into the markup, and the gibberish to nonexistent semantics, scripts for nothing, breaks and paragraphs doing padding/margin's job, and all the other trash HTML practices... But when nearly every blasted line of your PHP is begging -- just BEGGING -- for crackers to come along and take a walk up your strata-chocolatta?

                              Just stop. Please, for the well being of everyone else online. STOP!
                              I'll kill you and your dreams tonight, begin new life.
                              Bleed your death upon me, let your bloodline feed my youth.
                              https://cutcodedown.com

                              Comment


                              • #45
                                Originally posted by judgedredd View Post
                                I kind of wonder why no-one pointed this out before
                                It's because most people still have their craniums wedged up 1997's rectum, using outdated practices that should NEVER have been introduced to HTML in the first place.

                                HTML was created to be semantic, that's why "Semantic markup" is just a sick euphemism that people came up with so as to not offend those who cannot get presentational markup practices out of their thick skulls. It's why HTML was created, it's what HTML 4 Strict tried to drag us kicking and screaming back to, and it's what a lot of developers flat out refuse to embrace.

                                Frankly, the way most people use HTML is either based on 1990's browser-wars era practices, or just plain people making **** up. The "hot and trendy" practices and methodologies most people use have nothing to do with the specifications, best practices, or even common sense of the topic.

                                Hence how you have people vomiting up incompetent garbage like:

                                Code:
                                <!-- body tag -->
                                <body id="XXXbigwrapper" class="tac">
                                
                                <div class="fll">
                                <?php require 'includes/sidebar.php'; ?>
                                </div>
                                
                                <h1 class="bgo dib rad p21">
                                &nbsp; <?= $PAGE ?> &nbsp;
                                </h1>
                                With ID's for nothing, classes for nothing, presentational classes pissing on separation of concerns and caching models, classes on elements that should be unique, content before the H1, non-breaking spaces for **** knows what, etc, etc. Much less pointless derpy comments like "<!-- body tag -->" right before <body>. No **** Sherlock.

                                They embrace bad practices, hang onto them like Gollum with his Hobbit-humping ring, and in the process make themselves work a dozen times harder, and make it far, FAR harder for anyone else to come in and maintain anything.

                                It is thus that EVERY HTML/CSS "framework" is broken garbage. IF you're going to use a classes to say "this is red, this is centered, this has a specific width" you might as well go back to writing HTML 3.2 pretending CSS doesn't exist, using all those TABLE, FONT, and CENTER tags that everyone so clearly seems to miss. NONE of that chazerei has any blasted business in the HTML.

                                As I've said many the time, if you don't know what's wrong with code like this:

                                Code:
                                .bd2 {border: dotted 0px yellow;}
                                
                                .rad {border-radius: 0.42em }
                                .bgl {background-color: lime;}
                                .bgo {background-color: #FBD789;}
                                .bgs {background-color: snow;}
                                
                                .clb {clear: both;}
                                .dib {display: inline-block;}
                                .fgr {color: red;}
                                .fll {float: left;} .flr {float: right;}
                                .fsm {font-size: medium;}
                                .fss {font-size: small;}
                                .lh2 {line-height: 2;}
                                .mga {margin: 0 auto;}
                                .mgt {margin-top: 4.2em;}
                                
                                .p12 {padding: 0.21em;}
                                .p42 {padding: 0.42em;}
                                
                                .tdn {text-decoration: none;}
                                .tac {text-align: center;} .tal {text-align: left;} .tar {text-align: right;}
                                .w88 {width: 88%; max-width: 971px;}
                                You don't know enough about CSS -- much less HTML -- to be telling others how to build websites, or to even be building websites in the first blasted place.
                                I'll kill you and your dreams tonight, begin new life.
                                Bleed your death upon me, let your bloodline feed my youth.
                                https://cutcodedown.com

                                Comment

                                Working...
                                X