I'm trying to understand the purpose of the Core::Generic templates in CMS2. I've read the documentation that refers to the existence of this type of template, but have not found any information about why, how and when they should be used. I saw a reference that said they could be used to replace GCBs, but the only example I saw of implementing GCBs in CMS2 was using content blocks on a regular page template.
Please point me at any references, documentation and examples so I can understand and start to use this new feature.
TIA,
Sanjay
Core::Generic templates - why and how?
Re: Core::Generic templates - why and how?
The old tag still works:
The new tag is
But with the new way of templating, you really don't need to use GCB's!
Read: http://www.cmscanbesimple.org/blog/the- ... gn-manager
Code: Select all
{global_content name='foo'}
Code: Select all
{include file='cms_template:foo'}
Read: http://www.cmscanbesimple.org/blog/the- ... gn-manager
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Core::Generic templates - why and how?
@Rolf - thanks for the response. My question was more about the Generic template itself and the GCB issue was a way to put some context around it.
In your example, it looks like you are include a copy of the template itself. Does this mean that the Core::Generic template is not actually intended to be instantiated into a page or come other content instance? So it is only used to contain base template instances that are inherited by other ones?
In your example, it looks like you are include a copy of the template itself. Does this mean that the Core::Generic template is not actually intended to be instantiated into a page or come other content instance? So it is only used to contain base template instances that are inherited by other ones?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Core::Generic templates - why and how?
As mentioned in the documentation and during release announcements
template are templates. generic templates are treated exactly the same as page templates or Navigator templates, or News templates. The type field is used for filtering at the application level. (i.e: to show you only page templates when selecting a template for a page). 2.x does not any longer differentiate types of templates. The type field is also used when modules uninstall so that they can delete templates that are related to that module. The exception being that modules using the old module-template api are still supported.
There is absolutely nothing stopping you from using a generic template for a news summery template, or news detail template or Navigator template, or page template. Except for the fact people like to have their template lists shorter and pre-filtered for them. Additionally, there is nothing stopping you from calling {include file='cms_template:my-news-summary'} in your page template, where that template is flagged as being associated with the news module.
{News summarytemplate=foo} where "foo" has the type flag of Core::generic will work.
And now there is no option for GCB's to have wysiwygs attached to them.
template are templates. generic templates are treated exactly the same as page templates or Navigator templates, or News templates. The type field is used for filtering at the application level. (i.e: to show you only page templates when selecting a template for a page). 2.x does not any longer differentiate types of templates. The type field is also used when modules uninstall so that they can delete templates that are related to that module. The exception being that modules using the old module-template api are still supported.
There is absolutely nothing stopping you from using a generic template for a news summery template, or news detail template or Navigator template, or page template. Except for the fact people like to have their template lists shorter and pre-filtered for them. Additionally, there is nothing stopping you from calling {include file='cms_template:my-news-summary'} in your page template, where that template is flagged as being associated with the news module.
{News summarytemplate=foo} where "foo" has the type flag of Core::generic will work.
And now there is no option for GCB's to have wysiwygs attached to them.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Core::Generic templates - why and how?
Follow up.
The root of the story is:
We've unified the template functionality. Instead of separate API's for page templates, generic templates (used to be global content blocks) and module templates. there's now one single API. The 'type' thing is just a field in the database to use for filtering at the application level.
[edit: corrected to fix blind typing]
The root of the story is:
We've unified the template functionality. Instead of separate API's for page templates, generic templates (used to be global content blocks) and module templates. there's now one single API. The 'type' thing is just a field in the database to use for filtering at the application level.
[edit: corrected to fix blind typing]
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Core::Generic templates - why and how?
@calguy - thanks for the detailed explanation. The unified approach to templates certainly makes sense now.
One follow up question - I'm assuming that while the Generic template can be used for News, Navigation etc., it cannot be used on its own to create a Page, right?
Sanjay
One follow up question - I'm assuming that while the Generic template can be used for News, Navigation etc., it cannot be used on its own to create a Page, right?
Sanjay
Re: Core::Generic templates - why and how?
Yes, it can be used to create a page template. However:
1. note it doesn't check for the existence of the default content block {content}
2. to be able to actually select those templates when creating a new page, you should change one setting:
Site Admin -> Settings - Content Manager -> Template list mode: an option which allows NOT only page template.
1. note it doesn't check for the existence of the default content block {content}
2. to be able to actually select those templates when creating a new page, you should change one setting:
Site Admin -> Settings - Content Manager -> Template list mode: an option which allows NOT only page template.