PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] What is the difference between elements and blocks in cakePHP

 April 22, 2022     cakephp-2.3     No comments   

Issue

I was wondering what is the difference between these two, besides the fact that elements are stored in separate files inside a specific folder, and blocks are defined within a view.


Solution

elements can be re-used to keep your code DRY (Don't repeat yourself)

blocks can be appended to inside your code, for instance you spit out the scripts block in your default lay-out. And in your views you place all your javascript into the scripts block, that way all your needed javascript will be included on your page in one place and you do not load more then you need to (views not being used at that time don't write javascript to the scripts block)



Answered By - Alex Stallen
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing