CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.  (Read 9951 times)

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Squire 3 / Paladin X.3 -- Rebuilding from the ground up.

We're getting a bit off the topic of routing given the number of people who seem interested in my custom "poor man's CMS" and even full blown CMS approach... so I'm going to start a separate thread for discussion of how it works and the reasons I make the decisions that go into it.

For now we have Squire and a poor man's CMS as a working demo here:

https://cutcodedown.com/for_others/squire3/

Squire is my term form various helper functions/classes I use to make a poor man's CMS. Squire consists mostly of:

1) Session Handling

2) The "Request" static object that handles parsing $_SERVER['REQUEST_URI'] providing "one index to rule them all" with user friendly URI's. (The people who call them "search friendly" are talking out their arses BTW!)

3) A "Settings" static object that allows loading from .ini files and/or setting via getters and setters. .INI values are considered "inviolate" and can only be accessed via getters by normal code. If you try to set a value that was pulled from a .ini that set is ignored. Kind of...

4) My general approach to templates, where there's a loadTemplate function to pull the appropriate sub-template files, which are filled with template_name functions like template_header and template_footer  to which data is passed.

Basically Squire is the baseline tools needed to build a "poor mans CMS" (aka just gluing static files together). It is the closest I usually ever come to a "framework". Note that the template style/markup itself and the demo static pages are NOT considered part of "Squire". I simply added enough to show how the parts of squire are used.

Hence concerns about the existing template -- which was a stopgap copy of a WIP from another project -- are mostly irrelevant to the discussion.

Paladin is my term for any fully developed CMS I build based upon Squire. Traditionally these are turnkey to meet the client's specific needs, not a generally organized system.  The next

As a rule of thumb I don't believe in off the shelf answers when it comes to database or "action" parts of building a site. One size fits all usually fits none, and I've always found it easier to do those on a case-by-case basis, rather than having a completed starting like that I have to "run backwards" undoing code to adjust to the client's needs.

With most existing systems that's always what happens; the client wants something it doesn't do out of the box, so you spend far more time undoing the OOB experience and trying to fit client wants to what already is, than you would simply starting over from scratch with the bare necessities, the simple bear necessities, forget about your worries and your strife.

Alright, I'm going to try moving a few of the comments that have nothing to do with "routing" into this thread, and then when I have the time I'll start documenting what "already is" in preparation for the next step.

That next step being that I'll turn it into a database driven blogging system. We'll start with a primitive user and permission system, and work our way out from there.
« Last Edit: 13 Nov 2020, 08:17:20 pm by Jason Knight »
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

xmohamadx

  • Junior Member
  • *
  • Posts: 23
  • Karma: +2/-0
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #1 on: 9 Nov 2020, 01:39:04 pm »
... and done.

Live copy here:
https://cutcodedown.com/for_others/squire3/live

full archive here:
https://cutcodedown.com/for_others/squire3/squire3.rar

I'll use what little time I have left before the client meeting to start doing some proper documentation of the how/what/why of it.

Oh, man! such a clean and nice design!
I'm totally disappointed after seeing this demo, while I'm trying hard to design almost a similar website to this demo for more than a month, but you did it in two days I think!

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 781
  • Karma: +8/-0
    • Grumpy Young Man
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #2 on: 10 Nov 2020, 03:11:15 am »
I'm hijacking this thread for a second, as the mod-rewrite doesn't seem to work on my local install - I was being nosey...

I get the default apache error if I visit: [myURL]/CutDownCode/Squire3/aBunchOFGobbledegook and not the styled  404 error as shown here.

I guess ModRewrite issue? can the .htaccess file be being ignored?

Sorry for hijacking the thread!
« Last Edit: 10 Nov 2020, 03:38:50 am by GrumpyYoungMan »
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 781
  • Karma: +8/-0
    • Grumpy Young Man
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #3 on: 10 Nov 2020, 08:01:13 am »
Which is why I thought it was a mod_rewrite issue - yes it was a manual install of Apache! :)

Thanks! :)
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 781
  • Karma: +8/-0
    • Grumpy Young Man
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #4 on: 10 Nov 2020, 09:07:46 am »
I guess ModRewrite issue? can the .htaccess file be being ignored?
The rewrite rule is the core of how "one index" works. Without it, no... none of this will work. You either need it as a .htaccess or placed in your httpd.conf or virtual hosts file.

It's odd for such a central part of Apache would be broken or not installed, even on a local copy. I mean yeah, out of box it's disabled if you manually install it, but it's one of the first things that one usually turns on. Does a "sudo a2enmod rewrite"fix it, or is "AllowOverride All" missing from the vhosts?

This is why for local testing I prefer either running a full VM server install, or an off the shelf all-in-one like XAMPP.
Sorry for hi-jacking the thread!

This code looks as it is something I could tweak to suit my needs - Am I free to do that and use your code?
« Last Edit: 10 Nov 2020, 12:23:06 pm by GrumpyYoungMan »
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

John_Betong

  • Full Member
  • ***
  • Posts: 218
  • Karma: +24/-1
    • The Fastest Joke Site On The Web
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #5 on: 11 Nov 2020, 01:25:26 am »
@Jason Knight

I managed to TEMPORARILY install the source code and add a couple of amendments.

One addition was to replace the footer with W3.org validation links  for every page.  The infuriating  HTML validation have been removed :)

Application Flow Chart
Another addition was to add an Application Flow Chart image from another PHP Framework. 


https://thisisatesttoseeifitworks.tk/deathshadow/

Is it possible for anyone to create an Application Flow Chart for this framework?

Observation
I missed having PHP view files and far prefer them because I can change then according to the environment, etc

<?php  // example view file
$tmp = LOCALHOST ? 'small.jpg' : 'large.jpg';
echo '<img src="' .$tmp .'" alt="myImage">';


I am also curious about adding a database and if this would ever be a replacement for the popular PHP Frameworks.

Looking forward to the GitHub version.
« Last Edit: 11 Nov 2020, 01:27:31 am by John_Betong »
Retired in the City of Angels where the weather suits my clothes

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #6 on: 11 Nov 2020, 07:57:27 am »
One addition was to replace the footer with W3.org validation links  for every page.  The infuriating  HTML
\validation have been removed :)
Which is a total pointless waste of bandwidth, since normal users don't give a flying ****.

And by fixing the X-UA, you broke the entire reason it's there! The entire reason it is there being to tell IE 10 and 11 to obey IE CC's, since my intent is to tell ALL versions of IE to go suck it in terms of CSS and JavaScript.

You have "broken" it for IE 10 and 11 by "fixing" that ALLEGED "error"... again why I tell HTML 5 validation to f*** off at this point.  JUST as omitting "projection" and "tv" from the media target breaks it for specific UA's like many kiosks and settops.

"fixing" said claims by the W3C of things that are NONE of the HTML specifications flipping business breaks things. Hence why "valid HTML" with this living document BULL is as much of a pipe dream as CSS validation was a decade ago.

NOT saying don't check it, but know which errors are total nonsensical mentally enfeebled "eye cans haz teh intarwebs" BULL!

Seriously, open your version of the page in IE11... now open my copy in same.

IE11, X-UA-Compatible IE=9, conditional comments strip off all broken CSS and Scripting:


IE11, X-UA-Compatible IE=edge, conditional comments are ignored and the page is a broken mess of broken non-working components.


And that is why I lack the words to use in polite company when it comes to the ****wit halfwit dumbass pedantic nonsensical BS changes they've made to HTML 5 over the past year or three. More so when there's ZERO blasted version tracking in document so yesterday's HTML 5 is invalid today, and today's HTML 5 has the potential to be invalid tomorrow.

It's the straw that broke the camel's back in my love-hate relationship with the W3C. They've gone from a well intentioned group of wishful thinkers pretending to be a standards body, to an abusive, manipulative, and duplicitous abusive spouse we're not "Allowed" to divorce.

Another addition was to add an Application Flow Chart image from another PHP Framework.
Ah, a flow chart... how quaint... in a "horse and buggy" career educator rel;ic of the early '80's (at best).

"Hello computer... a keyboard? How quaint!" -- Scotty

Is it possible for anyone to create an Application Flow Chart for this framework?
Always possible, though the architecture logic isn't orthagonal; which is oft where flowcharts go bits -up. Much like the CISC vs. RISC debate, where one has the opcodes created as efficient as possible for performance and the support hardware (RAM, disk, BUS), whilst the other shoe-horns them into an organized grid where it's very efficient on the CPU die, but painfully inefficient for everything connected to it. Which is why ARM is cheap, very power efficient, and will NEVER match x86 on performance per clock or memory efficiency.

Orthagonal coding -- which is what a lot of those pesky "programming paradigms" try to be -- amounts to creating inflexible systems. They have a single over-reaching plan that often doesn't fit or allow for things to go outside their lines. MVC is an example of this where whilst it might make sense in certain very small corner cases -- event driven programming where it's single view-stack -- it's often a bloated pointless wreck when shoe-horned into request driven programming. (which PHP used for websites is most definitely request driven, not view driven).

This "square" layout that fits into nice pretty flowcharts is the proverbial round peg square hold problem. You pound hard enough it fits, doesn't make it right.

Also for the love of whatever flavor fairy tale genocidal maniac in the sky you happen to subscribe to, don't call this a framework. At best it's a "poor man's CMS" and that will change when I have the time to add database and user handling... which is around 70% complete with me plucking away it in my spare time between actual client proposals and some paying side-work doing builds and repair. Got a socket 1366 Xeon workstation on the bench right now that won't stay powered on and/or randomly loses video. Trying to convince the owner it's far past time to upgrade, and to buy a win10 license since they're on a bootleg of 8.1

I missed having PHP view files and far prefer them because I can change then according to the environment, etc

<?php  // example view file
$tmp = LOCALHOST ? 'small.jpg' : 'large.jpg';
echo '<img src="' .$tmp .'" alt="myImage">';

The what now? I know what "views" are in JavaScript and the concept doesn't make a lick of sense for PHP, and if we were to talk views, that's not it.

It's also policy in how I write this that in normal echo commas are favored over string addition. Uses less memory and executes faster.

That's also a "variable for nothing" ... and you can go ahead and do that in the template or the content generation so I'm not quite sure what you're "missing".

Code: [Select]
echo '
  <img src="', LOCALHOST ? 'small.jpg' : 'large.jpg' , '" alt="describe this properly!">';
Though when choosing a large or small image, that's typically the <picture> tag's job... well, at least it is if you tell IE to sod off.

I am also curious about adding a database and if this would ever be a replacement for the popular PHP Frameworks.
That is the next step to half-answer @benenaman's request, though overall what he's talking about and what I do and/or would do and/or would let clients do isn't even in the same galaxy, much less ballpark.
« Last Edit: 11 Nov 2020, 08:19:42 am by Jason Knight »
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

John_Betong

  • Full Member
  • ***
  • Posts: 218
  • Karma: +24/-1
    • The Fastest Joke Site On The Web
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #7 on: 11 Nov 2020, 10:35:22 am »
Just a quick note because it is quite late here.

The page displays fine on the three systems I tried which were Linux desktop, Apple iPad Mini and an Android Motorola mobile. Tomorrow  I will try and find an emulator to replicate the broken display.

I also noticed the page is stuck on portrait mode and does not flip into landscape?
Retired in the City of Angels where the weather suits my clothes

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #8 on: 11 Nov 2020, 11:04:22 am »
The page displays fine on the three systems I tried which were Linux desktop, Apple iPad Mini and an Android Motorola mobile.
NONE of which pay any attention to the X-UA-Compatible META. It is 100% browser specific to IE, which is why the HTML 5 specification should have ZERO BLASTED BUSINESS caring what it's for or what its values are.

In fact, this sets a dangerous precedent. META tag are supposed to be for UA or developers to use to create whatever values they want. Like the keywords and description META were NOT created by the W3C, they were made by search engines under the rules for META.

META literally exists for the purpose of letting us declare name/content pairs however we like. That's what it's for. For them to say that a specific value is or isn't valid in HTML 5 defeats the entire blasted reason the tag even EXISTS!

This goes above and beyond when it comes to the level of ***ing STUPID the HTML 5 specification continues to morph into. It had a weak start to begin with undoing most of the reasoning behind HTML 4 Strict, but lands sake this is ridiculous.

Every blasted month for ten years, there's just been one more reason to tell the W3C to go **** themselves. The stupid at this point hurts and is starting to go above my pay grade.

I also noticed the page is stuck on portrait mode and does not flip into landscape?

What does portrait/landscape  have to do with layout? If there's enough EM width in either to show the layout as is, the layout is shown as is. The media queries are NOT based nor should they be based on specific sizes or aspect ratios, but on the needs of the content.

And portrait/landscape on WHAT exactly? Your tablet? My tablet? Your phone? My phone? With them all having different resolutions and aspect ratios, you can't just say "portrait" or "landscape" as what's good for one will be illogical junk for another.

That's why designs pre-planned for aspect ratio or specific px widths are almost always broken junk for someone somewhere at some time. See Bootcrap's dumbass "grid" and media query idiocy.

Where if you don't know what's wrong with their s, m, l, xl, xxl rubbish and how it's implemented, you probably shouldn't be creating frontends.
« Last Edit: 11 Nov 2020, 11:06:03 am by Jason Knight »
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #9 on: 11 Nov 2020, 01:21:45 pm »
Oh, one more thing about:
The infuriating  HTML validation have been removed :)
The removal of aria-hidden="true" results in those elements showing up in some screen-readers like Jaws 2018/earlier. Because the blind are often stuck using decade out of date versions (since they're disabled and the software costs thousands) legacy support on things like "hidden" is important.

... and the "hidden" attribute? It's too new. Aria-hidden="true" predates it by about five years, so UA support is more likely to have the aria version than the HTML 5 one. Worse, desktop UA's (browsers) tend to ignore aria roles outright!

As such we NEED both; to blazes with the W3C's opinion on that. Pedantic bullshit like that is out of touch with real world deployment. Almost as if the 500 pound gorilla's over there are the browser makers, and so far as they're concerned people who actually build websites can sod off.

As evidenced by the language used in their ALLEGED "specification"! And it takes giant brass donkey balls to call HTML 5 a "specification" with a straight face if you know the first blasted thing about engineering!
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

John_Betong

  • Full Member
  • ***
  • Posts: 218
  • Karma: +24/-1
    • The Fastest Joke Site On The Web
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #10 on: 12 Nov 2020, 01:11:38 am »
@Jason Knight,
Quote
Which is a total pointless waste of bandwidth, since normal users don't give a flying ****.
I find it ideal for validating HTML errors, one click reveals all anomolies.


Quote
And by fixing the X-UA, you broke the entire reason it's there! The entire reason it is there being to tell IE 10 and 11 to obey IE CC's, since my intent is to tell ALL versions of IE to go suck it in terms of CSS and JavaScript.
The screendump was not the web page on my site because the link names are different and there are no avatar images?

Quote
Seriously, open your version of the page in IE11... now open my copy in same.
I do not have Windows and therefore cannot test. I tried a couple of emulators and the web page displays without any distortion? Can someone else try the actual page and provide a screendump.

Quote
Ah, a flow chart... how quaint... in a "horse and buggy" career educator rel;ic of the early '80's (at best).

"Hello computer... a keyboard? How quaint!" -- Scotty
I have always found charts useful especially when trying to comprehend a wall of text.

Quote
The what now? I know what "views" are in JavaScript and the concept doesn't make a lick of sense for PHP, and if we were to talk views, that's not it.
I think PHP Frameworks and CMSs all have views because they try to separate functionality similar to MVC structures. I thought my example was easily comprehended at glance and can always be optimised. I also thought the demo and source code was a replacement for PHP Router Frameworks. Can the source code not be adapted for other sites?

Quote
What does portrait/landscape  have to do with layout? If there's enough EM width in either to show the layout as is, the layout is shown as is. The media queries are NOT based nor should they be based on specific sizes or aspect ratios, but on the needs of the content.
I expected that the web page would flip when the mobile was rotated?

Looking forward to updates rather than rants when others anomolies.
« Last Edit: 12 Nov 2020, 01:39:24 am by John_Betong »
Retired in the City of Angels where the weather suits my clothes

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #11 on: 12 Nov 2020, 09:31:54 am »
I find it ideal for validating HTML errors, one click reveals all anomolies.
I use the web developer toolbar for that.
https://chrispederick.com/work/web-developer/

It can reveal all sorts of other data that's useful, like a document outline to tell you if your heading orders are shite or not, or turning on/off CSS to test accessibility.

It's just not something that belongs on a live page, this isn't 1998 and the age of "best viewed in Netscape" banners.

The screendump was not the web page on my site because the link names are different and there are no avatar images?
That's because I used my local copy to swap the two values.

I do not have Windows and therefore cannot test.
Which means you've utterly hobbled yourself at web development, and or should have Windows available in a VM.

I tried a couple of emulators and the web page displays without any distortion?
Define "emulators"... do you mean a VM, or do you mean relics of a bygone age that don't accurately represent what IE really does? There's a lot of bullshit IE "testers" out there that just don't work, particularly for details like this.

Kind of like how Chrome and FF's mobile emulation is mostly bullshit.

I have always found charts useful especially when trying to comprehend a wall of text.
I've always found them useless outside academic settings.

I think PHP Frameworks and CMSs all have views because they try to separate functionality similar to MVC structures.
Which as you've probably heard me say dozens of times, shoe-horning MVC into PHP is a complete complexity mismatch. PHP is request driven linear execution, MVC is ideal for event driven... which is why 99%+ of everything I've ever seen done with MVC is bloated convoluted hard to maintain crap.

I thought my example was easily comprehended at glance and can always be optimised.
WHAT it does is easy to comprehend, what it has to do with "views" is utterly beyond me. It's a minor snippet of ternary output that has absolutely nothing to do with the topic being discussed.

I expected that the web page would flip when the mobile was rotated?
Flip? Do you mean rotate? Are you saying when you rotate the display it's not rotating to match? There's nothing present that would/should cause that. Lemme guess, crApple Safari, right? Broken from day one and aging like milk

Looking forward to updates
Might be a bit, paying work comes first.
« Last Edit: 12 Nov 2020, 09:34:01 am by Jason Knight »
We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 1039
  • Karma: +188/-1
    • CutCodeDown -- Minimalist Semantic Markup
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #12 on: 12 Nov 2020, 09:51:56 am »
Oh, and here's a screenshot of your version broken in IE11.



IE can't handle CSS variables, so the colours are missing, padding is wrong, flex is broken/incorrect, which is why I set IE=9 enabling IE CC's so IE doesn't get the CSS or JS.

... and why I've got exactly two words for the W3C on their "recent" changes to HTML 5.

We are all, we are all, we are all FRIENDS! For today we're all brothers, tonight we're all friends. Our moment of peace in a war that never ends.

John_Betong

  • Full Member
  • ***
  • Posts: 218
  • Karma: +24/-1
    • The Fastest Joke Site On The Web
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #13 on: 13 Nov 2020, 02:49:56 am »
@Jason Knight
Quote
I use the web developer toolbar for that.
https://chrispederick.com/work/web-developer/
Far too much info and I will strick to my method because I find it quicker.


Quote
Quote from: John_Betong on 2020-11-12, 12:11:38
I do not have Windows and therefore cannot test.
Which means you've utterly hobbled yourself at web development, and or should have Windows available in a VM.
Fortunately web developement is strictly for my personal benefit and does not require Windows :)

I managed to add another web page:

https://thisisatesttoseeifitworks.tk/deathshadow/static/info
Retired in the City of Angels where the weather suits my clothes

fgm

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +5/-0
Re: Squire 3 / Paladin X.3 -- Rebuilding from the ground up.
« Reply #14 on: 13 Nov 2020, 01:07:48 pm »
Thank you for Squire 3 code!
Code: [Select]
class="cards vanilla"
class="cards vanilla framed"
class="cards icons landscape discs"

Aren't vanilla, framed, landscape and discs classes presentational concepts that have no place into HTML? since HTML describes what things are and not how they look.
« Last Edit: 13 Nov 2020, 01:12:26 pm by fgm »

 

SMF spam blocked by CleanTalk

Advertisement