3

So i was trying to learn php from a udemy course. The guy there mixes a hell lot of php with html, like all the pages are .php with html content and mini <?php ... ?> Scripts in between everywhere: titles, swl queries running and displaying outputs as html with echo php variables, etc..

Now am not much versed with client server data model, but isn't there supposed to be clear distinction between the server side and the client side? He puts a form there using echo "html string" , rrcieves the form input in the string's action , runs an sql query and generates another set of html strings. All in one file.

Is it how major php websites work? On the other hand My web dev friend om who works a lot with js usually runs 2 seperate aws instances for frontend and backend and makes them communicate via apis

Comments
  • 1
    @molaram do you work with php? What architecture or filesystem you follow?
  • 0
    I'd suggest getting into Symfony, much better compared to raw php :p

    (Willing to elaborate)
  • 1
    The thing is, php was not meant to be a programming language, it started as a template engine and a lot of people still use it as such. I second laracasts.
  • 2
    That's how legacy php sites work, php4 and early 5 had this model.

    Late 5 and 7 we moved to a MVC like style where front end and back end was separated.

    Be careful what you watch on tutorial sites like udemy.

    Check out
    https://phptherightway.com/
    And
    https://www.php-fig.org/psr/

    So you have a clear understanding of how to do things right VS doing things in a poor unmaintainable way that 95% of tutorials teach you.

    Then checkout the MVC pattern

    https://sitepoint.com/the-mvc-patte...

    Then from there you could look at the inner workings of Lavaral or Symfony to understand how frameworks achieve these.

    PHP is a beast which will allow anyone to make easy mistakes and it will just "work", - hence the tutorial your watching, but it's up to the dev to maintain a decent level of discipline to do things right.
  • 3
    @hash-table @alexbrooklyn @yellow-dog @C0D4
    Thanks for your helpful responses.

    In the course, this guy has around 350+vids I am at vid 130 somthing , nd after vid 80, he has stopped teaching any new concepts & is focusing on just this 1 project where he codes an ugly mixture of html/bootstrap/js &php

    When i started seeing the pattern, i switched to w3schools to get a gist of what's left in php basics and learned that.

    Now i can code a decent php generated static site using php/html/css/js mixture (like his style) and a very basic client server website with seperated frontend/backend communicating via json.

    I feel like ditching the course/fast forwarding+ generating a certificate & go on with the frameworks like laravel or other things you said would be a good choice.Or you think i should make some more projects in plain php before jumping onto frameworks?

    There are a lot of stuff that i think i heard from my js dev frnds, but i don't really know myself like routes,security,etc
  • 2
    <Ps I am super new to the world of web dev. I currently know only the basics of html/css/js, bulma css and whatever this guy/w3 told me about php. I am currently making a small login notes website that i took as a casual challenge from my friend>
  • 2
    @StopWastingTime do the course, just keep in mind it's not showing best practise by any means.

    I'd recommend learning raw php and sql (assuming you're hooking up to a db at some stage) and playing around with a framework, as you will need to have some insight into Composer and dependency management before jumping deep into that area.

    https://getcomposer.org/

    But to get started, get comfortable with OOP and MVC as you will need these more then you will need a framework at first.
  • 0
    @StopWastingTime you can always get back the money on udemy (I guess it was 30 days sir some period)

    Also, why not just torrent, wait for prices to lower (which do happen like 10 times a year), buy the course, get the certificate and get money back?

    Tbh, for poor people like me, I prefer this method
  • 1
    @gitlog haha well am also not very rich, but spending money on courses is more like a repentance for me that i spent my hard earned money on this course, so i must learn from it honestly. So no to torrents for courses. An yes i did bought it at Rs 320/- , but i will try your 30 day refund approach in the next course i buy 😝😝
Add Comment