Git Product home page Git Product logo

php_html's Introduction

PHP_HTML

Few random different ways to structure your HTML in PHP.

1. includes

Older style of using PHP itself as the templating language. Mixes application logic and presentation logic. Variable scope can be a challenge.

2. echos

Actually just by using strings to echo out HTML. Add render functions that just return HTML to be echo'd out.

Using heredoc just for formatting reasons. Could also do individual echo lines.

3. templates

Have certain PHP files set aside for "templates". Adds a new render_template function that takes a template name and a list of variables to pass to the template. Allows you to better separate application logic from rendering logic.

4. mvc

More modern approach to HTML with PHP via an MVC-ish structure. Also added a bit more abstraction by explicitly separating controllers/views.

5. Twig

Using Twig as an HTML templating engine.

Not using PHP for actually manipulating HTML. Leaving that to Twig. PHP's job is just to do the application logic and then pass that on to the templates.

Twig uses composer for dependency management + autoloading. So you'll need to have composer on your machine. Then just cd to this directory and run composer install.

php_html's People

Contributors

kilenaitor avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.