Technically speaking, they’re not related.

It’s kind of like asking how SQL and PHP are related — HTML, CSS, and SQL are 
all declarative languages that are frequently used by many different 
programmers and platofrms including PHP, python, javascript and C, which are 
all imperative languages.

I worked with C and C++ for years, and then picked up PHP and javascript very 
easily because they were both closely inspired by C. They’ve all diverged 
somewhat since then, but if you know one, you can pick up the others fairly 
easily, as oppsoed to python, dbase, or APL. 

I’ve been working with Delphi / Object Pascal for years now, and am building 
web apps using TMS WEB Core, which uses a transpiler (pas2js) to convert Object 
Pascal code into javascript. Delphi, however, is rooted in a UI library called 
VCL (Visual Control Library). For web apps in WEB Core, you get to leverage all 
of your non-visual programming knowledge of Delphi, but using VCL concepts to 
implement web UIs has its limitations. They’ve added ways to decorate controls 
at design time with HTML and CSS snippets that get injected into the code, but 
if you don’t know much about CSS (like me) then it’s a PITA to build responsive 
forms. I wouldn’t fare any better if I was using PHP or Python either.

However, I have something called AppGini that’s a mostly no-code approach to 
writing DB-driven apps. It generates PHP code along with HTML and some CSS. It 
offers some “hooks” to customize the heck out of your forms (very simlar to 
“event handlers” in Delphi and C#), but you have to know HTML and CSS pretty 
well to get anywhere with them. Back in 2015 I took on a little project using 
AppGini where I was shown a bunch of screens and told they were static. It was 
pretty easy to duplicate until the client said, “Oops, I probably should have 
brought that site up and shown it to you live.” I was like, “Huh?” It turned 
out that all of the comboboxes were populated dynamically based on other 
selections, and after digging a  little deeper I discovered the site was built 
entirely in C#/.NET. At the time, AppGini couldn’t create comboboxes filled 
dynamically with data when another control was clicked. Since then, that 
feature has been added, although it requires a screen refresh.

So I’d say that in the context of WEB PROGRAMMING, you need to use SOME 
imperative language to spit out the HTML and CSS needed to create the UI 
features you want. PHP is one of many languages traditionally used for that 
purpose.

When I first learned web programming, the thing that got me the most confused 
was the fact that web servers like Apache spit out whatever you hand them, but 
what the user is dealing with is completely stateless. That was quite a radical 
shift from all other sorts of programming used at the time to interact with 
users via a display device like a CRT, as opposed to embedded systems that had 
no generic display.

PHP may have been modeled on C, but its initial divergence had it take on 
features to help manage this lack of statefulness in web apps. Web servers like 
Apache added additional features to help, and newer languages followed suit. 
Javascript really broke down that barrier with the introduction of libraries 
that let you trigger browser-side JS functions in reaction to UI input that 
could issue requests to the server and get responses back without having to 
reload / refresh the web page. The things that responded to those asynch 
requests might have been implemented in PHP, Python, or something else, but it 
wasn’t likely to be JS — although today it could be.

-David Schwartz




> On Jul 2, 2024, at 2:12 PM, Steve Litt via PLUG-discuss 
> <plug-discuss@lists.phxlinux.org> wrote:
> 
> Hi all,
> 
> This is a question for our resident PHP expert Keith Smith, but others
> please feel free to chime in...
> 
> In what ways, if any, is knowledge of HTML and CSS valuable to a PHP
> programmer?
> 
> Thanks,
> 
> SteveT
> 
> Steve Litt 
> http://444domains.com
> ---------------------------------------------------
> PLUG-discuss mailing list: PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list: PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss

Reply via email to