Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize footer.php #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Modernize footer.php #49

wants to merge 1 commit into from

Conversation

mhco
Copy link

@mhco mhco commented Sep 26, 2018

Updated jQuery version (1.11.1 was from May 2014), capitalized Javascript "url" variable to be more in line with the PHP constant, and updated <?php echo URL; ?> to the shorthand <?=URL?> that is standard as of PHP 5.4

Updated jQuery version (1.11.1 was from May 2014), capitalized Javascript "url" variable to be more in line with the PHP constant, and updated "<?php echo URL; ?>" to the shorthand "<?=URL?>" that is standard as of PHP 5.4
@mhco
Copy link
Author

mhco commented Sep 27, 2018

You can't see it in the commit message, but one of the changes is that I changed:

<?php echo URL; ?>

to

<?=URL?>

which was made standard in PHP 5.4, and, since Mini3 requires PHP 5.6, this should be standard amongst all installations of Mini3.

@wbitholedotbe
Copy link

For readability and understanding... Shortcode is an absolute NO GO...

@mhco
Copy link
Author

mhco commented Apr 6, 2023

What? It's literally in PSR-1 right at the top. It's literally the first bullet point of the first section of the first standard. If you're a PHP developer and you can't read <?=$var?> then you need to update your training, as PSR is the standard to make PHP readable and understandable across developers, and they agree that it's one of the only two allowable ways to declare standardized modern PHP code.

https://www.php-fig.org/psr/psr-1/

@crystlbrd
Copy link

crystlbrd commented Apr 6, 2023

I‘m on @mhco site. Those are common shortcut tags and used for echoing something (<?php echo … ?>).

And as he mentioned, they belong to the specification and aren‘t disabled by default (in contrary to the <? ?> short tags).

I’m not even sure if you even can disable them.

@mhco
Copy link
Author

mhco commented Apr 6, 2023

@crystlbrd Not only can you not disable <?= but it's been decoupled from short_open_tags since 5.4.0 in early 2012. It's been a standard for over a decade, now. In fact, PHP.net specifically recommends using it:

As short tags can be disabled it is recommended to only use the normal tags (<?php ?> and <?= ?>) to maximise compatibility.

Source: https://www.php.net/manual/en/language.basic-syntax.phptags.php

Of all of the things in Mini3 or even my personal work to contest, using <?= is one of the last things to raise concern with. That said, if someone doesn't like the user of the short echo tag for some reason, they are totally free to replace it, but it's good and valid programming, so there's no logical reason to disallow it. I would argue it actually makes the code cleaner and easier to read, which is why I submitted this PR in the first place, but that might just be me.

@BeardyMike
Copy link

@crystlbrd & @mhco
MIN3 states that it's simple application for small projects. As a newbie PHP dev, this says to me that I shouldn't expect to find shortcodes or other "pro" tags.

Whilst you might not consider and other shortcodes as pro tags, consider that from the perspective of someone who isn't an advanced user, those tags don't tell me what they're doing. Where as a longer tag like is SUPER clear as to what it's doing. Let's not forget that this is a publicly available project, where readability and accessibility are king.

@crystlbrd
Copy link

Hey @BeardyMike,

thank you for your comment and opinion.

Sadly this projects seems to be abandoned by @panique, considering the last approved pull request was in late 2021 and since then they weren't really active on GitHub. This pull requests alone was opened in 2018...

But to your comment: I think it's more a question of taste, if you want to use the <?= ?> short tags or not. As discussed previously it's part of the PSR (defined in PSR-1 and I quickly checked PSR-2 and PSR-12 and couldn't find additions regards that) and therefor there is nothing wrong about using it.

I wouldn't even consider it a "pro" tag. You already searched for a framework and chose MINI3, which itself uses objects, models and a basic routing system. Quickly googling for "what does <?= do in PHP" and getting the result "it's basically a short tag for echo" can be expected at this point. And it's definitely not bad for your learning path.

I would even argue we should definitely use the short tag, since it makes new programmers aware of this feature.

But you could add a comment line like // the same as <?php echo "..." ?>.

That's just my opinion. And since panique will probably not comment this discussion nor merge this request, there is no real use in arguing about it.

@BeardyMike
Copy link

BeardyMike commented Feb 1, 2024

Hi @crystlbrd,

// the same as <?php echo "..." ?> - Noted.

@panique
Copy link
Owner

panique commented Feb 5, 2024

Hey hey everybody ;) I'm still there! I am not sure if we should add changes to such an old project, especially if the changes are not really really necessary. Also the changes and the documentation (in the readme file and inside different tutorials on the web) are not fitting together then. What do you think?

@mhco
Copy link
Author

mhco commented Feb 5, 2024

@panique I 100% agree. Any updating that would be needed is also a fun project for developers, anyway. Unless there are security vulnerabilities that are super apparent, there's no need to update the project anymore, especially for tiny changes like this one.

Thanks for the awesome project, though. It is still a great starting place for so many projects that don't need every fancy feature of the bigger frameworks. It's far more maintainable, too.

@crystlbrd
Copy link

crystlbrd commented Feb 6, 2024

Hey @panique, nice to hear from you :)

Regarding the changes:

  • Updating to jQuery 3 seems reasonable - jQuery 1 is more then deprecated at this point.
  • changing url to URL seems to me more like a personal preference, the same goes for the <?= ?> short tags

Thanks for the awesome project, though. It is still a great starting place for so many projects that don't need every fancy feature of the bigger frameworks. It's far more maintainable, too.

It seems like this project is still something unexperienced PHP developer are finding and using as a starting point to learn more about frameworks. I myself switched to Symfony years ago, but I feel MINI is still a great starting point, if a more sophisticated framework is overwhelming for you.

That said, I think the simple and bare bone structure of this project is its core selling point. Any additional "fancy feature" are done way better by the bigger frameworks then we could recreate here. Also, it's not too difficult to implement e.g. Twig or Doctrine into MINI, if required.

Keeping this pack up to date seems to be the way to go.

@BeardyMike
Copy link

Just gonna raise my "new dev" flag and say that I'd love to see this project maintained.

It's been invaluable in learning how PHP works, and seeing the smaller things (jQuery, short codes, etc) being sorted helps to ease the cognitive load on a new dev. I had no idea that was an option, but having a quick comment after it "Echo out "123" would be an enormous help.

TL:DR - This is a vote in favour of maintaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants