Shop Project - Documentation
Shop LDM
Part 05: Pages & Content
This module extends the labels module with structured page content.
While labels are used for UI elements (buttons, labels) and short texts, this module enables the management of complete pages with multilingual content, structured into sections and content types.
- Content_section: Pages are divided into logical sections.
- Content_type: Different content types within each section.
- Page_content: All content in all supported languages.
- v_page_render: Simplified query for page content (node-content approach).
- Example: Typical page structure with sections, content types, and multilingual content.
HTML-friendly: Direct integration into frontend templates possible.
Content_section
Purpose: Defines structured areas within a page.
Fields:
- sec_ID (PK)
- cat_ID (FK → Category) -- Reference to page/node
- sec_order INT NOT NULL DEFAULT 0 -- Order of sections
- sec_type VARCHAR(20) -- HTML element type (div, section, article)
- sec_html_id VARCHAR(50) -- HTML ID attribute
- sec_class VARCHAR(100) -- CSS classes
- UNIQUE (cat_ID, sec_order) -- Only one section per positionContent_type
Purpose: Defines the type of content within a section.
Fields:
- typ_ID (PK)
- sec_ID (FK → content_section)
- typ_is_global BOOLEAN -- Is the content the same for all languages?
- typ_order INT -- Order within the section
- typ_element VARCHAR(20) -- HTML element (h1, h2, p, ul, etc.)
- typ_class VARCHAR(100) -- CSS classes
- UNIQUE (sec_ID, typ_order) -- Only one type per positionPage_content (Real Text)
Purpose: Stores actual content in different languages.
Fields:
- con_ID (PK) AUTO_INCREMENT
- typ_ID (FK → content_type)
- lan_ID (FK → language) -- NULL = language independent
- con_order INT -- Order for multiple entries
- con_value TEXT -- The actual content
- UNIQUE (typ_ID, lan_ID, con_order) -- Only one content per language and ordervw_page_render View
Purpose: Simplified query for page content (node-content approach).
Fields:
- cat_key -- Unique page key (e.g., 'home')
- cat_ID -- Node ID
- sec_ID -- Section ID
- sec_order -- Section order
- sec_type -- Section HTML element
- sec_html_id -- Section HTML ID
- sec_class -- Section CSS classes
- typ_ID -- Content type ID
- typ_order -- Type order
- typ_element -- Type HTML element
- typ_class -- Type CSS classes
- typ_is_global -- Language independent?
- lan_ID -- Language ID
- con_value -- The actual content
Source:
- FROM tb_category c
- JOIN tb_content_section cs ON c.cat_ID = cs.cat_ID
- JOIN tb_content_type ct ON cs.sec_ID = ct.sec_ID
- JOIN tb_page_content pc ON ct.typ_ID = pc.typ_ID
Sorting: ORDER BY cs.sec_order, ct.typ_order, pc.con_orderTypical Page Structure (Example)
page (e.g., 'about_us')
├── section 0: header
│ ├── type 0: h1
│ │ └── 0 'About Us'
│ └── type 1: p
│ ├── 0: strong 'Welcome'
│ └── 1: span 'To us.'
├── section 1: intro
│ ├── type 0: h2
│ │ └── 0 'Our History'
│ ├── type 1: p
│ │ ├── 0: 'Text...'
│ │ └── 1: '...Text...'
│ └── type 2: img
│ └── 0 'team-photo.jpg'
└── section 2: team
├── type 0: h2
│ └── 0 'Our Team'
├── type 1: li
│ ├── 0: ul 'Number 1'
│ ├── 1: ul 'Number 2'
│ ├── 2: ul 'Number 3'
│ └── 3: ul 'Number 4'
└── type 2: p
└── 0 'Contact...'