Core::Generic templates - why and how?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Core::Generic templates - why and how?

Post by spcherub »

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
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Core::Generic templates - why and how?

Post by Rolf »

The old tag still works:

Code: Select all

{global_content name='foo'}
The new tag is

Code: Select all

{include file='cms_template:foo'}
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
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: Core::Generic templates - why and how?

Post by spcherub »

@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?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Core::Generic templates - why and how?

Post by calguy1000 »

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.
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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Core::Generic templates - why and how?

Post by calguy1000 »

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]
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.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: Core::Generic templates - why and how?

Post by spcherub »

@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
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Core::Generic templates - why and how?

Post by velden »

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.
Post Reply

Return to “CMSMS Core”