Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

include directive vs include action  RSS feed

 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
include directive add the content of included resource at compile time where as include action add the content of included resource at request time.
But when we should use include directive and in which condition include action.
 
Steve Leach
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The directive is good for boilerplate code such as copyright notices, etc.
By using the action you can set a page scope attribute in one page and then use it in the included page. It's a speed vs flexibility thing mainly.
 
Tim Baker
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the directive should really only be used for code that will not change, such a library / 3rd party code, whereas the action can be used for code that may be added to or changed at any time.
generally however i don't think includes are a good idea, it's better to encapsulate into classes if possible.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!