Knowledgebase

Working With Blade Templates Print

  • phplaravel, database, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Producing output.

WHAT BLADE IS

Laravel's template engine.

WHAT IT PROVIDES

Value output, escaped by default Conditions and loops Layout inheritance Reusable components Including partial templates

WHY ESCAPING BY DEFAULT MATTERS

The most common web vulnerability is prevented unless you deliberately disable it.

WHAT TO DO WHEN YOU DISABLE IT

Be certain the content is safe, and comment why.

WHAT LAYOUTS PROVIDE

A shared structure that pages fill.

WHAT COMPONENTS PROVIDE

Reusable pieces with their own parameters.

WHAT TO USE COMPONENTS FOR

Anything appearing in several places: buttons, cards, form fields, alerts.

WHY

One definition, changed once.

WHAT TO KEEP OUT OF TEMPLATES

Database queries Business logic Complex calculation

WHY

Logic in a template cannot be tested and hides query multiplication.

WHAT TO PASS IN

Data already prepared.

WHAT TO ORGANISE

Templates by feature, mirroring your routes.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot