5 ms·
Remember when PHP was supposed to be that?
by creshal 4y ago
Remember when PHP was supposed to be that?
- noduerme 4y agoI still slip <?php> tags straight into inline html a la 2004 from time to time, when it suits the purpose. I even occasionally use href="javascript:" if it saves time. No shame in using what works.
- mjburgess 4y agoIt's not clear to me why a subset of PHP with an extremely fast compiler isn't available/common. That's what it's designed for... People plug-in all sorts into python, why not `from microphp import tpl`, `tpl("blah.phtml")` etc. <html..> <? foreach($xs as $y): ?> <? $y; ?> <? endforeach; ?> </html>
- creshal 4y agoPHP is pretty fast already if you use it that way, and don't bury it under 20,000 layers of recursive framework callbacks like wordpress etc. does. But dedicated template languages have superior ergonomics these days, so why bother adapting PHP to it?
- noduerme 4y agotemplates are always limitations, my friend. albatrosses. You're so right about the awful structure of the big CMSs... I've just used my own RYO CMS for 15+ years for website work... it's gone through lots of updates, but it's super simple. I'd never make it public as a framework because any decent dev should be able to roll their own anyway, and I don't need the aggravation. But it's basically a VERY simplified cross between {{handlebars}} and React, without attempting to bind the whole DOM to data, plus a DSL for specifying all the pages and modules of each website in SQL, and setting up english-language router rules. I'd ditch ergonomics any day for understanding what's going on and being able to pare it down as much as possible. Simple website clients pay so little these days it's basically charity work... you need something you can both do in an hour AND never have to worry about WordPress updating.
- czx4f4bd 4y agoAt least in Python, that's kinda what https://www.makotemplates.org https://www.makotemplates.org is. Although if you're just using a subset of PHP suitable for templating, it's not really clear to me what benefit there is to PHP syntax versus, say, Jinja2 syntax.
- noduerme 4y agothe whole thing with PHP, originally, was you just wrote HTML pages and slipped in PHP <? echo $hello; ?> code here and there where you wanted the server to fill something in with server-side processing as the page was served. This is how it was used before it became common to generate whole templates or pages out of code. You'd be serving a basically static webpage and have a counter at the bottom showing hits, for example, so you'd take your .html and rename it to .php and the counter would be tagged to be generated by the server but everything else would just be plain HTML. PHP still supports this and the fact that it evolved into a full fledged language where you generate HTML from it (as opposed to embedding its output in static pages) still seems slightly humorous to me.
- rchaud 4y agoThis is close to Twig syntax, and Twig is pretty much the defacto standard for writing templated PHP.
- yamtaddle 4y agoPHP with a correctly-configured server is about as fast as web-oriented scripting languages get, in practice. Yes, including Node. To be sure to beat it you'll need to switch to something compiled, and then take great care not to make any mis-steps.
- conductr 4y agoThe ease of deployment alone keeps me going back to PHP, but the speed is nice too
- yamtaddle 4y agoIf I'm in a hurry I still just use the fucking <center> tag. It works and I can't be bothered to google what's correct this week, if I'm just dipping into HTML for a minute or two.