Content Parts - slackero/phpwcms GitHub Wiki
A content part ("CP") is one functional block inside an article — a text with image, an image gallery, a form, a search, a teaser list and so on. Every article is a stack of content parts; that stack is what the frontend renders into the {CONTENT} slot of the page layout. Editors add, order, group and hide the parts in the article detail view of the backend.
Full reference: Content parts documentation.
The dispatcher is include/inc_front/content.article.inc.php. It selects the visible, non-trashed rows of phpwcms_articlecontent for the current article, inside their live/kill date window and matching the visitor's login state, and orders them by acontent_sorting (the backend up/down arrows) and then by row ID. Each row is rendered by its own renderer; the dispatcher wraps it with the anchor (acontent_anchor → <a id="cpid<N>">), spacer classes (acontent_before / acontent_after), block assignment (acontent_block, default CONTENT), tab/accordion grouping (acontent_tab), pagination and the back-to-top link.
The layout template may also request content parts assigned to the SYSTEM block through its [SYSTEM] marker.
Types are identified by acontent_type, mapped to backend labels in $wcs_content_type (include/inc_lib/article.contenttype.inc.php). IDs are historical and not consecutive; unlisted IDs belong to removed types.
| ID | Backend label | Reference |
|---|---|---|
| 0 | Plain text | Plain text |
| 1 | Text w/image | Text w/image |
| 2 | Images | Images |
| 3 | Link & email | Link & email |
| 4 | List | List |
| 5 | Link list | Link list |
| 6 | HTML | HTML |
| 7 | File list | File list |
| 8 | Teaser/link article | Teaser/link article |
| 9 | Multimedia | Multimedia |
| 10 | Email form generator [old] | Email form generator (old) |
| 11 | Code | Code |
| 12 | Newsletter | Newsletter |
| 13 | Search | Search |
| 14 | WYSIWYG HTML | WYSIWYG HTML |
| 15 | Article menu | Article menu |
| 16 | E-card | E-card |
| 18 | Guestbook/comment | Guestbook/comment |
| 19 | Sitemap | Sitemap |
| 21 | Ext. content | Ext. content |
| 22 | RSS feed | RSS feed |
| 23 | Form | Form |
| 24 | Contentpart alias | Contentpart alias |
| 25 | HTML5/Flash media player | HTML5/Flash media player |
| 26 | Recipe | Recipe |
| 27 | FAQ | FAQ |
| 28 | Frontend login | Frontend login |
| 29 | Images <div> | Images <div> |
| 30 | Plug-in | module content part, see below |
| 31 | Images special | Images special |
| 32 | Tabs | Tabs |
| 33 | News | News |
| 50 | Rollover images | Rollover images |
| 51 | Map | Map |
| 52 | PHP variables | PHP variables |
| 60 | Custom CP | Custom CP |
| 89 | Poll | Poll |
| 100 | List | ul-list |
Notes:
- ID 30 is reserved for modules and never listed in
$wcs_content_typeunless at least one active module registers a content part. - Labels 4 and 100 are both "List": ID 4 converts lines to a simple
<ul>(template driven), ID 100 builds nested<ul>/<ol>/<dl>markup from~indent markers. - The table is ordered by ID. The backend select lists the types alphabetically by label by default (
$phpwcms['cnt_sort'] = 'a-z');z-areverses it, empty keeps the definition order.
A module provides its own content part by setting $_module_contentpart = true in its module.default.php. Registration happens in include/inc_lib/modules.check.inc.php. A row of type 30 stores the module name in acontent_module and renders through the module instead of a standard renderer:
- Frontend render:
<module dir>/inc/cnt.article.php - Backend dialog:
<module dir>/inc/cnt.form.php - Submitted values:
<module dir>/inc/cnt.post.php
The row renders only while its module stays enabled. Module-provided types are documented with their module — see the modules reference.
Every standard content part type consists of a small set of files numbered by its ID:
| File | Role |
|---|---|
include/inc_lib/content/cnt<N>.readform.inc.php |
Reads submitted dialog fields from $_POST into $content. |
include/inc_lib/content/cnt<N>.sql.inc.php |
Builds the UPDATE phpwcms_articlecontent … assignments. |
include/inc_lib/content/cnt<N>.takeval.inc.php |
Repopulates $content from the DB row when the dialog opens for editing. |
include/inc_tmpl/content/cnt<N>.inc.php |
Type-specific section of the backend dialog. |
include/inc_tmpl/content/cnt<N>.list.inc.php |
One-line summary shown in the article's content part list. |
include/inc_front/content/cnt<N>.article.inc.php |
The frontend renderer. |
A type without one of these files falls back to the cnt0.* variants.
Where a content part supports templates, the renderer resolves them in this order: the template selected in the dialog from template/inc_cntpart/<type>/<name>.tmpl, then the shipped default from template/inc_default/<name>.tmpl, then a built-in skeleton in the renderer.
- Content parts reference — every type with backend form, rendering and storage
- Articles — adding and ordering content parts in the backend
- Concepts — how articles, structure levels and content parts fit together
- Modules reference — shipped modules and their content parts