# Pages & Records Guide ## Page Types Every CMS record that has an `enlace` (URL) field is a **page**. Pages come in two types determined by the `controlador` field: ### Builder (Modular) Pages - `controlador` = `cms/lib/plugins/builder_saas/controlador.php` - Content is built from **modules** (drag & drop components) - The `builder` field contains a JSON array of module instances - Use MCP tools: `add_module_to_record`, `set_module_config_vars`, etc. - The page template renders modules in order from the builder JSON ### Standard Pages - `controlador` = `cms/lib/plugins/builder_saas/controlador_tabla.php` - Content lives directly in the record fields (`content`, `titulo_alternativo`, etc.) - The `content` field is HTML (wysiwyg) - Use `create_or_update_record` to edit content directly - No modules involved ### How to determine page type **Always check the `controlador` field** of the record: - Contains `controlador.php` (without `_tabla`) → **Builder** - Contains `controlador_tabla.php` → **Standard** ## Table Types (Sections) Tables with pages are called **sections**. There are two section types defined by `menuType` in the schema: ### Category (`menuType = "category"`) - **Hierarchical** — pages have parent/child relationships - Fields: `parentNum`, `depth`, `globalOrder`, `lineage`, `siblingOrder` - Example: `apartados` (main site pages) - Uses `visible_en_el_menu` field for menu visibility - Ordered by `globalOrder` ### Multi (`menuType = "multi"`) - **Flat list** — no hierarchy - Uses `dragSortOrder` for ordering - Example: `blog`, `travesias` - Typically uses `visible` field (not `visible_en_el_menu`) ## Critical Rules for Pages ### NEVER change the `enlace` field Unless the user explicitly asks to change a page URL, **never modify the `enlace` field**. Changing it breaks existing links, SEO, and navigation. The enlace is set when the page is created and should remain stable. ### NEVER change the `controlador` field The controlador defines whether the page is Builder or Standard. Changing it breaks the page rendering. Only set it during page creation. ### Visibility fields - `apartados` and other category tables use: `visible_en_el_menu` (1 = visible, 0 = hidden) - `blog`, `travesias` and other multi tables use: `visible` (1 = visible, 0 = hidden) - Always check which field the table has before toggling visibility ### Name/Title fields - Some tables use `name` (e.g. `apartados`) - Others use `title` (e.g. `blog`, `travesias`) - Check the schema to know which one to use ## Working with Builder Pages ### Adding content to a new Builder page 1. List available modules: `list_available_modules` 2. Add modules: `add_module_to_record` (one at a time, in order) 3. Configure each module: `set_module_config_vars` with content 4. Add images if needed: `upload_record_image` or `generate_image` ### Editing an existing Builder page 1. List current modules: `list_page_modules` 2. Get module vars: `get_module_config_vars` 3. Update vars: `set_module_config_vars` 4. Or edit the module template: edit `index-base.tpl` → `compile_module` ## Working with Standard Pages ### Adding content to a Standard page Use `create_or_update_record` to set: - `content` — HTML content (main body) - `titulo_alternativo` — alternative title shown on the page - `titulo_de_pagina` — browser tab title (SEO) - `metatag_descripcion` — meta description (SEO) ### Example: Update a standard page ``` create_or_update_record with: tableName: "apartados" recordNum: "87" fields: content: "

Our Services

We offer...

" titulo_de_pagina: "Services | My Site" metatag_descripcion: "Discover our services..." ``` ## The `apartados` Table (Special) The `apartados` table is the main pages table in most Acai sites. Key characteristics: - `menuType = "category"` — hierarchical with parent/child - `parentNum` — the num of the parent page (0 = root level) - `depth` — nesting level (0 = root, 1 = child, 2 = grandchild) - `globalOrder` — display order across the entire tree - `visible_en_el_menu` — whether the page shows in the navigation menu - `breadcrumb` — auto-generated breadcrumb path - Pages can be either Builder or Standard (check `controlador` field per record)