<cfinclude>tag. By calling includePartial() or renderPartial(), you can include other view files in a page, just like
<cfinclude>would. But at the same time, partials make use of common Wheels features like layouts, caching, model objects, and so on.
<cfinclude>a lot in the past (and who hasn't?!), you probably already knew all of this though, right?
viewsfolder. When locating partials, Wheels will use the same rules as it does for the
templateargument to renderView(). This means that if you save the partial in the current controller's view folder, you reference it simply by its name.
viewsfolder. To reference partials in this folder, in this case named shared, you would then pass in
"/shared/banner"to includePartial() instead.
_banner.cfmin the current controller's view folder and include it.
blogcontroller. Then the file that will be included is
.cfmpart or the underscore when referencing a partial.
partialargument to determine what file to include, you can't pass in a variable named partial though. The same goes for the other arguments as well, like
argumentsstruct (which means less chance of strange bugs occurring due to variable conflicts). It also makes for more readable and maintainable code. (You can see the intent of the partial better when you see what is passed in to it).
privateand will return a struct). If so, the partial will call the function and add the output returned to its
layoutargument, like this:
_blue.cfmfile could end up looking something like this:
custvariable contains a
customermodel object. It will then try to include a partial named
_customer.cfmand pass in the object's properties as arguments to the partial. There will also be an
objectvariable available in the
argumentsstruct if you prefer to reference the object directly.
argumentsstruct inside the partial file, and you'll see what's going on. Pretty cool stuff, huh?
_customer.cfmpartial on each iteration. Similar to the example with the object above, Wheels will pass in the objects' properties (in this case represented by records in the query) to the partial.
currentand is available when passing in queries or arrays of objects to a partial.
spacerargument. Anything passed in to that will be inserted between iterations. Here's an example:
group, which contains the albums for the current artist in the loop.