Contents (content-types-default.xml and content-types-views-default.xml)


A template's content configuration file is used to define what each zone can or cannot contain in terms of content types and views.

By default, it is possible to insert all types of content available in all zones, using all their views. However, it's not always advisable to be able to do everything in one place, especially if you want to limit your graphic charter.

There are two ways of filtering types contained and viewed in zones: by inclusion or exclusion.

The file "content-types-default.xml"

This file can be located in several places: from the highest priority to the lowest:

In cms/skins/[skinName]/template/[templateName]/conf/content-types-default.xml for a given gabait:

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
   <zones>
       <zone id="default" mode="exclude"></zone>
       <zone id="sidebar" mode="include">
           <content-type id="org.ametys.plugins.news.Content.news"/>
           <content-type id="org.ametys.plugins.faq.Content.faq"/>
       </zone>
   </zones>
</content-types>

This example file authorizes the insertion of all types of content in the default zone and only news and FAQ in the sidebar zone.

But the file can also be valid for all template zones, to authorize only these two types of content in all zones.

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
   <template mode="include">
       <content-type id="org.ametys.plugins.news.Content.news"/>
       <content-type id="org.ametys.plugins.faq.Content.faq"/>
   </template>
</content-types>

Les balises <template> et <zones> sont cumulables. Si une zone n'est pas présente dans la balise <zones> la valeur par défaut sera dans <template>.

In cms/skins/[skinName]/conf/content-types-default.xml for an entire graphic charter:

<?xml version="1.0" encoding="UTF-8"?>
<content-types mode="exclude">
   <content-type id="org.ametys.plugins.news.Content.news"/>
   <content-type id="org.ametys.plugins.faq.Content.faq"/>
</content-types>

In cms/WEB-INF/param/content-types-default.xml for the entire application:

<?xml version="1.0" encoding="UTF-8"?>
<content-types mode="exclude">
   <content-type id="org.ametys.plugins.news.Content.news"/>
   <content-type id="org.ametys.plugins.faq.Content.faq"/>
</content-types>

The file "content-types-views-default.xml"

FromAmetys 4.8

This file is used to define the views that can be used for each type of content. By default, all (non-private) views are usable.

This file can be located in several places: from the highest priority to the lowest:

In cms/skins/[skinName]/template/[templateName]/conf/content-types-views-default.xml for a given gabait :

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
   <zones>
     <zone id="secondary">
        <content-type id="org.ametys.plugins.news.Content.news">
            <views mode="include">
                <view name="main"/>
              </views>
          </content-type>
     </zone>
   </zones>
</content-types>

This example file only authorizes the "main" view for news in the secondary zone. Other types of content are not restricted.

Please note that this file does not limit authorized content types, but rather views.
In this example, nothing indicates that Actualités is an authorized content type. See the top of this page to limit/allow a content type.

But the file can also be valid for all template zones, to limit views in all zones.

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
 <template>
   <content-type id="org.ametys.plugins.news.Content.news">
            <views mode="include">
                <view name="main"/>
              </views>
     </content-type>
  </template>
</content-types>

Les balises <template> et <zones> sont cumulables. Si une zone n'est pas présente dans la balise <zones> la valeur par défaut sera dans <template>.

In cms/skins/[skinName]/conf/content-types-views-default.xml for an entire graphic charter:

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
   <content-type id="org.ametys.plugins.news.Content.news">
            <views mode="include">
                <view name="main"/>
              </views>
     </content-type>
</content-types>

In cms/WEB-INF/param/content-types-views-default.xml for the entire application:

<?xml version="1.0" encoding="UTF-8"?>
<content-types>
   <content-type id="org.ametys.plugins.news.Content.news">
            <views mode="include">
                <view name="main"/>
              </views>
     </content-type>
</content-types>

The view restriction does not apply to content already inserted, even if it is moved from one zone to another (by drag & drop, for example).

The "-default" in file names indicates the type of site created. Default is the type of all normal sites.

Back to top