Creating content-objects
Creating content-objects
Creating custom content objects, more specific to your business needs
Section(s): data model, learning
What is a content object ?
A content objectis a content that has a detail page on your site (article, category, product...) as we don't know your site, we provide common ones (as article) but feel free to add as many as you need.
contentobject - description
The contentobject is the base object you should always copy for creating specific content objects for your needs. It contains properties needed for handling correctly multisite, multilang, versioning, autopublish, autoarchive, seo issues.
here is the content object structure as it is provided with the current version of WMS.

Properties description
| name | type | nature | description |
|---|---|---|---|
| id | identity | identity | Engine native property |
| created | date (new) | Engine native property | |
| modified | date (new) | Engine native property | |
| owner | child | user | Engine native property |
| parent | sentence | Engine native property | |
| child | word | Engine native property | |
| status | child | workflowstandard | Engine native property |
| name | sentence | Engine native property | |
| activated | child | activated | Engine native property |
| copietravail | child | contentobject | required for versioning |
| uid | word | required for versioning | |
| version | integer | required for versioning | |
| lang | child | lang | required for mulilang (translations) |
| media | child | media | required for multisite (multisite) |
| publishdate | datetime | required for autopublication | |
| archivedate | datetime | required for autoarchive | |
| reftitle | sentence | required for seo | |
| refkeywords | text | required for seo | |
| refdescription | text | required for seo | |
| master | word | required for multilang and multisite content sharing | |
| refurl | sentence | required for seo | |
| mediagroup | child | mediagroup | required for multisite content sharing |
| sharegroup | child | activated | required for multisite content sharing |
| separator_publisharchive | word | ||
| alertparam | cjhild | alertparam |
It is recommended to keep all of these properties unless you're sure you will never need them (who said never ?). Even if you are in a multisite or multilang context, you should keep using multisite and multilang properties as you might want to handle those issues in the future.
multisite issues
Copying the content object should be enough to get a preview button on the dataview action of an object. However, when your platform handles very different kind of sites, you might also need to change the content definition of your site (media object) / sitemodel/ sitegroup (mediagroup). Have a look to those objects and to multisite articles for more details.
Front actions
Now you've created a new content object, but you're job is not exactly done, you have to handle this in FO.
Open the /SAN/__perso/front/common/init/initBaseWhere/initBaseWhere_content.jsp file.
This JSP initializes SQL bases for querying objects. For secutrity reasons, objects for which nothing has been specified will have a 0=1 constraint. That way, we are sure malicious people from seing private datas.
The JSP is then divided in two sections.
one is handling non preview queries, the other for preview queries.
If you created a foo object, you will have to define basewhere_view_foo in live and preview contexts. Look how others are created, it will give you an idea on how initializing them.
Once you're finished, you should have a preview button leading to a default template. Jump to the create template article to go on...
