How does C5 know something is a custom template for a given block?
Permalink
I just installed the Tableless Layout custom template for the Form block (all well and good once I figured out that it wasn't a block but...well...a custom template).
It got installed into the /packages/form_tableless_layout/ directory.
Is every package so installed a custom template?
If not how does C5 distinguish from this template and any other package (custom template?) installed into the packages directory?
If I follow the above directory down I come to...
/packages/form_tableless_layout/blocks/form/templates/...
Hmm...does a block template inside the packages directory become a custom template for the block?
But form_tableless_layout isn't even the name of the standard Form block (whose name is just...well...Form). So how does C5 know this custom template is to be attached to the Form standard block?
Very confusing. Anybody care to englighten me on how this works together? Better yet...does anyone know any documentation anywhere that explains the relationship of these things to each other and what is what?
When is a package not a package but a custom template?
When is a package not really a package or custom template but rather a block?
When is a block a package?
I am still confused by what is what around here.
Thanks.
Carlos
It got installed into the /packages/form_tableless_layout/ directory.
Is every package so installed a custom template?
If not how does C5 distinguish from this template and any other package (custom template?) installed into the packages directory?
If I follow the above directory down I come to...
/packages/form_tableless_layout/blocks/form/templates/...
Hmm...does a block template inside the packages directory become a custom template for the block?
But form_tableless_layout isn't even the name of the standard Form block (whose name is just...well...Form). So how does C5 know this custom template is to be attached to the Form standard block?
Very confusing. Anybody care to englighten me on how this works together? Better yet...does anyone know any documentation anywhere that explains the relationship of these things to each other and what is what?
When is a package not a package but a custom template?
When is a package not really a package or custom template but rather a block?
When is a block a package?
I am still confused by what is what around here.
Thanks.
Carlos
So let me get this straight.
A package is not installable or otherwise usable through the admin interface otherwise known as a Dashboard. It's simply a term used to refer to a collection of files that might make up a block, single page, custom template, or otherwise.
A package is not a block or custom template or other such thing. It's simply a...well...package. A container for other things and a container which can contain all manner of different things.
If a package contains a block that block can be taken out of the package and placed into the usual block file locations. Namely /concrete/blocks/ and /blocks/ (though it's probably best to not put such things into the core /concrete/blocks/ directory).
Likewise if a package...packages up a custom template, that custom template can be taken out and copied into a blocks template folder or an alias of that folder. Or it can just be left inside the package installed in the packages directory since C5 is smart enough to know what block the template contained in the package is supposed to be attached to.
The names of the directories in a package tell C5 what the package contains and what it applies to starting with the deepest directory.
So for the package form_tableless_layout installed into /packages/form_tableless_layout/blocks/form/templates/ the file tableless_layout.php there is (moving up the directory path) a template for the form thingy which is a block.
Does that all sound about right?
Carlos
A package is not installable or otherwise usable through the admin interface otherwise known as a Dashboard. It's simply a term used to refer to a collection of files that might make up a block, single page, custom template, or otherwise.
A package is not a block or custom template or other such thing. It's simply a...well...package. A container for other things and a container which can contain all manner of different things.
If a package contains a block that block can be taken out of the package and placed into the usual block file locations. Namely /concrete/blocks/ and /blocks/ (though it's probably best to not put such things into the core /concrete/blocks/ directory).
Likewise if a package...packages up a custom template, that custom template can be taken out and copied into a blocks template folder or an alias of that folder. Or it can just be left inside the package installed in the packages directory since C5 is smart enough to know what block the template contained in the package is supposed to be attached to.
The names of the directories in a package tell C5 what the package contains and what it applies to starting with the deepest directory.
So for the package form_tableless_layout installed into /packages/form_tableless_layout/blocks/form/templates/ the file tableless_layout.php there is (moving up the directory path) a template for the form thingy which is a block.
Does that all sound about right?
Carlos
just about- except the package is what you install, and during the install process it lets c5 know what all the files are, so it installs all its contents, not the contents installing themselves.
The way I like to think about it is that there are 3 parallel universes in a concrete5 site:
1) The top-level directory of your site (which contains the /blocks/, /config/, /controllers/, /css/, etc. etc. folders).
2) Every package's contents (which *could* contain /blocks/, /controllers/, /css/, etc. etc. -- but usually doesn't -- it just has what it needs -- but the things it has are a subset of the entire list of folders you'll find in your site).
3) The concrete directory (which contains the /blocks/, /config/, /controllers/, /css/, etc. etc. folders)
The way C5 works is is looks for things in your top-level site first, and if it doesn't find it then it looks in the packages (*sometimes* -- there is an unfortunate inconsistency in the way some things work in c5 where this doesn't happen, but theoretically it should), and if it doesn't find it then it looks in /concrete/.
So when concrete5 is putting together the list of custom templates to populate the dropdown box in the editing interface, it looks at all three of those locations (and location #2 could actually be many different locations, depending on how many packages you have installed). If you have a custom template with the same name for the same block in multiple locations, the one in #1 takes precedence, followed by ones found in #2 (I honestly don't know how it would choose between the same custom template found in two packages -- probably just randomly pick one), followed by ones found in #3.
BTW, C5 knows which Custom Templates to attach to which blocks because the custom templates are in a folder with the block's name -- in this case, "form".
1) The top-level directory of your site (which contains the /blocks/, /config/, /controllers/, /css/, etc. etc. folders).
2) Every package's contents (which *could* contain /blocks/, /controllers/, /css/, etc. etc. -- but usually doesn't -- it just has what it needs -- but the things it has are a subset of the entire list of folders you'll find in your site).
3) The concrete directory (which contains the /blocks/, /config/, /controllers/, /css/, etc. etc. folders)
The way C5 works is is looks for things in your top-level site first, and if it doesn't find it then it looks in the packages (*sometimes* -- there is an unfortunate inconsistency in the way some things work in c5 where this doesn't happen, but theoretically it should), and if it doesn't find it then it looks in /concrete/.
So when concrete5 is putting together the list of custom templates to populate the dropdown box in the editing interface, it looks at all three of those locations (and location #2 could actually be many different locations, depending on how many packages you have installed). If you have a custom template with the same name for the same block in multiple locations, the one in #1 takes precedence, followed by ones found in #2 (I honestly don't know how it would choose between the same custom template found in two packages -- probably just randomly pick one), followed by ones found in #3.
BTW, C5 knows which Custom Templates to attach to which blocks because the custom templates are in a folder with the block's name -- in this case, "form".
Thank you. Thank you. Thank you.
I now have a very good understanding of the whole...hmm...package LOL.
Well, maybe not the whole thing but at least respecting packages and how they relate to custom templates that is.
If I can just figure out how to attach a PHP file to the action of a form (the subject of another thread I posted today) I think I will be ready to offer my first attempt at a client site in C5 (other than my own site).
I am going to bookmark this thread and study and perouse it's input for some hours to come.
Carlos
I now have a very good understanding of the whole...hmm...package LOL.
Well, maybe not the whole thing but at least respecting packages and how they relate to custom templates that is.
If I can just figure out how to attach a PHP file to the action of a form (the subject of another thread I posted today) I think I will be ready to offer my first attempt at a client site in C5 (other than my own site).
I am going to bookmark this thread and study and perouse it's input for some hours to come.
Carlos
A block is something that you could put in the root/blocks directory and it would work, and it would be addable in edit mode.
a template is an extension of a block that is put in the blocks template folder, or an alias of that. This is what tableless form layout does- the package directory doesn't have to have the same name, but the blocks folder does- which is why the path is packages/form_tableless_layout/blocks/form/templates, the form folder letting it know what block its a template for and the templates folder letting you know that it is a template.