Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToDo: experiment with using CFM's as modules #20

Open
jfrux opened this issue Oct 1, 2012 · 3 comments
Open

ToDo: experiment with using CFM's as modules #20

jfrux opened this issue Oct 1, 2012 · 3 comments

Comments

@jfrux
Copy link
Contributor

jfrux commented Oct 1, 2012

We all know that cfinclude can create a "mixin" style environment for any component.
But cfinclude is not very elegant and doesn't lend itself well to modular development.

So my theory is, if we standardize cfm-based foundry modules, or possibly even not standardize it but just allow it, we can use require("module-id") and it would grab a cfm file and include it into a component or a page without the need of a file path or even care about that kind of thing.

cfinclude would always be more efficient when including your own files but require() just gives you one more option for modular development.

Components somewhat lock you down to a particular type of object or structure, with cfm-based modules, you could do different things.

@russplaysguitar
Copy link
Member

Don't forget about cfmodule! Not sure where exactly that would fit in to the idea...

@jfrux
Copy link
Contributor Author

jfrux commented Oct 1, 2012

Fair enough, actually, that's perfect... we would just execute it as a customtag (probably) or use that as the syntax of sorts.

I'll look into it more with that in mind.

Thanks!

@russplaysguitar
Copy link
Member

Not sure how familiar you are with cfmodule, but this might be helpful info:

  • cfmodule can be used to include arbitrary cfm files, not just just custom tags
  • cfmodule templates are executed within their own scope (as opposed to include, which executes within the same scope as the calling page)
  • cfmodule will call the template twice if you include the self-closing xml syntax <cfmodule ... /> or write the open/close tags <cfmodule ...> ... </cfmodule>, but only once if you don't self-close a single tag (<cfmodule ...>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants